Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: SD write and read with same time accuracy

  1. #1
    Junior Member
    Join Date
    Mar 2017
    Posts
    2

    SD write and read with same time accuracy

    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.)

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,938
    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).

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,340
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •