sparkfun / SparkFun_BNO080_Arduino_Library

An Arduino Library for the BNO080 IMU combination triple axis accelerometer/gyro/magnetometer packaged with an ARM Cortex M0+ running powerful algorithms.
Other
81 stars 62 forks source link

what to do when already some data in buffer? #84

Closed jerabaul29 closed 3 years ago

jerabaul29 commented 3 years ago

I am trying to understand a bit more about the low level interfacing to the sensor.

It looks like there may be some problems now and then with some unexpected data in the I2C buffer, if I understand right:

https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/blob/223cd8ee1850f5d36b80f3315937b96dfb188a3d/src/SparkFun_BNO080_Arduino_Library.cpp#L1471-L1477

I was curious of one thing: if there is some unexpected / corrupted data present, should it also be wiped out there? If not, can you explain why? :) .

PaulZC commented 3 years ago

Hi JR (@jerabaul29 ), I added those lines when I was trying to debug the communication issues when using the Apollo3 (Artemis) boards. I found that asking the processor to do 'something else' before attempting to read the packet improved the reliability of the I2C communication. I'm not actually expecting there to be data in the buffer, I'm just using the available as the 'something else'. If you were to see that debug message, it would mean something very bad had happened... Best wishes, Paul