Trigger delay in Machine Learning Core feature detection
- October 20, 2021
- 4 replies
- 2660 views
Hello,
I’ve been trying to figure out how fast the machine learning core on the LSM6DSOX can generate an output once the condition for the change has occurred. I am working on a design where feature detection is needed in less than 50ms. I am using the Unico software and an STEVAL-MKI197V1 module with the STEVAL-MKI109V3 board.
From reading the datasheet and the application note AN5259, my understanding of how the Machine learning core (MLC) works is the following:
- samples are taken until the sampling windows is filled.
- once the window is full, statistical parameters are calculated from the samples in the window.
- at the start of the MLC period, the last stored statistical parameters calculated are used to evaluate the MLC decision tree.
- if the decision tree result changes, the tree values is updated, and an interrupt is generated
Let’s consider the following case as an example:
- a sensor output data rate of 833 Hz
- a window length of 8 samples
- a Machine learning core output data rate (ODR) of 104 Hz
- simple identification of tilt angle, using a threshold on the mean accelerometer value on the X axis.
I am using Unico to save and visualize the data from the IMU and the decision tree output.
Now, for this configuration I would expect for the tree output to change in no more than around 10ms after the threshold is crossed, given the MLC data rate of 104Hz, and the fact that the samples windows gets filled at the same rate. The results are quite far from that - I am observing values of around 100ms for this configuration.
I have tried many configurations with varied results. For example, for an MLC ODR of 104Hz, with sampling at 6664Hz and window length of 64 samples, I’ve seen triggering times of 500ms. If the windows length is reduced to 16 samples while maintaining the 6664 HZ sampling rate and 104 Hz MLC ODR, the triggering delays get reduced, with something around 150ms or so.
I suspect the calculation of the statistical parameters is not done independently after the sample window is filled, and is somehow linked to the MLC ODR, as well as the samples window length, but maybe someone knows more about this and can help me understand it, as I can’t seem to find this information anywhere.
I hope I’ve explained the problem reasonably well. I have attached a number of graphs with example results.
Many thanks!


