cancel
Showing results for 
Search instead for 
Did you mean: 

MotionFX Initialization Failed

Yong Cai
Associate II
Posted on October 11, 2017 at 10:55

Hello,

I'm a noob on stm32 and keil, I'm not sure the problem is my operation in keil or my configuration about stm32 and x-cube-mems1. Please help with the details.

I successfully run the DataLogFusion example in Nucleo-F401RE and X-NUCLEO-IKS01A2. But when I try to use MotionFX lib in my custom board project, I get this issue.

In debug session, the program could not STEP OVER the function - MotionFX_initialize().

Using

1. Custom board using STM32F401CEUx

2. MotionFX V2.0.0, included MotionFX200_CM4F_Keil_ot.lib

3. Code generated by STM32 CubeMX 4.22, STM32Cube FW_F4 V1.16.0

8 REPLIES 8
Miroslav BATEK
ST Employee
Posted on October 11, 2017 at 11:00

Hello,

please enable clock for CRC unit in the microcontroller, it is needed for the algorithm initialization.

Posted on October 11, 2017 at 11:56

Yes, it works by adding __CRC_CLK_ENABLE();

Posted on October 12, 2017 at 13:04

Hello,

Additional question.

Is there any possible that MotionFX_propagate( ) conflicts with USBD_CUSTOM_HID_SendReport( )?

When it runs MotionFX_enable_9X( ) and MotionFX_update( ) without MotionFX_propagate( ), USB HID sends report successfully, the output fx_data_out of MotionFX_update( ) are all 0x00. The input data looks good, I checked the ACC 1g in Z-axis.

And USBD_CUSTOM_HID_SendReport( ) is not working when MotionFX_propagate( ) is uncommented. In if (pdev->dev_state == USBD_STATE_CONFIGURED ), the program skips, seems it's not configured.

Oh yes, I havn't run MotionFX_MagCal_run( ) to calibrate the magnetometer.

Posted on October 13, 2017 at 09:45

Hello,

Check this again,In USBD_CUSTOM_HID_SendReport( ), the program skips if(hhid->state == CUSTOM_HID_IDLE) as USB status is not idle.

 

   

Posted on October 13, 2017 at 10:37

MotionFX algorithm doesn't have any impact on the USB peripheral. It does only data processing using the core of microcontroller.

Posted on October 13, 2017 at 10:51

It seems the problem is in the setting of MotionFX_Timer interrupt priority.

There are three priority to be considered - USBD_HID, MotionFX_Timer and I2C.

Still a lot to learn. Thank you so much!

Posted on October 27, 2017 at 13:06

Hello,

Again!

6X_Fusion, 9X_Fusion runs nicely right now.

but my MFX_MagCal_output_t mag_cal_output.cal_quality is MFX_MAGCALUNKNOWN. Is it actually running? Or the problem is my input magnetic sensor's data?

   

Posted on October 27, 2017 at 13:42

You have to first initialize the MagCal algorithm using following function:

void MotionFX_MagCal_init(int sampletime, unsigned short int enable);

then send magnetometer data using:

void MotionFX_MagCal_run(MFX_MagCal_input_t *data_in);

while performing 8 shape movement with the magnetometer.

The magnetometer data must be in microtesla divided by 50 unit [uT/50].