Skip to main content
MDoğr.1
Associate II
Jul 11, 2020 3:38 PM UTC
Solved

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

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 =)

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jul 13, 2020 12:59 AM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jul 13, 2020 12:59 AM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
MDoğr.1
MDoğr.1Author
Associate II
Jul 13, 2020 12:14 PM UTC

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