cancel
Showing results for 
Search instead for 
Did you mean: 

bno055 with stm32

Loodan22
Associate II

I wanted to see if the bno055 sensor is ready and set the PB8, PB9 pins as SDA, SCL. (my mcu = stm32f334r8)

connections

SDA_pin -> SDA pin sensor

SCL_pin -> SCL pin sensor

VCC -> VCC

GND -> GND

0693W00000aI7CEQA0.pngbut the variable is never HAL_OK

thanks for answer.

8 REPLIES 8
Foued_KH
ST Employee

Hello @Hamdi Huntürk​ ,

Please make sure you are using the correct parameters for the communication :

  • Address (The default address is 0x29)
  • The frequency ( 400MHz max ) ..

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Loodan22
Associate II

@KHALSI_Foued​  I checked the maximum speed and default value but same result0693W00000aI7jNQAS.png

Please check pin connection :

  • PB9 -> SDA pin sensor
  • PB8 -> SCL pin sensor
  • VCC -> 3.3V
  • GND -> GND

Because It's works (0x28<<1) with

HAL_I2C_Mem_Read()

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

actually it works this way but why didnt work HAL_I2C_IsDeviceReady function

0693W00000aIA2vQAG.png

sorry my fault same result ( I checked pin connection etc.)

0693W00000aIAVxQAO.png

Loodan22
Associate II

Is ADR pin important for device address?

Hello,

Please try (It works fine ) :

// Check if BNO055 is ready
uint8_t ready = 0;
while (!ready) {
    if (HAL_I2C_IsDeviceReady(&hi2c1, 0x28 << 1, 10, 1000) == HAL_OK) {
        // BNO055 is ready, perform additional initialization
        ready = 1;
    } else {
        // BNO055 is not ready yet, wait and try again
        HAL_Delay(100);
    }
}

In this example, the code checks if the BNO055 device is ready by performing an I2C read operation on the BNO055 address (0x28 << 1) with a timeout of 10 milliseconds and a maximum delay of 1 second. If the read operation is successful, the HAL_I2C_IsDeviceReady function will return HAL_OK, indicating that the device is ready.

the read operation fails or times out, the code will wait for 100 milliseconds and try again.

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I checked sca scl pin and work. But same error with ur code