I'm trying to implement MotionFX in my application. So far I have a very basic setup which executes correctly.
iKnobs.output_type = MFX_ENGINE_OUTPUT_ENU;
iKnobs.LMode = 1;
iKnobs.modx = 1;
Then, in a thread, I pull data out of my sensors and push it to the motionfx:
data_in.acc = mptr->acc.AXIS_X * FROM_MG_TO_G;
data_in.acc = mptr->acc.AXIS_Y * FROM_MG_TO_G;
data_in.acc = mptr->acc.AXIS_Z * FROM_MG_TO_G;
data_in.gyro = mptr->gyro.AXIS_X * FROM_MDPS_TO_DPS;
data_in.gyro = mptr->gyro.AXIS_Y * FROM_MDPS_TO_DPS;
data_in.gyro = mptr->gyro.AXIS_Z * FROM_MDPS_TO_DPS;
data_in.mag = mptr->mag.AXIS_X * FROM_MGAUSS_TO_UT50;
data_in.mag = mptr->mag.AXIS_Y * FROM_MGAUSS_TO_UT50;
data_in.mag = mptr->mag.AXIS_Z * FROM_MGAUSS_TO_UT50;
MotionFX_propagate(&data_out, &data_in, 0.01);
MotionFX_update(&data_out, &data_in, 0.01, NULL);
For now, the 0.01 deltatime variable is not accurate, but will be corrected later.
The problem is that I can not call the _propagate and _update function. If I leave only _propagate, I can call that function ripediatelly and get some results. Same with _update. However, if I call them both with each iteration, I run into a hard fault every time.
I have increased stack size to 0x6000 in .ld file with the same results.
In my debugging, it seems that the two functions run fine outside of the thread context.