2021-01-13 04:23 AM
I am using Lis3DSH at 1600 sample rate . I am using I2C at frequency 250Hz for communication with sensor.
If I want to capture 3 seconds data(4800 samples), the actual time taken to complete this procedure is more than 3 seconds, which means overrun is happening, but overrun flag is not getting set.
Same goes for 800 samples/sec rate.
But,When I reduced the Sample rate to 100, the samples are received in exact time.
How can we collect data in exact time? and why is it taking longer than mentioned?
2021-01-13 05:48 AM
Think 250Hz is a typo. Typ. I2C freq. is 400 kHz might be still too slow.
How long (bytes) is a data packet? 6 bytes? (3*16bit)?
How many bytes are in 1 sensor reading in total? (There is a typ. write+read sequence).
For fast sensor reading, SPI is used, I2C might be too slow.
2021-01-13 06:16 AM
Hi @Community member ,
besides @KnarfB indications, check also if you are running in FIFO mode ("simultaneously" reading samples inside a batch of FIFO) or in continuous mode (bypassing the FIFO).
-Eleon
2021-01-14 08:30 PM
Hi,
Sorry for the Typo, its 250KHz.
A data packet is 6*4bytes and I am reading 20 such samples in one iteration as I have set Water Mark level to 20 and I have total 4800 samples.
2021-01-14 08:30 PM
Hi,
I am running in Stream Mode
2021-01-14 11:51 PM
Hi @Community member ,
does your procedure take much more than 3 seconds to complete?
Because sometimes the actual device ODR is slightly different from the nominal one, and you could have for example actual 1560Hz instead of nominal 1600Hz, resulting in a longer total acquisition time for the 4800 samples.
To measure the precise ODR of your device you can enable the DRDY on interrupt and measure the actual data rate. In this procedure, it is strongly recommended to set the BDU (block data update) bit to 1 in the CTRL_REG4 register.
And if you don't set the FIFO full threshold level, do you still experience issues?
If however this is not the case, I suggest you to compare your code with the C example on github lis3dsh_fifo_stream.c, to check if you find any (big) differences.
-Eleon
2021-01-15 12:44 AM
It takes around 4.5seconds to acquire 4800 samples.
I will check the rest of your suggestions
2021-01-17 07:53 PM
Yes, without setting the FIFO full threshold level, I am getting the same issue.
My code is almost similar to the example code.
2021-01-18 03:41 AM
While you are reading one batch of 6*4bytes, is the FIFO filling in the meantime with the next sample batch?
-Eleon