SD write and read with same time accuracy

Status
Not open for further replies.

hsPark#1

New member
Hi. I'm working in a graduate school for a project. I just do ADC and write it at SD card memory with teensy 3.6 board. And, there is something i must consider. There is part of few step in our program.
First, I open the file as write mode.
Then, it write a data on the SD Card about 50000 material (measure and write time interval is 1/ 50000sec for 1sec) and re-open the file as read mode and read it for 1 sec(if i divide 1 sec with 50000, i read a txt file in SD Card and calculate with ADC data and txt file data in the same timing. 1/50000 sec ADC data subtract with 1/50000sec read data from txt file). And, analogwrite it at pin. (PWM).
I think there is some time delay(eg. propagation delay or something). How can i deal with time delay? and it is possible to making 2nd step of our program? (read data and subtract it at same moment ADC data.)
 
SD cards will have unpredictable latency as the on board controller goes off and does wear leveling and block shuffling. Normal hammer would be an external RAM or flash IC that you directly map the time segments to and manage the wear leveling/house keeping yourself (pretty simple here when you just dump a single data type across memory).
 
I would like to add: In addition to avoid uSD cards you must consider that all flash are written in blocks (e.g.512 bytes) that means that the first 128 int32 words are typically simply buffered and then if writing is blocking there is additional latency when data are flashed to flash. similar to reading data.
 
Status
Not open for further replies.
Back
Top