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

Thread: sd card data flow

  1. #1
    Junior Member
    Join Date
    Jun 2017

    sd card data flow

    Well i have a project that i need to read constantly bytes from a binary file "byte" from sd card and make an output with port manipulation (PORTD = buf, ... or PORTD = inside a loop) at some stable frequency.

    I have read that because of the sd card latency the command will not excecute at the same time everytime so the output frequency will not be stable.Is this latency happens when i open the file once read until the end with a loop and then close the file???

    If so,the other solution is to read from sd card each 512 bytes and store each byte into a buf array with the help of a struct according to that https://hackingmajenkoblog.wordpress...on-an-arduino/ .The problem now is that each time i read 512bytes i have to wait for those to come plus the sd card read latency.Is it possible to make two buffer arrays of 512bytes each -> fill the first one -> start port manipulation with the first array inside a timer interrupt with frequency of (10 or 20Khz or more) so the output always have stable freq while in another loop try to fill the other array??I mean is it possible to interrupt the ",size of(512))" command without issues??

    If so how i can deal with smooth data rate and have a stable frequency??

    I believe that the same problem occurs with microcontroller audio players which they play wav from sd card.Please help me,thanks in advance!!!

  2. #2
    Administrator Robin's Avatar
    Join Date
    Oct 2012
    PJRC Global Headquarters
    This was cross-posted in Project Guidance. Please see that thread for replies. I'm closing this thread to consolidate the conversation.

Posting Permissions

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