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

Thread: Teensy 4.1 - Two SD cards possible?

  1. #1
    Junior Member
    Join Date
    Jan 2022
    Posts
    2

    Teensy 4.1 - Two SD cards possible?

    Hi, I'm experimenting with a 4.1 for use in a logging application and am successfully using the SD library to write to the inbuilt SD card.

    Ideally, I would have a second SD card and write to both cards more or less simultaneously to improve reliability. Access speed is not critical.

    Is there a way to achieve this?

    Thanks in advance for any advice anyone can give on this.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,350
    Simple answer is yes: Only one SDIO one, but you can have one or more external SD card adapters using SPI, where each one has it's own SPI CS pin. Some of the tests we have been playing with on MTP, I have some of the tests
    configured to use the SD on the T4.1/3.6... and the one off of an Audio Adapter, but could just as be any other external sd with using I believe pin 10 as the chip select pin. Or any other pin that is just what the define value I have set

  3. #3
    Junior Member
    Join Date
    Jan 2022
    Posts
    2
    Awesome. I didn't realize I could use SPI. I think I can take it from here - I see lots of data on this out there.
    Thanks very much for your very helpful reply.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,233
    Make sure you're using the latest software, or at least version 1.54. Older versions have the ancient Arduino SD library which can't possibly use more than 1 card. Newer versions use SdFat, where SD is a thin wrapper for SdFat.

    A similar question came up a week ago. Maybe this thread can help?

    https://forum.pjrc.com/threads/69254...1-Audio-Shield

    I updated the SdFat_Usage example to show how to use SPI1. It's newer than version 1.56, so get the updated example on github if you need to initialize a different SPI port.

    https://github.com/PaulStoffregen/SD..._Usage.ino#L54

    https://github.com/PaulStoffregen/SD...dFat_Usage.ino

Posting Permissions

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