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

Thread: non-blocking read from sd card on Teensy 4.1 ?

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    189

    non-blocking read from sd card on Teensy 4.1 ?

    Is it possible to do non-blocking reads from the sd-card on the teensy 4.1?

    thanks,

    Richie

  2. #2
    Yes. Via DMA.

  3. #3
    Senior Member
    Join Date
    Jan 2014
    Posts
    189
    Interesting and challenging I would imagine.
    In the latest version of Teensyduino, Paul has sped up SdFat.
    After a bit of work weaning off of SD.h, I am hesitant to dive
    into learning how to do DMA from SdFat.

    Is there some access to this technology like a library?

    thanks,

    Richie

  4. #4
    Senior Member
    Join Date
    Jan 2014
    Posts
    189
    Just cam across Bill Greiman;s library at https://platformio.org/lib/show/322/...sySdioDemo.ino

    Looks simple enough. I'll check it out.

    thanks again

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,317
    Quote Originally Posted by RichardFerraro View Post
    Just cam across Bill Greiman;s library at https://platformio.org/lib/show/322/...sySdioDemo.ino

    Looks simple enough. I'll check it out.

    thanks again
    Note, the same library SdFat is in use with Teensyduino.
    Using DMA requires still to wait for conclusion of read. Not sure if SdFat makes it easy the do this outside Library.
    I know ELM CHaN's FatFs allows this, but that is less used in Arduino world.

  6. #6
    The SD card for Teensy 4.1 is over the SDIO interface on LPSPI1. Each SPI port has a 16 word FIFO buffer. You can configure this to trigger an interrupt when it receives data. This interrupt can then be used to initiate a DMA transfer from the buffer to wherever. I think when this DMA is complete, it can send a trigger back to the SPI bus to transfer more data, independent of the main processor.

    There is a DMA library that might be able to help with the DMA side of things.

    Also, the manual is a great source of information, but it's long and complicated: https://www.pjrc.com/teensy/IMXRT1060RM_rev2.pdf

    Something things you might want to look at:
    Receive Data Interrupt Enable
    48.3.5.1 Output Triggers
    Interrupt IRQ 32
    Receive Data DMA Enable

    It won't be easy probably. Good luck.

Posting Permissions

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