ESP32-S3 SD Card Issue

radurotaru19
Posts: 4
Joined: Wed Dec 07, 2022 2:09 pm

ESP32-S3 SD Card Issue

Postby radurotaru19 » Wed Dec 07, 2022 2:17 pm

Hi,

I am trying to use an SD Card with the ESP32-S3-WROOM-1-N16 on a custom PCB - ATTACHED Schematics below.

I have tried both the SD.h library and the SdFat.h.
PIN CONFIGURATION:
VSPI_MISO 40
VSPI_MOSI 41
VSPI_SCLK 39
VSPI_SS 38

f_mount failed: (3) The physical drive cannot work

Code: Select all

#include <Arduino.h>
#include <SPI.h>
#include <Mcp320x.h>
#define FS_NO_GLOBALS
#include <SdFat.h>
#include <FS.h>
#include <SPIFFS.h>

#define VSPI_MISO   40
  #define VSPI_MOSI   41
  #define VSPI_SCLK   39
  #define VSPI_SS     38

  SdFat *sdp;
/*
#define SPI_CS    	42 		   // SPI slave select
#define ADC_VREF    5080     // 5.080 V Vref
#define ADC_CLK     1600000  // SPI clock 1.6MHz

#define CLK_PIN     39
#define MISO_PIN    40
#define MOSI_PIN    41
#define ALTERNATE_PINS

void setup() {
  //initialise two instances of the SPIClass attached to VSPI and HSPI respectively
  Serial.begin(115200);
  sdp = new SdFat();
  if(!sdp->begin(38, SD_SCK_MHZ(25))) { // ESP32 25 MHz limit
    Serial.println("sdp->begin failed\n");
  } else {
    Serial.println("sdp->begin OK\n");
  }
}

// the loop function runs over and over again until power down or reset
void loop() {
  */
}

Any ideas on how to get this up and running? The resistors that are pulling up the data lines have the value of 20kOhms, I've read on some posts that the recommended are 10kOhms, it should not make any difference really. Any suggestions?
Attachments
SDCARD.png
SDCARD.png (67.88 KiB) Viewed 4112 times

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32-S3 SD Card Issue

Postby lbernstone » Thu Dec 08, 2022 4:14 pm

That comment in your code about initializing the SPI busses doesn't actually do it. There's no default pins on the S3, so you need to begin the SPI yourself to define the pins. Set the core debug level to verbose, and it may give you a bit more detail. Your schematic looks ok, and 20k should work if you have short connections b/w the devices. Note that if you want to use the extended data lines, you should be using the SD_MMC library.

Code: Select all

void setup() {
   Serial.begin(115200);
   SPI.begin(39, 40, 41, 42);
   SD.begin();

Who is online

Users browsing this forum: Baidu [Spider] and 69 guests