T_3.6 - SD-Card sometimes works, sometimes not

Status
Not open for further replies.

AdmiralCrunch

Well-known member
Hi

how can it be, that the SD-Card sometimes works, and sometimes not?
(in this case I have to plug-off the Teensy, and plugin it again,... sometimes it works again and sometimes I have to repeat it a few times)

Code:
if (!SD.begin(chipSelect)) {
    if(debug == true) {
      Serial.println("SD initialization failed!");  
      Serial1.write("loading:SD-Initialization failed;");
    }    
    return;
  }
 
Does the card work well elsewhere and properly formatted? What is powering the Teensy? Have you tried and of the included examples set to use the onboard SD?
 
yes I can use it in a raspi without any problems
the teensy is powered via usb

in the examples there is also this line
Code:
if (!SD.begin(chipSelect)) {
on which sometimes it fails..
 
Again might help to have additional information, like what SD card library are you using? what is chipSelect defined as?

How is the SD card formatted? Partitioned? Fat? Fat32? Or something else? Size? When I was having a problem with an SDCard, I ended up (linux) deleting all of the partitions (was used earlier as the logical disk for RPI board. I then created one big partition and formatted as FAT, then everything was happier.
 
to use the T_3.6 native SD card hardware this post show the keyword as found in the examples:

With the normal SD library, all you need to do is SD.begin(BUILTIN_SDCARD). The library will automatically use the 4 bit SDIO interface when you give it that option for SD.begin. Slow SPI mode is used when you give it a pin number for SD.begin(). Easy stuff.

We can't see your code and not sure that has been properly changed.

There is an official SDFORMATTER (verify it is legit to download) program on the web that can be used to clean and prepare the SD card per specs that is generally suggested.
 
to use the T_3.6 native SD card hardware this post show the keyword as found in the examples:



We can't see your code and not sure that has been properly changed.

There is an official SDFORMATTER (verify it is legit to download) program on the web that can be used to clean and prepare the SD card per specs that is generally suggested.

Hi,

I don't understand why it sometimes works and sometimes not, but after formatting the SDCard with the SDFORMATTER the problem is gone :)

Thank you :)
 
The issue I ran into earlier, which was solved by reformatting the drive was, that sometimes the FAT partition table can become corrupted and cause screwy results. That is why sometimes whey you install an SD card or other hardware disk device into a PC you might get some message, like the drive was not properly ejected... Would you like to run a scan (or check)... on this disk to fix it...

Also I think there might be some configurations of FAT drives that maybe this implementations might not like... So when you use it's own format program hopefully it creates a version that it likes.
 
Status
Not open for further replies.
Back
Top