-
Sat 2019.10.44
For L2
'elapsed 0.00323581695'
Three msec is about what I see with other devices using SPI
L27 setInterval(extraction,0.002);
Are you still getting errors with the above?
A typical value for the duration would be 2 to represent 0.002, but my belief is that is still too small. I would expect a value around 50+
Try
setInterval(extraction,150);
So my guess is that we need to look at how the request for data is made, not the actual transfer of data that seems to be returning accurate values. If setInterval() which needs to be in msec is changed to a value of 100-2000 does the error after around eight or so iterations still occur?
Was the datasheet link in #19 accurate? -
'The goal is to do the data collection at 833 Hz for hours'
Would you point to a page within the datasheet, that suggests using that frequency or range of frequencies for your use. When I read over, my interpretation of how to request data was a bit different.
How are the gyro, or accelerometer used? It might be that your requirement is different than I envision.
Are you picking up the device from a stationary position and expecting the Espruino device to respond to that input?
p. 35 of datasheet
Are we in 'continuous' mode?Is so, the FIFO buffer is probably filling up before each data item is removed from the buffer and the device is cramming in bytes until errors in output are seen. Could this be a possibility?
How often do you actually need the data, the device outputs? It seems that it is desired in the msec range, but my interpretation is that reading those values should be in the many tens of msec range, say every half second or so.
Hi Robin,
Thank you for helping me so much
Sorry if I misunderstand, I am not so sure how to measure the repeated part if you mean measure how fast the interval is running.
I put the measure time in the all read_FIFO, read_Normal, and read_Time and this is my output
and the code looks like this
ss
I believe the time I measure is in millisecond, and I also measure the clock frequency of the SPI is running correctly at 10 MHz, so I think both system and SPI should techninilly running fast enough? and thank you again : )
yes, that is the IMU datasheet.
I configured FIFO as continuous mode so I can keep the data from the IMU with a set timestamp and it can keep running for hours.
The goal is to do the data collection at 833 Hz for hours and the output timestamps gap should be fixed (increment by 48 or 49 each timestamp). The FIFO mode provides the correct data but I have to reset every time to get the new set of data since it will stop filling after it full. The reset process result in missing some data, so it is not very ideal
Attached is the SPI clock frequency measured from the oscilloscope
1 Attachment