2017-10-11 01:55 AM
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
2017-10-11 02:00 AM
Hello,
please enable clock for CRC unit in the microcontroller, it is needed for the algorithm initialization.
2017-10-11 04:56 AM
Yes, it works by adding __CRC_CLK_ENABLE();
2017-10-12 06:04 AM
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.
2017-10-13 02:45 AM
Hello,
Check this again,In USBD_CUSTOM_HID_SendReport( ), the program skips if(hhid->state == CUSTOM_HID_IDLE) as USB status is not idle.
2017-10-13 03:37 AM
MotionFX algorithm doesn't have any impact on the USB peripheral. It does only data processing using the core of microcontroller.
2017-10-13 03:51 AM
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!
2017-10-27 06:06 AM
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?
2017-10-27 06:42 AM
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].