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

Thread: Teensy 4.0 SD Corruption

  1. #1

    Teensy 4.0 SD Corruption

    I am using the PJRC's SD board with a Teensy 4 and running Teensduino 1.47. I am also using Teensy's SD library. The hardware consists of a Teensy4, Wiznet WIZ850io and SD card.

    I am experiencing a lot of file corruption problems. Sometimes, the board does not find the SD card. Other times, the card is located and a successful write occurs but then the next write fails. When this happens, the card is also often corrupted.

    I am using an 8 GB SD card formatted using SDFormatter.

    The code I am using is below:

    Code:
     //------------------------------------------------------------
    
    #include <SD.h>
    #include <SPI.h>
    File myFile;
    const int chipSelect = 4;   // Wiz820+SD board: pin 4
    
    
    ...
    ...
    ...
      //http://www.pjrc.com/store/wiz820_sd_adaptor.html#init
    
      pinMode(9, OUTPUT);
      digitalWrite(9, LOW);    // begin reset the WIZ820io
      pinMode(10, OUTPUT);
      digitalWrite(10, HIGH);  // de-select WIZ820io
      pinMode(4, OUTPUT);
      digitalWrite(4, HIGH);   // de-select the SD Card
      digitalWrite(9, HIGH);   // end reset pulse
    
    Serial.print("Initializing SD card...");
      if (!SD.begin(chipSelect)) {
        Serial.println("initialization failed!");
        //return;
      }
      Serial.println("initialization done.");
      write2SD();
      readSD();
      //------------------------------------------------------------
    Is there an issue with using SD cards with the Teensy 4.0? I would appreciate the community's input.
    Last edited by jimmie; 08-29-2019 at 10:47 PM. Reason: added more code

  2. #2
    Sorry for the double post. A more detailed post can be found at:

    https://forum.pjrc.com/threads/57478...Implementation

Posting Permissions

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