2025-06-10 11:57 PM
Hi everyone,
I'm working on a project using the STM32F103C8T6 microcontroller and the ICM-20948 IMU sensor, connected via I2C. I'm using STM32CubeIDE with FreeRTOS integration.
In a bare-metal (non-RTOS) project, the IMU communicates correctly. The device address is detected properly, and I get valid accel/gyro data.
When I move to a FreeRTOS-based project using the same I2C configuration, the IMU fails to respond.The device address is not found, and I get errors from HAL_I2C_Mem_Read().I've confirmed that I2C are initialized before osKernelStart().
want to reliably read IMU data (ICM20948) using I2C + FreeRTOS on STM32F103C8T6.
Can anyone who has done this successfully share suggestions or example code?
Solved! Go to Solution.
2025-06-12 1:33 AM
yes above one is working one without RTOS ,i have only shown the i2c initialization point using debugging next all is working fine on sda and scl lines.
and yes below one is with straight line (no change appear in sda and scl line) is with RTOS at i2c initialization point.
basically i2c is not initializing (no communication) in RTOS project. what should i check now ?
2025-06-12 1:44 AM - edited 2025-06-12 1:47 AM
Hello,
At this stage , I think better to attach both projects: with and without RTOS so may someone can find something ..
2025-06-12 1:49 AM - edited 2025-06-12 2:27 AM
@Piyoosh wrote:what should i check now ?
You need to check why it's not initialising!
PS:
eg, is the initialisation even being called at all?
are you getting errors in the initialisation?
Again, you have working code as a reference - so compare & contrast what happens in that working code to what happens in the non-working code ...
2025-06-12 2:48 AM
@Andrew Neil @mƎALLEm thank you so much you all i found the problem and also fixed it. It was the configuration issue in project RTOS. Thank you so much you all.
2025-06-12 2:49 AM
Thank you so much for this idea.