-
Thr 2019.11.07
My DISCLAIMER from #16 still applies,
Hi @user101931, a quick cursory peek implies the SPI part of the code is working as it should. The timing values don't appear out of range. I'll do a math check this weekend.
'a couple more correct data set will appear before it gets messed up'
What isn't shown is the repeating part. Would you please post the setInterval() line of code.
Although not absolutely needed, but . . . It would help immensely if you could also provide a timing check on just single individual lines, so that some quick mental cross checks could be performed.// such as ax = read_FIFO(ss); // from inside the read_FIFO() function - a single request SPI_read(FIFO_DATA_OUT_H,ss);
'I just realized getTime() was actually returning million seconds (Correct me if I am wrong)'
There are a few links in other posts within this thread, searching w3schools.com and MDN developer.mozilla.org should allow the discovery of that answer. If you are still stuck, please post the final links where discovery ends, and I'll do some digging after that. I'm sure the learning how to find those links will enhance the discovery process and boost your ego. ;-)
When successful, please post the link for future enthusiasts reading this thread. Thanks.
I'll have a bit of time to dig into this over the weekend.
Is this the datasheet for the device?
Hi Robin and AkosLukacs,
Thank you for taking your time helping me.
Here is my code and output for measuring one read_FIFO, (compare with 1/833Hz = 0.0012s). I just realized getTime() was actually returning million seconds (Correct me if I am wrong), the speed is actually very fast if the value that return is ms. (500-1000 times fast than the data generated).
I am concerning if that's my IMU's configuration, I will double-check that.
However, when I decrease the speed to 52Hz or 26 Hz, the data was actually generated properly. and when I optimize the code, a couple more correct data set will appear before it gets messed up.
Not really sure what might be the issue now.
And the corresponding output is:
Enable extraction and disable read_FIFO() in the code
The code to run one complete extraction() with no print
Output
Here is my read_FIFO code, I am calling two SPI_read in this function, FIFO_DATA_OUT_H/L are two registers to store the generated FIFO data
Thank you very much.