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

Thread: Problems with builtin sd card

  1. #1
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9

    Problems with builtin sd card

    Hello, I'm trying to make an portable music player with a teensy 3.6.

    I'm having some trouble with the builtin sd card reader.
    Most of the time, sd begins fails with the following errors codes :
    0x24 (SD_CARD_ERROR_DMA - DMA transfer failed)
    0X08 (SD_CARD_ERROR_CMD10 - Read CID data)

    Sometimes, out of nowhere, it works. It seem to have a better chance of succeeding if
    i try just after letting my teensy unplugged for a long time (maybe it's tired ?).

    To me that sounds like a hardware / wiring problem, but I'm new to this stuff.
    My teensy is soldered to an audio adaptor board and connected to a ssd1351
    oled screen through a breadboard.

    Here is my test code :
    Code:
    include <SdFat.h>
    
    void setup() {
        Serial.begin(9600);
        while (!Serial);
    
        SdFat sd;
        if (!sd.begin(BUILTIN_SDCARD)) {
            sd.initErrorPrint();
        } else {
            Serial.println("success !");
        }
    }
    
    void loop() {
    }
    Do you have any idea of what could be going on ?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,486
    Are you using version 1.53?

    In 1.54 we're changing SD and switching to SdFat version 2 (until very recently called SdFat-beta). Might be worthwhile to uninstall SdFat and give the 1.54-beta5 a try.

    https://forum.pjrc.com/threads/64592...no-1-54-Beta-5

    Starting with 1.54-beta3, when you use SD, it's really using SdFat internally, and it's the newer SdFat. If you're starting a new project, probably best to get started on 1.54-beta5, so you don't end up building a lot of code which is likely to break with the upcoming 1.54 release.

  3. #3
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    Thanks for your response !
    I tried with this latest version of teensyduino,
    sadly it doesn't change anything :'-(

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,658
    Have you tried other cards?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,486
    I ran it here with the latest beta using Teensy 3.6 and a Samsung 32 EVO Plus in the built in SD socket. Uploaded 10 times. It printed "success !" every time.

  6. #6
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    I've tried with one other card, same thing.
    I will try with more once I get my hands on some.

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,658
    Maybe a connection is not good.
    Are there any wires between the Audioshield and the Teensy, or are you using pinheaders?

  8. #8
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    The audio shield is connected using pinheaders, but I haven't soldered every pin.

  9. #9
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    Quote Originally Posted by PaulStoffregen View Post
    I ran it here with the latest beta using Teensy 3.6 and a Samsung 32 EVO Plus in the built in SD socket. Uploaded 10 times. It printed "success !" every time.
    Well I gess that's good news !

  10. #10
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,658
    You should solder at least the needed pins (for the Audiochip and SD, GND and so on..)

  11. #11
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    Well I guess I will try that tomorow.
    But the internal SD is not suppose to interfere with the audio shield pins, am I correct ?

  12. #12
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,658
    Ah, of course..you're using a Teensy with inbuilt slot. No, in this case it is not needed.

  13. #13
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    oh ok,
    I should add that I seem to remeber that this problem was not happening a couple days ago. Could I have fried something while soldering / connecting something badly ?

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,486
    Normally the audio shield should not have any impact on the built in SD socket on Teensy 3.6. None of the signals are shared, only power.

  15. #15
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,658
    SD cards can sometimes draw a lot of current. Maybe look there? Depends on what else you have connected...
    I remember I had similar problems, a long time ago. It helped to solder a 100uF cap to the Teensy 3v3+GND pins near the slot, but I'm not 100% sure if that was reason that it began working..
    Maybe it was just a problem with the slot and the repeated card-inserts solved it...

    @Paul, yes, I wrote this.

  16. #16
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    Well I guess the audio shield + oled screen could be too much of a power draw.
    Thanks I'll look in that direction tomorow !

  17. #17
    Junior Member rcmz's Avatar
    Join Date
    Nov 2020
    Posts
    9
    Quote Originally Posted by Frank B View Post
    SD cards can sometimes draw a lot of current. Maybe look there? Depends on what else you have connected...
    I remember I had similar problems, a long time ago. It helped to solder a 100uF cap to the Teensy 3v3+GND pins near the slot, but I'm not 100% sure if that was reason that it began working..
    Maybe it was just a problem with the slot and the repeated card-inserts solved it...

    @Paul, yes, I wrote this.
    Actually that story rings a bell, I migh have red one of your post previously ^^

Posting Permissions

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