2023-03-03 12:28 AM
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
but the variable is never HAL_OK
thanks for answer.
2023-03-03 01:08 AM
Hello @Hamdi Huntürk ,
Please make sure you are using the correct parameters for the communication :
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.
2023-03-03 01:43 AM
@KHALSI_Foued I checked the maximum speed and default value but same result
2023-03-03 03:09 AM
Please check pin connection :
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.
2023-03-03 10:10 AM
actually it works this way but why didnt work HAL_I2C_IsDeviceReady function
2023-03-03 02:00 PM
sorry my fault same result ( I checked pin connection etc.)
2023-03-05 08:26 AM
Is ADR pin important for device address?
2023-03-09 02:31 AM
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.
2023-03-09 10:50 PM
I checked sca scl pin and work. But same error with ur code