[SOLVED !] continuous data stream on SD


Closed Thread
Results 1 to 5 of 5

Thread: continuous data stream on SD3688 days old

  1. #1
    luciano
    Guest luciano's Avatar

    0 Not allowed!

    Default continuous data stream on SD

    hello to everybody.
    I have now completed a datalogger for saving biological data on SD card.

    everything seems to work fine and reliably, except the fact that I notice a delay of approx 8-10 milliseconds every approx 450 bytes saved.

    is this is this delay unavoidable and necessary to write the buffer (as it roughly corresponds to the 512 bytes) or can I have made some mistake?

    however, there are occasional much longer delays (ranging from 80 to 120 msec) and these -to my understanding- seem to occur randomly.

    is there any possibility to go around these problems?

    I am currently sampling analog data and saving on SD at a rate of approx 5 kbytes/sec, and I need to maintain a similar acquisition rate.

    many thanks for your help
    Luciano

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    TEEGEE
    Guest TEEGEE's Avatar

    0 Not allowed!

    Default

    Hello,

    i have the same problem, and I've used the following method:

    The program collects data in 2 buffers at the internal interuption.
    The program of record (primary loop) does not wait that 1 of 2 buffers is full, and backup alternately

    Best regards
    Thierry


    Ciao,

    o uto lo stesso problema, e ho usato il seguente metodo:

    Il programma raccoglie i dati nel 2 buffer dentro un interuptione.

    Il programma ce mete i dati sul la SD aspetta che 1 di 2 buffer pieno, e les salva 1 volta pieno

    Con i migliori saluti
    Thierry

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    swright
    Guest swright's Avatar

    0 Not allowed!

    Default

    Yes, the shorter delay will occur when the 512 byte buffer is written to a sector of the card. The longer delay is probably occuring when the SD library code is searching for new blank sectors to use. To speed up writing, when the library code finds a new blank sector, it also checks how many other sectors (strictly clusters) are available in the immediate vicinity. Once these have been used, it needs to go back to the FAT table and do quite a lot of work to find the next sector to use. This takes the longer time. Avoiding either of these delays is difficult. I would suggest that you write one interupt driven routine that adds a reading to a circular buffer, and then in the main code, empty the other end of the buffer to the card. When the card delays, the buffer will start to fill, but then after the delay the buffer will empty again. Meanwhile, the readings are recorded at a constant rate. I've done something similar for reading from a card for a wav sound file player, but not tried it for writing, but guess that it will be similar.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    luciano
    Guest luciano's Avatar

    0 Not allowed!

    Default

    thank you both for suggesting a solution. I understand what you mean in general terms, but the all thing seems quite difficult to do. would it be possible to have some example?
    Thank you again for the help
    Luciano

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Wim26
    Guest Wim26's Avatar

    0 Not allowed!

    Default

    I have the same problem, but am acquiring data at a rate of 10K samples/sec.
    I am using a ringbuffer in the ISR of 256bytes which gives me 25.6 milliseconds but this is not always enough.

    And this is after optimizing the 512byte transfers in read_sector_sub and write_sector_sub. (With the hardware SSP you can use overlapped I/O which e.g. boosts the "raw" sector reading from 290 kBytes/sec to 440 kBytes/sec).

    Some other tricks are using larger clustersizes (smaller FAT, less lookups) but I still need a PIC with more memory so I can enlarge my ringbuffer from 256bytes to 1K.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. Serialize video into an SDI stream to TX over cable and RX
      By normnet in forum New devices and techniques
      Replies: 0
      Last Post: 22nd December 2014, 12:35
    2. HPWM is not continuous, why?
      By zerone in forum Proton Plus Compiler v3
      Replies: 4
      Last Post: 22nd January 2010, 21:46
    3. [SOLVED !] Serial Data Stream
      By Roshan in forum Proton Plus Compiler v3
      Replies: 3
      Last Post: 5th October 2007, 10:02
    4. [SOLVED !] Best approach to a continuous audio output?
      By Don Stratton in forum Proton Plus Compiler v3
      Replies: 36
      Last Post: 11th January 2007, 07:34

    Members who have read this thread since 20th November 2019, 08:22 : 0

    Actions :  (Set Date)  (Clear Date)

    You do not have permission to view the list of names.

    Tags for this Thread

    Posting Permissions

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