2022-05-18 05:57 PM
Hello, I recently got a SensorTile.Box and wanted to log accelerometer and gyroscope data from the LSM6DSOX along with the time at which the sensor output was recorded. Importantly, I want to do this at the highest frequency possible (6666Hz) with microsecond and possibly nanosecond time resolution.
To attempt to accomplish this I used the "ST BLE Sensor" app from the Google Play Store. I entered expert mode and configured the following inputs:
I configured the app to output to the SD card.
After uploading the app to the SensorTile.Box and logging some data on the SD card I took a look at the logged data. There were two problems:
I looked into some STM32CubeFunctionPack_STBOX1_V1.3.0 code to see if there were any solutions.
In the "DataLogExtended" project I was able to stream data via a USB cable and view it via Unicleo-GUI. The logged time there had microsecond accuracy but I am unsure if that time is coming from the SensorTile.Box or from my PC. Which is it? Also, when I calculated the true frequency of the logged data it was 4280Hz when I had configured it to be 6666Hz.
In the "SDDataLogRToS" project data is logged to the SD card every 10ms. When I changed the code to make the logging period 1ms and recompiled it and uploaded it to the SensorTile.Box it would not log data at all.
In conclusion:
I would appreciate any help and assistance with these problems. Thank you very much :)
Kind regards
Solved! Go to Solution.
2022-06-09 02:01 AM
Hi @OlaBola ,
let me try to answer your questions
the difference between expected data rate and the one that is saved on sdcard is high, but keep in mind that the default fw for sensortile.box is not as accurate as a custom firmware made for logging.
mainly because it is built with so much feature embedded, that a precise log at 6kHz is not its target.
there is also a problem with FreeRTOS, on which the firmware is built: the smallest timing set at 1 ms, so it is hard to work on timings lower than that (ODRs > 1kHz).
while the accelerometer and gyroscope data is buffered to be written at a higher speed, I don't think that the RTC data is buffered too.
so, on this topic, it is not possible to see the EXACT timing of the data.
your best option, is to develop a custom firmware to log the data.
starting from STM32CubeFunctionPack_STBOX1_V1.3.0, as you did, is the right way to go, in my opinion.
remember that you can check the difference in percentage of the effective ODR (and Timestamp Rate) with respect to the typical by checking register INTERNAL_FREQ_FINE (63h).
in the DataLogExtended project, the timestamp should be the one from the board, so the microseconds are right.
there can be a problem in both ODR accuracy and usb optimization in the code, you can check that with the register I mentioned above.
using SDDataLogRToS is not easy, because, as with the default firmware, a RTOS is involved.
in conclusion:
hope this helps
Niccolò
2022-06-09 02:01 AM
Hi @OlaBola ,
let me try to answer your questions
the difference between expected data rate and the one that is saved on sdcard is high, but keep in mind that the default fw for sensortile.box is not as accurate as a custom firmware made for logging.
mainly because it is built with so much feature embedded, that a precise log at 6kHz is not its target.
there is also a problem with FreeRTOS, on which the firmware is built: the smallest timing set at 1 ms, so it is hard to work on timings lower than that (ODRs > 1kHz).
while the accelerometer and gyroscope data is buffered to be written at a higher speed, I don't think that the RTC data is buffered too.
so, on this topic, it is not possible to see the EXACT timing of the data.
your best option, is to develop a custom firmware to log the data.
starting from STM32CubeFunctionPack_STBOX1_V1.3.0, as you did, is the right way to go, in my opinion.
remember that you can check the difference in percentage of the effective ODR (and Timestamp Rate) with respect to the typical by checking register INTERNAL_FREQ_FINE (63h).
in the DataLogExtended project, the timestamp should be the one from the board, so the microseconds are right.
there can be a problem in both ODR accuracy and usb optimization in the code, you can check that with the register I mentioned above.
using SDDataLogRToS is not easy, because, as with the default firmware, a RTOS is involved.
in conclusion:
hope this helps
Niccolò