AnsweredAssumed Answered

Can X-CUBE-MEMS1 libraries be used in B-L475E-IOT01A board?

Question asked by Hector Fernandez on Jan 9, 2018
Latest reply on Jan 10, 2018 by Miroslav B

I have a B-L475E-IOT01A, which I am using now to learn about how ST MEMS sensors work and if I can use them in my future PCB designs.

I have found recently that ST provides a library to mix 9-axis sensor data to calculate the orientation of any device. This libraries are in the X-CUBE-MEMS1.

In my case, I want to use the "MotionFX" library, mixing the data from Magnetometer+Gyroscope+Accelerometer which there are in this board.

 

My problem is that the function "MotionFX_initialize()" gets stuck and never leave. Due to the fact that ST doesn't give us the source code of the library, I can't understand why this function doesn't work, because according to the documentation, there is no requirements or preconditions to use this function.

I have checked the assembly code (using TRUESTUDIO IDE) and this is the result:

 

MotionFX_initialize:
0800de00: ldr r1, [pc, #880] ; (0x800e174 <MotionFX_initialize+884>)
0800de02: ldr r2, [pc, #884] ; (0x800e178 <MotionFX_initialize+888>)
0800de04: stmdb sp!, {r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
0800de08: ldr r3, [r1, #0]
0800de0a: movs r0, #1
0800de0c: bic.w r3, r3, #1
0800de10: str r3, [r1, #0]
0800de12: mov r3, r2
0800de14: str r0, [r2, #0]
0800de16: ldr r5, [r3, #0]
0800de18: cmp r5, #0
0800de1a: bne.n 0x800de16 <MotionFX_initialize+22>
0800de1c: ldr r3, [pc, #860] ; (0x800e17c <MotionFX_initialize+892>)
0800de1e: ldr r2, [pc, #864] ; (0x800e180 <MotionFX_initialize+896>)
0800de20: str r2, [r3, #0]
0800de22: ldr r2, [r3, #0]
0800de24: ldr r3, [pc, #860] ; (0x800e184 <MotionFX_initialize+900>)
0800de26: cmp r2, r3
0800de28: beq.n 0x800de2c <MotionFX_initialize+44>
0800de2a: b.n 0x800de2a <MotionFX_initialize+42>

 

The last assembly code line (0800de2a) is where the code gets stuck. As MotionFX_initialize function doesn't have any parameter, I guess all this assembly code is equal in every microcontroller or evaluation board.

 

In my TRUESTUDIO project, I use "libMotionFX200_CM4F_GCC_ot.a" because B-L475E-IOT01A board have a ARM-M4 microcontroller. I have configured correctly the project in order to link the library with the compiler. Even the whole project can compile without any error.

 

So, I wonder if there are limitations to use this library or if I have found out a bug. Can somebody who have used this library give me some help o tell me if you could use it without problems?

 

List of ideas I have tried so far:

  • In another post, I read this: Problem using MotionGC lib : it does not want to initialize. But my CRC module has always been active and the library doesn't work.
  • Disabling optimizations.
  • Enabling optimizations to -O3 (because "DataLogFusion" example do it).
  • Comparing the IDE configuration with the example, to check if the library linking is correct.#

Outcomes