cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault once calling MotionFX_propagate()

MMa.1893
Associate III

my mcu is STM32F730R8Tx

sensor: LSM9DS1

use CubeMx gen code, with Makefile(under linux env)

I use lsm9ds1_reg.c as sensor driver fetch raw data, and it worked fine.

then, do the following as MotionFX lib documents:

  • MotionFX_initialize()
  • MotionFX_getKnobs(&knobs);
  • MotionFX_setKnobs(&knobs);
  • MotionFX_enable_6X(MFX_ENGINE_DISABLE);
  • MotionFX_enable_9X(MFX_ENGINE_ENABLE);

I can run the code, and i can get ther version code by MotionFX_GetLibVersion(): ST MotionFX v2.4.1

But, if i enable MotionFX_propagate() in the following routie, MCU will enter Hard Falut ISR...

if (is_imu_xl_gy_drdy())
    {
      MFX_input_t raw;
      MFX_output_t out;
      imu_getdata(&raw);
 
      // curr_tick = HAL_GetTick();
      // deltatime = (curr_tick - last_tick)/1000.0;
      // last_tick = curr_tick;
      deltatime = 0.01;
 
      if (0)
      {
        len = snprintf(buf, 256, "%4.2f %4.2f %4.2f | %4.2f %4.2f %4.2f | %4.1f %4.1f %4.1f\n", raw.acc[0], raw.acc[1], raw.acc[2], raw.gyro[0], raw.gyro[1], raw.gyro[2], raw.mag[0], raw.mag[1], raw.mag[2]);
        CDC_Transmit_FS(buf, len);
      }
      
      MotionFX_propagate(&out, &raw, &deltatime);
    }

I have enable CRC in cubemx.

in Makefile, i did some change:

  • FLOAT-ABI change to -mfloat-abi=softfp
  • in LDFLAGS add -u _printf_float
  • in LIBS change to LIBS = -lc -lnosys -l:MotionFX_CM7F_wc32_ot.a -l:MotionFX_CM7F_wc16_ot.a -lm

in STM32F730R8Tx_FLASH.ld

  • change _Min_Heap_Size to 0x1000
  • change _Min_Stack_Size to 0x8000, i think it should large enough..

=============

But why HardFalut once calling MotionFX_propagate ?

Thank thee very much!!

23 REPLIES 23
Eleon BORLINI
ST Employee

Hi @MMa.1893​ ,

It seems so far that everything is fine in your configuration code. Could you please share which version of X-CUBE-MEMS1 or MotionFX library are you using?

Although the MotionFX library is device independent, it is typically used in combination with STM32F4 motherboards.

For this reason, I reported your question internally and we have to double-check the functionality of this function on Cortex-M7.

-Eleon

Hi, Eleon

 i can get ther version code by MotionFX_GetLibVersion(): ST MotionFX v2.4.1

in STM32CubeMX X-CUBE-MEM1, "Drivers and sample application for MEMs components" version is 8.1.1

Thanks for the feedback @MMa.1893​ .

I actually have to correct myself regarding the above sentence "it is typically used in combination with STM32F4 motherboards", since these libraries are provided compiled for Cortex-M0, M3, M4 and M7, so they should work with all the MCU families.

-Eleon

so .... why my code fault ?

We are currently check, and we'll come back to you as soon as possible.

-Eleon

Thank thee very much!

i can send you my design if you need.

Yes, of course, you can share it here or in the Message section of the community.

Thanks,

-Eleon

ok i have message you, hope it can be solved asap��

Hi @MMa.1893​ ,

Our experts have validated that the library is working on NUCLEO- F767ZI, so they believe the library is OK.

About your shared project, there looks like there are many lines put in comments, so it is not clear what was used and what not.

Is it possible for you to create a simple project with only the library and test it? And, if possible, we can also check the input data which are passed to the library.

-Eleon