![bno055 serial library bno055 serial library](https://3.bp.blogspot.com/-ln2dL_ugbAY/WaoecEOS7TI/AAAAAAAADIc/eXYtMR0oFyc9BcuxAqHVwTnXQLtk1gngwCLcBGAs/s1600/2017-09-01%2B21.11.39.jpg)
All reads are returning 0xFF for all bytes. Here you see the indications that the bus is dead. That actually lets me see the moment the read fails with this line:Ĭode: Select all rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)Ĭlk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 It also prints out when the total delta of the IMU fields exceeds 1.0 degrees.
![bno055 serial library bno055 serial library](https://dfimg.dfrobot.com/nobody/wiki/02e54535ac32ad5f197c7f5bc7a82743.jpg)
The sensor is read 20 times per second and prints occur every 5 seconds.
#Bno055 serial library code#
The -18 is the error code return value being recorded in the IMU object which indicates Wire.requestFrom() did not get the number of bytes we requested. This is the output showing the moment the condition occurs: Often, only a power cycle will clear this condition. Wire.reset() has no effect and writes nothing to the bus while this condition persists. Sometimes this condition can clear in a reset, but often it does not. As I have no code that would alter the bytes on error this must be happening in the library code. This also produces a condition where the bytes returned from read() are always 0xFF. Looking at the bus with a logic analyzer shows no activity as SCL never falls from high to low.
![bno055 serial library bno055 serial library](https://cdn-learn.adafruit.com/assets/assets/000/024/667/medium640/sensors_wiring.jpg)
The results indicate that my read() function sees a failure to read the number of bytes specified and returns an error code of -18 to indicate this. My code checks the results of the register write and the bytes read and stores a read or write error code based on what went wrong. I was finally able to add enough error checking and instrumentation to close on what was going wrong. After minutes to hours of stable operation, the reads to the device will begin to fail. The issue that i'm most concerned about is the second. One seems like it may be external, while the other definitely seems to be internal to the Arduino I2C library interface. That has allowed me to zero in on two problems that seem to reoccur at random intervals. After running into random issues reading results in an larger application I decided to create a test application and board just for the BNO055 object I'm writing. I have been fighting with an I2C based IMU unit, the BNO055 from Adafruit.