cancel
Showing results for 
Search instead for 
Did you mean: 

I am having trouble with HAL_I2C_IsDeviceReady() function while using BNO055 sensor

MDoğr.1
Associate II

in bno055's datasheet adress shown as 0x28 or 0x29 (in decimal 40 and 41) but when ı use i2c adress finding function it returns 80. To be sure about adress I writed following code but there is strange issue. When code is like that firstly d becames 2 , after 10 second d becames 4. What is problem about and what should ı do?

Note: I use stm32f4 and i2c1 with pb8 and pb9 pins.

 if(HAL_I2C_IsDeviceReady(&hi2c1 ,40, 1, 100)==HAL_OK)

 d=1;

 else if(HAL_I2C_IsDeviceReady(&hi2c1 ,80, 1, 100)==HAL_OK){

 d=2;

 HAL_Delay(10000);}

 else if(HAL_I2C_IsDeviceReady(&hi2c1 ,41, 1, 100)==HAL_OK)

 d=3;

 else

 d=4;

Thanks for looking =)

1 ACCEPTED SOLUTION

Accepted Solutions

Ok, on the STM32 the I2C uses the 7-bit addressing which is shifted into the high order bits, like it is on the bus

ie (0x28 << 1) --> 01010000

0693W000001shrLQAQ.jpg

https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bno055-ds000.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

Ok, on the STM32 the I2C uses the 7-bit addressing which is shifted into the high order bits, like it is on the bus

ie (0x28 << 1) --> 01010000

0693W000001shrLQAQ.jpg

https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bno055-ds000.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you very much. You helped me to solve my confusion.😊