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

Thread: SD card interface: Teensy 4.1 vs Teensy 4.0 + Audio adapter

  1. #1
    Junior Member
    Join Date
    Jul 2020
    Location
    The Road
    Posts
    6

    SD card interface: Teensy 4.1 vs Teensy 4.0 + Audio adapter

    Hello,

    I'm looking to build an audio project that reads and writes audio to/from an SD card, and requires 8 analog inputs (pots to control volume etc) as well as audio I/O. As someone diving into this world for the first time, I initially chose the Teensy 4.1 because of its built in SD card interface and plentiful I/O; I would also get the compatible Audio Adapter for it.

    But then I noticed that the Audio Adapter has an SD card slot of its own! So my questions are:

    • Are there any disadvantages or differences to accessing the SD using a Teensy 4.0 with the Audio Adapter's SD card slot, vs using a 4.1's integrated SD slot?
    • Would I still have enough (8) analog inputs available with the 4.0, after the audio adapter is connected?
    • (out of curiosity) if I connected a Teensy 4.1 to an audio adapter, could I use both SD card slots at the same time?


    Thank you,
    A music nerd

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,692
    Quote Originally Posted by even_rats View Post
    • Are there any disadvantages or differences to accessing the SD using a Teensy 4.0 with the Audio Adapter's SD card slot, vs using a 4.1's integrated SD slot?
    • Would I still have enough (8) analog inputs available with the 4.0, after the audio adapter is connected?
    • (out of curiosity) if I connected a Teensy 4.1 to an audio adapter, could I use both SD card slots at the same time?
    Access to T4.1 Sd card is faster (it uses 4-bit parallel SDIO protocol, while AudioAdapter user 1-bit SPI prorocol)
    Analog input on Teensy are independent from Audio I/O of Audio Adapter
    yes you can use both SD Cards (T4.1 and AudioAdapter). only access speed is different (see above)

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,762
    I've tested both, and for reading a single file:
    • Teensy 4.0 using audio shield: 0.9 Mbyte/second;
    • Teensy 4.0 using SD card via soldered pins: 1.2 Mbyte/second;
    • Teensy 4.1 using built-in micro SD card reader: 1.2 Mbyte/second;
    • Teensy 3.2, 3.5, and 3.6 have roughly the same speed using the audio shield as the Teensy 4.0; (and)
    • Teensy 3.5 and 3.6 have roughly the same speed using the built-in micro SD card reader.


    This is using the standard '<SD.h>' library. I haven't tested other libraries.

  4. #4
    Junior Member
    Join Date
    Jul 2020
    Location
    The Road
    Posts
    6
    Very helpful replies. Good to know the read speed in practice. Thanks!

    Quote Originally Posted by MichaelMeissner View Post
    • Teensy 4.1 using built-in micro SD card reader: 1.2 Mbyte/second;
    Any idea if the write speeds would be similar?

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,762
    Quote Originally Posted by even_rats View Post
    Very helpful replies. Good to know the read speed in practice. Thanks!


    Any idea if the write speeds would be similar?
    I didn't test it. My main interest is in having pre-recorded sounds and playing them. The test I used was the example Audio -> HardwareTesting -> SDCardTest, with the appropriate modifications for audio and built-in sd cards.

    I was disappointed that the built-in sd reader wasn't faster.

    I am hoping that when Paul's rewrite of the file system support goes into TeensyDunio 1.54 will allow for easier support of flash memory (either on the audio shield, or soldered onto the Teensy 4.1).

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,238
    Quote Originally Posted by MichaelMeissner View Post
    I am hoping that when Paul's rewrite of the file system support goes into TeensyDunio 1.54 will allow for easier support of flash memory (either on the audio shield, or soldered onto the Teensy 4.1).
    In the short term, I'm aiming for a much lower goal... just to make the File class from SD into a base class which can be shared among libraries.

    Years ago I started a redesign of the SD library. It only supports SPI and only on Teensy 3.x, and so far only offers read-only access to the card. Eventually I will revisit that, or perhaps merge Bill's work on SdFat. But that is a much longer term goal. It's a huge project. It also didn't make as much sense on Teensy 3.0 to 3.2, where we have much less RAM for caching. SD cards have high command latency, so the trick to good performance is many-sector access and lots of caching.

  7. #7
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,762
    Quote Originally Posted by PaulStoffregen View Post
    In the short term, I'm aiming for a much lower goal... just to make the File class from SD into a base class which can be shared among libraries.
    As a coworker of mine used to say before he retired "It's a journey, not an event".

    If would be nice if we could use a common FILE base class among the filesystems, and for WAV/RAW/MP3/etc. files. But I realize it likely will take some amount of time to get there.

    And of course, real life has a tendency to get in the way of things. I need to get back to programming Teensies.

  8. #8
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,692
    Quote Originally Posted by PaulStoffregen View Post
    In the short term, I'm aiming for a much lower goal... just to make the File class from SD into a base class which can be shared among libraries.
    Would it make sense, to define right now a virtual base class that implements a user interface? Next we could try to think about the different implementations.
    Not sure if the old Arduino interface is still the right way. what about Unix style API?
    Anyhow, someone must IMHO indicate the road, we will then run along.

Posting Permissions

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