cancel
Showing results for 
Search instead for 
Did you mean: 

About X-CUBE-MEMS

JVinc.1
Associate III

Hello,

I have a few questions about X-CUBE-MEMS as following:

  • Can we run multiple algorithms (MotionFX, MotionDI, MotionTilt etc) on the same platform simultaneously using the same input data? I would like to make performance comparision between algorithms. As the algorithms are provided as object code, is there any dependency between them (CRC module etc..)?
  • What is the stack usage for each algorithm? I couldn't find it in the documentation. When I look at the examples, the stack size is 0x8000 (32kB) which is very high. I need to reduce it in my application. What should be it?
  • I will collect data at a high rate > 800Hz using the FIFO of MEMS. For MotionFX and MotionDI algorithms, the recommended execution rate is 100Hz. Should I use decimation attribute of these algorithms. Are there any examples for decimation usage?
  • In the examples, a timer interrupt is used mostly when reading sensor data. But the ODR and timer will drift in time. In the application notes, it is stated that "Note: BDU only guarantees that the LSB part and MSB part have been sampled at the same moment. For example, if the reading speed is too slow, X and Y can be read at T1 and Z sampled at T2." Isn't it possible that such a condition may occur if timer interrupt is used instead of data ready interrupt?
4 REPLIES 4
Miroslav BATEK
ST Employee

Hello,

here are my answers:

  • Yes, you can use MotioFX, MotionDI, MotionTL simultaneously using the same input data. There should be any issue with dependency between them.
  • Unfortunately I don't have the exact information about the stack usage, but my estimation is a few kB for MotionFX, MotionDI. MotionTL requires very small amount of memory.
  • I would decimate the samples outside the libraries. Why do you want to collect the data at the high rate > 800Hz? May I know what will be the final use or what is your target?
  • Yes, the examples use a timer interrupt, it is from simplicity reason. The example use maximum ODR 100Hz, in this case the firmware and communication is fast enough to read the samples and the X, Y, Z axis will match. The problem you have described can happen but it can be cause by low communication speed between the sensor and MCU. i.e with I2C at low speed you might not have enough time to read all data from the sensor if thee ODR is high. For sure using DRDY interrupt or FIFO is good approach to read all time.

Hello,

Thanks for the answers. More questions:

  • Can you get the exact value for maximum stack usage? It is important for my application.
  • I have dual MEMS which will be used for comparison. The higher ODR will result in less difference between measurements. D you suggest filtering before algorithms?
  • I use CortexM4F CPU and AC6. When I added libraries (MotionXX_CM4F_wc32_ot.a) into project, it fails to merge it when hard floating abi option is selected. If I change it to softfp, it successfully compiles. I think it makes use of both hardware and software floating libraries. Is it OK? Is double precision also needed for calculations?

Is there any update?

  • I don't have a possibility to get the exact maximum stack usage. I think 20kB should be enough. for all libraries, but you will have to try it.
  • I think filtering is not needed as the libraries make some filtering itself.
  • Softfp is OK, it also use FPU. From our measurement the performance is the same for hard and softfp options. We use softfp to have better compatibility with other compilers. FPU with double precision is not needed.