Skip to main content
Visitor II
July 11, 2020
Solved

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

  • July 11, 2020
  • 1 reply
  • 927 views

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.
    Best answer by Tesla DeLorean

    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

    1 reply

    Graduate II
    July 13, 2020

    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

    MDoğr.1Author
    Visitor II
    July 13, 2020

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