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

Thread: With Teensy 3.2 w/ Quad Audio (2 Shields) can you select which SD card slot?

  1. #1
    Junior Member
    Join Date
    Aug 2017
    Posts
    19

    With Teensy 3.2 w/ Quad Audio (2 Shields) can you select which SD card slot?

    Hello,

    Running on the Teensy 3.2 with 2 Audio shields configured thusly: https://www.sparkfun.com/news/2055

    Is there a way to select which Audio Shields' SD slot you want to read/write to?

    My SD card setup is currently straight out of the example now:

    Code:
    // Use these with the Teensy Audio Shield
    #define SDCARD_CS_PIN    10
    #define SDCARD_MOSI_PIN  7
    #define SDCARD_SCK_PIN   14
    
    ....
    
    /**
      @return void
      @brief Set up the SD card where the audio files will be stored.
     */
    void sdSetup() {
        // Initialize the SD card
        SPI.setMOSI(SDCARD_MOSI_PIN);
        SPI.setSCK(SDCARD_SCK_PIN);
        if (!(SD.begin(SDCARD_CS_PIN))) {
            // stop here if no SD card, but print a message
            while (1) {
                Serial.println("Unable to access the SD card");
                delay(500);
            }
        }
    }
    Thanks,

  2. #2
    Senior Member
    Join Date
    Nov 2015
    Location
    Cold hollow VT
    Posts
    119
    Each SD card should use a seperate CS pin to avoid data conflicts on the same bus.

    I vaguely remember a post on this forum regarding proper tri-state of SD card outputs. I also know there have been posts about other devices no behaving on the SPI bus.

    You may have to resort to a seperate buffer to take care of this issue. Look at what SumoToy has done with the RA-8875 display for more detail on this problem.

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    The slots need different cs pins. But Im not sure if the sd lib supports two slots. Maybe not.

  4. #4
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by Frank B View Post
    The slots need different cs pins. But Im not sure if the sd lib supports two slots. Maybe not.
    Well, the default SD card slot seems to not work anymore. The project case is pretty small I suspect I was too rough, in fact the SD card that was in it is cracked. At any rate, I don't really need but one slot and was hoping I could use the other (undamaged one) instead. The whole project is soldered together so it would save me 2 man-days if we could figure it out.

  5. #5
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    if the slots are wired 1:1 both slots should work (ok, if undamaged), if you put a card in only one of them. They are wired the same way (Pauls forgot to add a jumper-pad to separate the chipselects).

  6. #6
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by Frank B View Post
    if the slots are wired 1:1 both slots should work (ok, if undamaged), if you put a card in only one of them. They are wired the same way (Pauls forgot to add a jumper-pad to separate the chipselects).
    I have not observed this. In practice, only the SD wired for channel 3&4 is the one that has worked in the past. (Now neither do)

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,674
    Quote Originally Posted by Frank B View Post
    Pauls forgot to add a jumper-pad to separate the chipselects.
    I considered that when I made the 2nd board rev, but it seems pointless when the SD library only works with 1 card.

  8. #8
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by qcarver View Post
    I have not observed this. In practice, only the SD wired for channel 3&4 is the one that has worked in the past. (Now neither do)
    No good...
    Try to switch to a low speed, for example 24MHz. If that does not work, too: Both slots are damaged, or the card is broken.

  9. #9
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by PaulStoffregen View Post
    I considered that when I made the 2nd board rev, but it seems pointless when the SD library only works with 1 card.
    That's right, of course.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,674
    Quote Originally Posted by qcarver View Post
    in fact the SD card that was in it is cracked.
    Maybe test with another card, before second guessing all the connections?

    When both boards are wired together, it really should work in either slot.

  11. #11
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Gentlemen, my apologies. I see why your rules are to post all code, and I have been careful about that because I am writing it under contract. Recently I added a 3 color LED to my project and used the following pins:

    Code:
    int rLed = A0;
    int gLed = A1;
    int bLed = A2;
    I assumed it was a hardware issue I had created but when I went back to check connectivity between the shields and the 3.2 I noticed that the SD card uses A0 (pin 14). If I leave the LEDs off, there is no problem writing to SD. The cracked SD card was just a red herring (and yes that card IS dead).

    Also, you are all correct in that I can use either SD card port among the two shields (as long as I'm not driving LEDs ). So, hopefully that is useful information for you.

    Thanks very much for your input. This is my first real post to this community and I am amazed by the response.
    -Quinn

Posting Permissions

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