BNO055 I2C

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
scowen00
 
Posts: 4
Joined: Sat Jan 15, 2022 3:58 am

BNO055 I2C

Post by scowen00 »

Hello,

I'm trying to use a BNO055 breakout board with an STM32F405 board. I'm using a software serial library that I've used and tested with other sensors, though I've had to change it slightly to accommodate for the BNO055s clock stretching. The problem I'm having is that the BNO055 does not ACK after I write the address with the read bit set. I've attached some screenshots of the exchange that I captured with my bitscope.

I am trying to read the 0x00 register. You can see that after it writes the 0x28 the second time, the master sets the data line high to set the read bit. The BNO055 stretches the clock line but leaves the data line high which is a NACK.

Any clues why this is happening? I expected an ACK followed by the device ID which should be 0xA0.

Best regards, Sam
Attachments
BNO055 i2c packets.png
BNO055 i2c packets.png (7.81 KiB) Viewed 197 times
BNO055 i2c signals.png
BNO055 i2c signals.png (4.71 KiB) Viewed 197 times

User avatar
gammaburst
 
Posts: 1015
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 I2C

Post by gammaburst »

Your sequence begins with an extra clock pulse, or the wrong I2C address.

Here's a scope snapshot of an Arduino Uno reading BNO055 register 0x00 and getting value 0xA0. See decoding at bottom of screen.

The scope is a Siglent SDS1204X-E.
Attachments
Arduino Uno I2C reads BNO055 register 0x00 gets value 0xA0.png
Arduino Uno I2C reads BNO055 register 0x00 gets value 0xA0.png (19.71 KiB) Viewed 175 times

User avatar
scowen00
 
Posts: 4
Joined: Sat Jan 15, 2022 3:58 am

Re: BNO055 I2C

Post by scowen00 »

Thank you for posting that image. One thing I noticed is that the repeated start looks different between yours and mine. In my capture, the SDA line goes high before SCL, then goes low while SCL remains high. In your image, the repeated start looks like SDA pulses low while SCL remains high. I'll change my repeated start to see if that's the issue.

The extra clock pulse at the start is a start condition immediately followed by a stop condition. The purpose of that, supposedly, is to supposedly reset the bus to a known state. This only happens once during initialization, though I'm not sure its necessary at all. I'll remove it to see what effect that has.

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 I2C

Post by jps2000 »

Attached the comprehensive IIC specification for reference
Attachments
I2C spec UM10204-1.pdf
(1.33 MiB) Downloaded 3 times

User avatar
gammaburst
 
Posts: 1015
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 I2C

Post by gammaburst »

Oops, I misread your START-then-STOP.
Wouldn't START-then-STOP merely be SDA going low-then-high while SCL remains high?
I've never heard of doing that to reset the I2C bus, or for any reason.
See I2C Spec section 3.1.16 "Bus clear". The nine-pulse technique has always worked for me.

Here's Rev 7.0 of the I2C spec: https://www.nxp.com/docs/en/user-guide/UM10204.pdf

Repeated START? My example didn't do that. I modified it:
Attachments
Arduino Uno I2C reads BNO055 register 0x00 using repeated-START, gets value 0xA0.png
Arduino Uno I2C reads BNO055 register 0x00 using repeated-START, gets value 0xA0.png (20.77 KiB) Viewed 147 times

User avatar
scowen00
 
Posts: 4
Joined: Sat Jan 15, 2022 3:58 am

Re: BNO055 I2C

Post by scowen00 »

Thanks for the reply, I really appreciate the scope captures, they are a very useful reference.

I removed the first pulse. It did not fix the problem. The only other difference I can see is my clock pulses for the ACK are fatter than the other clock pulses. I modified the code to make them the same width as the other pulses. Now I am seeing something different. Sometimes I get a NACK and sometimes the sensor replies with the device ID 0x6E and not 0xA0. A quick search of the forums, I believe this means the BNO055 is bricked.

:(

Lucky I bought some spares. I'll try another.

User avatar
gammaburst
 
Posts: 1015
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 I2C

Post by gammaburst »

Uh-oh. Yes it could be bricked.
I destroyed my first BNO055 by using a microcontroller that didn't support clock-stretching:
viewtopic.php?f=19&p=774144#p761150

User avatar
scowen00
 
Posts: 4
Joined: Sat Jan 15, 2022 3:58 am

Re: BNO055 I2C

Post by scowen00 »

Just to follow up, I plugged in a new & unused BNO055 breakout board and it worked right away. I probably destroyed the first one while trying to implement clock stretching in my software I2C code. Warning to anyone else starting with this device - make sure you have your clock stretching worked out and tested thoroughly before plugging in this sensor.

Otherwise, it works very well. Very clean signals and accurate.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”