Waveshare E-Paper ESP32 Driver Board + SD Card

ole_sticky_keys
Posts: 2
Joined: Sun Oct 09, 2022 9:27 pm

Waveshare E-Paper ESP32 Driver Board + SD Card

Postby ole_sticky_keys » Sat Nov 26, 2022 7:04 pm

Hello,
I am attempting to use this waveshare custom ESP32 board with an SD card reader. I want to display the the images on the SD card to the waveshare EPD. The problem is, I continually get this error when connecting the SD voltage:

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13864
load:0x40080400,len:3608
entry 0x400805f0

I have tried using an external source for the 5v input to the SD card reader but I get the same result. I have also tried using different GPIOs but to no avail. Any ideas? THANK YOU!!

Pinout attached.
Picture2.png
Picture2.png (1.43 MiB) Viewed 1255 times
Picture1.png
Picture1.png (98.56 KiB) Viewed 1255 times
CODE:

**********************************************************************************************************

// Libraries for SD card
#include "FS.h"
#include <SD.h>
//#include "mySD.h"
#include <SPI.h>
#include "SD_MMC.h" // SD Card ESP32


// Define CS pin for the SD card module
#define SD_MISO 16
#define SD_MOSI 17
#define SD_SCLK 4
#define SD_CS 2
SPIClass sdSPI(VSPI);

String dataMessage;

void setup() {
// Start serial communication for debugging purposes
Serial.begin(115200);

Serial.println("ESP32 initialized");
uint32_t deadline = millis() + 10 * 1000;
while (static_cast<int32_t>(deadline - millis()) > 0) {
delay(1000);
Serial.println(static_cast<int32_t>(deadline - millis()) / 1000);
}

// Initialize SD card
//SD.begin(SD_CS);
sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
if (!SD.begin(SD_CS, sdSPI)) {
Serial.println("Card Mount Failed");
return;
}
Serial.println("1");
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
Serial.println("No SD card attached");
return;
}
Serial.println("Initializing SD card...");
if (!SD.begin(SD_CS)) {
Serial.println("ERROR - SD card initialization failed!");
return; // init failed
}
Serial.println("2");
// If the data.txt file doesn't exist
// Create a file on the SD card and write the data labels
File file = SD.open("/data1.txt");
if (!file) {
Serial.println("File doens't exist");
Serial.println("Creating file...");
writeFile(SD, "/data1.txt", "Reading ID, Date, Hour, Temperature \r\n");
}
else {
Serial.println("File already exists");
}
file.close();
logSDCard();

}

void loop() {
// The ESP32 will be in deep sleep
// it never reaches the loop()
}

// Write the sensor readings on the SD card
void logSDCard() {
//dataMessage = String(readingID) + "," + String(dayStamp) + "," + String(timeStamp) + "," +
// String(temperature) + "\r\n";
dataMessage = "Hello World \n";
Serial.print("Save data: ");
Serial.println(dataMessage);
appendFile(SD, "/data1.txt", dataMessage.c_str());
}

// Write to the SD card (DON'T MODIFY THIS FUNCTION)
void writeFile(fs::FS &fs, const char * path, const char * message) {
Serial.printf("Writing file: %s\n", path);

File file = fs.open(path, FILE_WRITE);
if (!file) {
Serial.println("Failed to open file for writing");
return;
}
if (file.print(message)) {
Serial.println("File written");
} else {
Serial.println("Write failed");
}
file.close();
}

// Append data to the SD card (DON'T MODIFY THIS FUNCTION)
void appendFile(fs::FS &fs, const char * path, const char * message) {
Serial.printf("Appending to file: %s\n", path);

File file = fs.open(path, FILE_APPEND);
if (!file) {
Serial.println("Failed to open file for appending");
return;
}
if (file.print(message)) {
Serial.println("Message appended");
} else {
Serial.println("Append failed");
}
file.close();
}

saltho
Posts: 1
Joined: Thu Apr 13, 2023 11:47 pm

Re: Waveshare E-Paper ESP32 Driver Board + SD Card

Postby saltho » Thu Apr 13, 2023 11:55 pm

Hey ole_sticky_keys,

did you solve the problem? I am currently at the same point.
Thanks and cheers
saltho

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

Re: Waveshare E-Paper ESP32 Driver Board + SD Card

Postby bidrohini » Fri Apr 14, 2023 1:15 pm

Here is a thread about the TG0WDT_SYS_RESET error.
viewtopic.php?t=3267

Who is online

Users browsing this forum: Bing [Bot] and 74 guests