cancel
Showing results for 
Search instead for 
Did you mean: 

x-nucleo-iks01a2 with motionFX library

AR1
Associate II

Hello,

I'm using nucleoF446RE with X-NUCLEO-IKS01A2. 

I read data from sensor (LSM6DSL and LSM303AGR) and with MotionFX library I get rotations, but there are some problems.

At beginning, if I don't rotate the board, the z-axis rotation is different from 0; 

If I rotate the board along y-axis, I read correct value; 

If I rotate along x-axis, I read correct rotation for x-axis, but there is also a rotation along y-axis and z-axis. (I use USART protocol to send and read data)

Also, I can't do the magnetometer calibration.

Can sameone help me?

Thank you. 

8 REPLIES 8
Miroslav BATEK
ST Employee

I seems like wrong sensor orientation settings.

I propose to use STM32CubeMX and X-CUBE-MEMS1 package. You can generate example application for MotionFX for NUCLEO-F446RE and X-CUBE-NUCLEO-IKS01A2 in the STM32CubeMX. This application should work properly also with magnetometer calibration.

You can also directly check DatalogFusion application inside X-CUBE-MEMS1 package.

AR1
Associate II

I tried to use DataLog application inside X-CUBE-MEMS1 and, using the gui, I see same thing: If I rotate the system along x axis I read rotation also on y axis (about -180), even after the magnetometer calibration.

Moreover, I don’t know why in MotionFX datasheet it is written that the rotation along y axis is between -90 and 90 degrees.

Can you help me?

Thank you

I tried to replicate your issue on Nucleo-F401RE and IKS01A2 and don't see your issue. It always rotates in correct axis only. Please send me your project and datalog. You can store the datalog in Unicleo-GUI application for example.

AR1
Associate II

This is the project that I use to read the rotation with Uncleo-GUI application.

AR1
Associate II

This is the datalog.

Miroslav BATEK
ST Employee

Hello,

I have analyzed your datalog and I see the magnetometer did not reach the calibrated state.

You can check the scatter plot. The points should draw circle with center in [0,0], after calibration you will jump to the calibrated values.

From your datalog I see you didn't cover second half of the sphere (circle) with the movement.

0693W00000D1XIgQAN.png 

This is example of well calibrated magnetometer.

0693W00000D1XJoQAN.png You can try the magnetometer calibration process using MagnetometerCalibration application in X-CUBE-MEMS1.

AR1
Associate II

I did it again and this is the data log. After calibration, when I rotate along x axis there is a rotation along y axis (about -180°) for some seconds and then it return to 0°.

Can I use MotionMC library with MotionFX library? How can I merge them?

Thank you.

Miroslav BATEK
ST Employee

I have a few comments:

The angle ranges are following:

  • Yaw seems ... 0-360 degrees
  • Pitch +/-180 degrees
  • Roll +/-90 degrees

You can use MotionMC to calibrate magnetometer instead of functions MotionFX_MagCal... which are part of the MotionFX library. Basically you need to pass the data to MotionMC library and then use calibrated magnetometer data in sensor fusion (MotionFX).