cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32F103C8T6 + ICM20948] IMU not detected when using FreeRTOS with I2C.

Piyoosh
Associate III

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?

 

14 REPLIES 14

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 ?

 

Hello,

At this stage , I think better to attach both projects: with and without RTOS so may someone can find something ..

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.

@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 ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@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.

Thank you so much for this idea.