2026-04-20 2:30 AM - last edited on 2026-04-20 2:38 AM by Andrew Neil
Hi everyone,
I am working on a project using BNO085 IMU sensor and STM32H7A3ZIT6Q. I have a single sensor working but stuck at 44Hz. The same sensor with SparkFun library on ESP32 achieves 1.2ms read time. I need help understanding why and how to match ESP32 performance on STM32.
Hardware:
Software:
STM32 performance achieved so far:
ESP32 performance with same sensor and SparkFun SH2 library:
This is a huge difference. 19ms on STM32 vs 1.2ms on ESP32 with the same SH2 library underneath.
Current STM32 sh2_hal_read implementation:
static int sh2_hal_read( sh2_Hal_t *self, uint8_t *pBuffer, unsigned len, uint32_t *t_us )
{
uint32_t timeout = HAL_GetTick() + 100;
while (HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_0) == GPIO_PIN_SET)
{
if (HAL_GetTick() > timeout) return 0;
}
HAL_StatusTypeDef status;
status = HAL_I2C_Master_Receive( &hi2c1, BNO085_ADDR, pBuffer, len, 100 );
if( status != HAL_OK ) return SH2_ERR_IO;
*t_us = HAL_GetTick() * 1000;
return len;
}Key observation: ESP32 SparkFun library reads 4 byte header first, then reads payload in 32 byte chunks with INT pin check between each chunk. Our STM32 reads entire packet in one HAL_I2C_Master_Receive call. Not sure if this is the cause of the difference.
What I have tried:
Questions:
Edited to apply source code formatting - please see How to insert source code for future reference.
2026-05-26 2:51 AM
You've marked the thread as solved - ie, answered ?
2026-05-26 11:20 PM
yes same issue that 44hz with stm I still did not get the solution
2026-05-27 1:59 AM - edited 2026-05-27 2:02 AM
So merged into your original thread.
The topic wasn't even the same - the other thread was on a different board!
@dinesh_ee_bme_72 wrote:I still did not get the solution
So why did you mark this thread as solved ?
Instructions to unmark it are here.
2026-05-27 2:42 AM
unmarked done
2026-05-27 2:59 AM
So what is the status now?
Have you got your basic I2C comms working?
What problem(s) exactly are you still facing?
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.