cancel
Showing results for 
Search instead for 
Did you mean: 

MotionFX output stuck at zero on STM32L476 Discovery

HakamYoussef
Associate

Hi everyone,

I am struggling to get MotionFX (9-axis sensor fusion) working on an STM32L476G-DISCOVERY board using the onboard LSM303C (Acc/Mag) and L3GD20 (Gyro).

The Problem: Despite the library being initialized and updated in the main loop, all outputs (data_out.rotation, quaternion) remain strictly at 0.0.

Current Status & Observations:

  • Hardware CRC: Enabled and verified. The CRC->DR register changes value constantly, proving that MotionFX_update is processing data.

  • Timing: The loop is running at 100Hz. I've tested with both a calculated dt and a fixed dt = 0.01f, but the output remains zero.

  • Input Data (data_in):

    • Acc: ~1.0g on Z-axis when flat (normalized to g).

    • Gyro: Normalized to dps (values around 0-5 dps at rest).

    • Mag: Values around -500 µT (normalized using 0.58f LSB for 16G scale).

  • Memory: mfx_buffer is 2450 bytes and aligned to 32-bit (uint32_t array).

  • Configuration: * mfx_knobs.output_type = MFX_ENGINE_OUTPUT_NED;

    • Library enabled in both 6X and 9X modes.

1 REPLY 1
Saket_Om
ST Employee

Hello @HakamYoussef 

I suggest to you to give a look at the source code of the "DataLogFusion" example to see how to use MotionFX library. 

You can refer also to the UM2220

 

 

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