2016-04-04 02:28 AM
Dear All,
My colleagues and me are developing in very short time a new product with STM32 and STM MEMS.
The hardware is on the go, and we are usingNucleo-L476-RG with
X-NUCLEO-IKS01A1 and
STEVAL-MKI160V1 for software tests.
It is necessary for us to use both freeRTOS (the application need threads, semaphores, os timers, etc) and above osMotionFX Libraries, bacause it is a motion sensing application.
The DataLogFusion example, based on a simple while loop, without FreeRTOS, works fine, but we have a worrying trouble with osMotionFX libraries and freeRTOS together.
The trouble happens when we call the two core statements of the osxMotionFX fusion algorithm:
osx_MotionFX_propagate((osxMFX_output*)&sFDataOut, (osxMFX_input*)&sFDataIn, MotionFX_engine_deltatime);
osx_MotionFX_update((osxMFX_output*)&sFDataOut, (osxMFX_input*)&sFDataIn, MotionFX_engine_deltatime, NULL);
and we do this inside a function called by a repetitive FreeRTOS osTimer at 100Hz.
It happens that after the first call of osx_MotionFX_update (at the16th input sample, because the first 15 are discarded as in DataLogFusion example) the following osTimer schedule don’t come back again to the function but generates hard fault.
To be sure of using in the right way the libraries we are using the same code of the DataLogFusion example (MotionFX_Manager.c and .h) calling the same functions in the same sequence for initalization and run (MotionFX_manager_init , MotionFX_manager_start_9X MotionFX_manager_run h and so on), with the only difference that the MotionFX_manager_run repetitive call is done via a 100Hz FreeRTOS osTimer.
This problem is certainly bound to the osxMotionFX calls, because commenting them program and the the osTimer run fine as thet should.
Also I noticed that keeping only the osx_MotionFX_propagate call by commenting the osx_MotionFX_update row, and vice versa, the 100 Hz osTimer run fine, so it is the couple of statements to cause the problem, not the single one.
Is there in the osxMotionFX libraries something making their use problematic inside FreeRTOS, or some caution that should be taken, that we are missing?
Hope having hints and suggestion about this, because not being able to use both FreeRTOS and osxMotionFX libs probably could mean the stop of the project.
Thank in advance for any suggestion and hint, it is very important for us understand the point.
Thanks again
Alberto
Ok finally I had to set (uint16_t) (2 * 512) the stack size of the timer thread of freeRTOS.