cancel
Showing results for 
Search instead for 
Did you mean: 

X-CUBE-MEMS1 Middleware initialization problem

NHarb
Associate

Hi,

I am using a Nucleo-F446RE board with an IFS01A2 to build an eCompass.

I have built a project using CubeMX v5.2.1 and Atollic Truestudio v9.1.

To start with I made sure that I was able to communicate with the different mems sensors and I am successfully receiving acceleration and magnetometer data from the LSM303AGR so I know that the boards and toolchain work as expected.

I have included the MotionEC_CM4F_wc32_ot library which I believe I need for the F446 and the header file. I have also enabled the CRC in CubeMX.

I can successfully call functions like MotionEC_GetLibVersion or MotionEC_SetFrequency which build and run as expected.

My problem starts when I try to call MotionEC_Initialize. This builds but will not run and results in a HardFault. I can't see what is causing the fault. Can anyone suggest what I might be doing wrong.

Much appreciated

Nev

Update:

Digging further it appears that the fault is:

Bus, memory management or usage fault.

Attempt to perform an unaligned access

I have no idea what this means!

2 REPLIES 2
NHarb
Associate

D

Miroslav BATEK
ST Employee

I guess the problem is in stack size, please try to increase the stack.

To properly use eCompass library you have to use also MotionMC and calibrate your magnetometer, before passing the data to eCompass library.