raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.83k stars 820 forks source link

Bug in BME280 SPI example when reading compensation parameters for humidity #480

Closed ig1711 closed 5 months ago

ig1711 commented 6 months ago
According to the BME280 Datasheet Section 4.2.2, the register addresses and compensation parameters are mapped as: Register Address Register content
0xE5[7:4] / 0xE6 dig_H5 [3:0] / [11:4]
0xE7 dig_H6

But, in bme280_spi.c#L173-L174, dig_H5 is evaluated with the values of the registers 0xE6 and 0xE7 and dig_H6 is evaluated with the values of 0xE8 (Note: buffer[0] is the value of 0xE1, so, buffer[5], buffer[6] and buffer[7] have values of 0xE6, 0xE7 and 0xE8 respectively) i.e, not in accordance with the datasheet.

peterharperuk commented 6 months ago

Yes, I think you're right. And unless my eyes deceive me, dig_H1 isn't being read

lurch commented 6 months ago

Is this the same thing as #111 and #442 or are those slightly different?

peterharperuk commented 6 months ago

The first is the dig_H1 problem I mention above, the second is different!