The board installed with "Hello World" and SD Card initialization sketch. It prints "Hello World" text and SD card files list in Serial Monitor when turn it on for the first time.
The problem is now I can't make SD card works anymore.
Board picture says the SD card CS Pin is GPIO 13 but doesn't work. Already tried changing CS pin to GPIO 2, 4, 14, 15 but also doesn't work.
#include <SPI.h>
#include <SD.h>
File root;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(13)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
root = SD.open("/");
printDirectory(root, 0);
Serial.println("done!");
}
void loop() {
// nothing happens after setup finishes.
}
void printDirectory(File dir, int numTabs) {
while (true) {
File entry = dir.openNextFile();
if (! entry) {
// no more files
break;
}
for (uint8_t i = 0; i < numTabs; i++) {
Serial.print('\t');
}
Serial.print(entry.name());
if (entry.isDirectory()) {
Serial.println("/");
printDirectory(entry, numTabs + 1);
} else {
// files have sizes, directories do not
Serial.print("\t\t");
Serial.println(entry.size(), DEC);
}
entry.close();
}
}
Your board is an ESP32 and not an ESP8266 and Espressif managed to change that behavior again. Sorry for that.
According to the SPI example for the ESP32:
//initialise hspi with default pins
//SCLK = 14, MISO = 12, MOSI = 13, SS = 15
The print on the back of your board says something different. I guess it's time to use your multimeter and check the connections. Check every signal to which pin it is connected.
pylon:
Your board is an ESP32 and not an ESP8266 and Espressif managed to change that behavior again. Sorry for that.
According to the SPI example for the ESP32:
//initialise hspi with default pins
//SCLK = 14, MISO = 12, MOSI = 13, SS = 15
The print on the back of your board says something different. I guess it's time to use your multimeter and check the connections. Check every signal to which pin it is connected.
Already tried with multimeter but can't find CS connection on any pin.
I have the same problem but the solution i found is more easy.
I use the sketch [SD_Test] from:
[Archivo][Ejemplos][SD(Esp32)] (Sorry but i am spanish)
I only change this:
Serial.begin(115200);
if (!SD.begin()) {
Serial.println("Card Mount Failed");
return;
}
for this:
Serial.begin(115200);
SPI.begin(14, 2, 15, 13);
if (!SD.begin(13)) {
Serial.println("Card Mount Failed");
return;
}