0
votes

I am reading BMP180 pressure sensor on STM32 and well, it works, but, watching the transfer on the analyzer I can always see an extra empty byte read.

I am almost sure, it is because I give the I2C_GenerateSTOP() only after I I2C_ReceiveData() - this is kind of logical, but not as all the examples go. There, you call I2C_GenerateSTOP() even before waiting for the I2C_EVENT_MASTER_BYTE_RECEIVED of the last byte.

Now, if I do as the examples go, the readout is not stable: it works few times, then does not anymore: wait for I2C_EVENT_MASTER_MODE_SELECT after I2C_GenerateSTART() times out.

I tried to search various examples but was not able to find any clue how to resolve this.

Could anybody help ?

1

1 Answers

1
votes

I think the errata sheet for some of their chips describes this behavior

Description
When the EV7, EV7_1, EV6_1, EV6_3, EV2, EV8, and EV3 events are not managed before the current byte is being transferred, problems may be encountered such as receiving an extra byte, reading the same data twice or missing data.

Workaround is there too
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/errata_sheet/CD00190234.pdf