02-27-2019 01:59 PM
Hi,
yesterday I talked to a guy from Bosch Sensortec on their booth at Embedded World and told him it would be nice if devices like the BME280 had unique IDs similar to the 1wire devices. He said that he thinks they have that, but it might only be documented in the BME680's datasheet. So I checked that, but only found the "Unique Chip ID" that's also present in the BME280 documentation. That ID is only unique per sensor model, but I was looking for IDs that are unique to each single device.
So, either it was a misunderstanding and he was referring to that model ID, or there is a per device unique ID that's not documented in either of the manuals.
I noticed that there are some apparently random bytes in undocumented or reserved areas of the BME280's register file, so I still wonder if some of them form a unique ID.
As a workaround I currently construct a unique ID by hashing the calibration data, but of course I can't be sure if there are no two devices with the identical calibration data, so it would be nice to have an ID that is guaranteed to be unique.
cu
rmax
Solved! Go to Solution.
02-28-2019 10:32 AM
Hi rmax,
Yes, we do have a Unique ID for each individual sensor that is not documented in the datasheet. It is retrieved from 4 reserved registers. Below is a snippet for the BME680 based on our sensor API. You can try the same for the BME280 if you already have a few to verify with.
#define BME680_REG_UNIQUE_ID UINT8_C(0x83)
uint8_t uid_regs[4];
bme680_get_regs(BME680_REG_UNIQUE_ID, uid_regs, 4, dev);
uint32_t unique_id = ((((uint32_t)uid_regs[3] + ((uint32_t)uid_regs[2] << 8)) & 0x7fff) << 16) +
(((uint32_t)uid_regs[1]) << 😎 + (uint32_t)uid_regs[0];
02-28-2019 05:13 PM
Thanks, kgoveas!
The four bytes at offset 0x83..0x86 are indeed unique across the 11 pieces of BME280 I checked so far.
But this raises a few more questions:
03-01-2019 08:48 AM - edited 03-01-2019 08:48 AM
Hi rmax,
To answer in brief,
- The register address is correct
- Yes, the ordering is intentional. This is the official trace code you will need to provide in case you have a batch of faulty sensors.
- this will remain confidential.
- For stable and robust operation of the sensor, we do not provide information on registers that are not already documented in the datasheet.
I hope this answers most of your questions.
Regards,
kgoveas