2021-10-15 04:56 AM
Hello,
I'm currently working on a project requiring to get X, Y and Z angles from 2 sensors, (IIS2MDC and ISM330DHCX). In order to do so, I use MotionFX and its 2 functions, MotionFX_propagate and MotionFX_update, both used to run Kalman STM's algorithms.
Everything works fine on the X and Y axis.
However, the Z axis is not responding as it should:
While the board is on it's first side, the Z angle is correctly read and computed. If the board is rotated of 90°, the result returned is indeed 90°.
But if the board is fliped on its other side, the angle I get is 60°.
Furthermore, that behavior is no observed if the data is acquired and processed as a 6-axis acquisition.
Has anyone observed such an issue? Could it be a magnetometer calibration or a sensor setup issue?
Many thanks for the help you could provide.
Matthieu
2021-10-22 12:02 AM
Hello Miroslav,
I tried to create a log for you yesterday but i couldn't with our custom board so i made one myself with measurements.
Note that there is a x0.1 factor applied before displaying those data. They are the direct output of the magnetometer (in mG) *0.1 after hard iron calibration.
Hope this will help.
Would you know if this is soft iron error how i could compensate it? I found some hints on internet but i don't know what values i should use.
2021-10-22 12:59 AM
2021-10-24 11:20 PM
2021-10-24 11:20 PM
2021-10-25 01:29 AM
Hello Matthieu,
would you please send me the last two files (calibrated/uncalibrated) as source file (excel) so I can plot the data in different way?
2021-10-27 06:22 AM
Hi Miroslav
After trying to go back to the example, it seems that the example code works well with the angle returned (and it is well calibrated). So i would like to modify this example in order to add our previous functions.
As we need SPI, I would like to add an interupt based SPI, in order to not break what is currently working with the motionFX example, however i can't find any ST example with it... Would you know where i could find one?
I also need to save the calibration and reuse it. I found MotionFX_LoadMagCalFromNVM(,,) and save functions in the manager, however i don't know if i should modify those in order to have a clean code. In our previous project i was saving the values in the flash memory and i was directly reusing it without going through magCalibration functions.
Also, as the examples are included in a very large package, i would like to extract the project from it, Is this possible?
Thank you very much and sorry for the inconvenience.
2021-10-27 07:53 AM
Hi Matthieu,
concerning the examples for MotionFX and SPI communication with sensors, there is no simple example.
There is firmware for SensorTile.box which use MotionFX and SPI communication with sensors, your can find it here, but maybe it will be difficult to read.
You can also use STM32CubeMX ad X-CUBE-MEMS1 and generate the DatalogFusion for CUSTOM board, in this case you can select the sensors and the communication interface I2C/SPI. If you install additional package X-CUBE-MEMS1 into the STM32CubeMX you should see also User Manual which describes how to generate example applications.
You could also modify the example which you already have from I2C to SPI, I think it is not so difficult.
Concerning saving the calibration values, you can implement it by yourself. Save calibration values to a memory when you are satisfied with the cal. values and load and use them at the next start until you run the calibration algorithm again and you get new values.
Or you can implement the MotionFX_LoadMagCalFromNVM/MotionFX_SaveMagCalFromNVM, you can modify these function in order to save and load the values to a memory you want to use. Load function is automatically called when the calibration is enables and save function is called when the algorithm is disables.
If you want to reduce the size of the package, it is possible to delete drivers (sensors, STM32 HAL, BSP) which you don't use, all middleware except MotionFX you use and also all examples and application except DatalogFusion. If you would generate the application using STM32CubeMX it will generate project with only files which are needed.
2021-10-27 07:59 AM
Thanks for those explanations.
The SPI is only to communicate data from the STM32 to an external MCU. Isn't there any example for a slave SPI IT implementation for the STM32, all sensors data ignored? I successfully used IT to receive data, but not yet to transmit from the slave.
2021-10-27 11:06 AM
Maybe you can check the STM32 HAL package for the MCU family you use where you can find many examples for all peripherals (in projects folder).
https://github.com/STMicroelectronics/STM32Cube_MCU_Overall_Offer
2021-11-09 12:50 AM
Hi Miroslav,
So we have build a common project working for both the stm32 nucleo l476 and our board. This project seems to work well with the nucleo board but our curstom board still seems to have issues. In order to see exactly the differences between our board and the nucleo, we would like to be able to use the unicleo gui with our board. To do so, we want to connect an old st-link disconnected from its board ( the same we have on our nucleo board). We tried to connect the RX-TX NRST and GND between our board and the stlink, however when connecting the stlink to a computer the opening folder contains a fail file saying "The interface firmware FAILED to reset/halt the target MCU".
I found we made a mistake while soldering RX-TX wires, so we will try to correct that.
My question is : should we also connect the JTAG ports or is the st link able to work fine without those, with the unicleo Gui?
That should allow us to provide better logs to understand what really happens with our data.
Many Thanks.