have custom board ESP32 S3 N16R8 and connected 3.3v SD slot and ePaper display 2.9" with distinct pins, i tried to use HSPI for SD and FSPI for ePaper or vice versa. But on SD init i see reboot and error "Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled." Separately SD and ePaper work fine.
My test code:
#include <SPI.h>
#include <SD.h>
#include <GxEPD2_BW.h>
// Pins for SD card (SPI1)
#define SD_CS_PIN 10
#define SD_CLK_PIN 12
#define SD_MISO_PIN 13
#define SD_MOSI_PIN 11
// Pins for ePaper (SPI2)
#define PIN_CS 39
#define PIN_DC 2
#define PIN_RES 38
#define PIN_BUSY 1
#define PIN_SCK 36
#define PIN_MISO -1 // Not used
#define PIN_MOSI 35
// Create two SPI objects
SPIClass spiSD(HSPI); // SPI for SD card
SPIClass spiEPD(FSPI); // SPI for ePaper
// Initialize the display (replace the model if necessary)
GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(PIN_CS, PIN_DC, PIN_RES, PIN_BUSY));
void setup() {
Serial.begin(115200);
delay(1000);
// --- Initialize SPI for ePaper ---
pinMode(PIN_CS, OUTPUT);
digitalWrite(PIN_CS, HIGH); // Disable ePaper before setting up SPI
spiEPD.begin(PIN_SCK, PIN_MISO, PIN_MOSI, PIN_CS);
// --- Initialize ePaper ---
Serial.println("Initializing ePaper...");
//display.epd2.selectSPI(spiEPD, SPISettings(1000000, MSBFIRST, SPI_MODE0)); // You can also bind spiEPD this way
SPISettings epdsettings(115200, MSBFIRST, SPI_MODE0); // Speed, bit order, and SPI mode
display.init(115200, true, 50, false,spiEPD,epdsettings);
Serial.println("ePaper initialized.");
delay(2000);
// --- Initialize SPI for SD ---
pinMode(SD_CS_PIN, OUTPUT);
digitalWrite(SD_CS_PIN, HIGH); // Disable SD before setting up SPI
spiSD.begin(SD_CLK_PIN, SD_MISO_PIN, SD_MOSI_PIN); // You can add SD_CS_PIN, but this doesn't solve the problem
// --- Initialize SD card ---
Serial.println("Initializing SD...");
if (!SD.begin(SD_CS_PIN, spiSD,4000000)) { // You can use 1000000, but it doesn't affect much
Serial.println("SD card initialization failed!");
} else {
Serial.println("SD card initialized successfully.");
}
delay(2000);
}
void loop() {
// Main code
}
and after start have this on Serial Monitor (Visual Code Studio):
18:11:33.495 > Initializing ePaper...
18:11:33.606 > ePaper initialized.
18:11:35.594 > Initializing SD...
18:11:35.778 > Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
18:11:35.783 >
18:11:35.783 > Core 1 register dump:
18:11:35.783 > PC : 0x4037d770 PS : 0x00060c33 A0 : 0x8037fed0 A1 : 0x3fcebc80
18:11:35.783 > A2 : 0xcde8cde8 A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x00060c23
18:11:35.783 > A6 : 0x00060c20 A7 : 0x0000abab A8 : 0x0000abab A9 : 0xffffffff
18:11:35.783 > A10 : 0x00060823 A11 : 0x00000000 A12 : 0x00060820 A13 : 0x3d8008f8
18:11:35.783 > A14 : 0x90e8cde8 A15 : 0x00ffffff SAR : 0x00000001 EXCCAUSE: 0x0000001d
18:11:35.783 > EXCVADDR: 0xcde8cde8 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000
18:11:35.783 >
18:11:35.783 >
18:11:35.783 > Backtrace: 0x4037d76d:0x3fcebc80 0x4037fecd:0x3fcebcc0 0x40380029:0x3fcebce0 0x40377743:0x3fcebd00 0x4037780a:0x3fcebd30 0x42012609:0x3fcebd80 0x420135f5:0x3fcebda0 0x42003f8e:0x3fcebe80 0x42003118:0x3fcebed0 0x42001c7e:0x3fcebf00 0x4200683e:0x3fcebf40
18:11:35.783 >
18:11:35.783 >
18:11:35.783 >
18:11:35.783 >
18:11:35.783 > ELF file SHA256: 9c4519ee94579542
18:11:35.783 >
18:11:35.783 > Rebooting...
18:11:35.783 > ESP-ROM:esp32s3-20210327
18:11:35.783 > Build:Mar 27 2021
18:11:35.784 > Saved PC:0x4202d43e
18:11:35.784 > SPIWP:0xee
18:11:35.784 > mode:DIO, clock div:1
18:11:35.784 > load:0x3fce3808,len:0x4bc
18:11:35.784 > load:0x403c9700,len:0xbd8
18:11:35.791 > load:0x403cc700,len:0x2a0c
18:11:35.797 > entry 0x403c98d0
My platformio settings:
[env:esp32s3box]
platform = espressif32
board = esp32s3box
framework = arduino
upload_speed = 921600
monitor_speed = 115200
monitor_filters =
send_on_enter
time
lib_extra_dirs = lib
lib_deps =
ZinggJM/GxEPD2
bblanchon/ArduinoJson@^7.1.0
plerup/EspSoftwareSerial@^8.2.0
SD
I tried change SPI for SD and ePaper (HSPI/VSPI), change the order (first SD/first ePaper), activate pinMode or without it and every time i get the some error.
You said you're using an ESP32-S3 N16R8. This module has "Octal PSRAM", PSRAM whose performance is enhanced by using extra data pins to communicate with the RAM chip.
According to the ESP32-S3 datasheet,
For modules with Octal SPI PSRAM, i.e., modules embedded with ESP32-S3R8 or ESP32-S3R16V, pins IO35, IO36, and IO37 are connected to the Octal SPI PSRAM and are not available for other uses.
Your code references using pin 35 for MOSI and pin 36 for SCK for the ePaper module. Those pins are not available. When you use them for another device you interfere with the CPU's ability to communicate with PSRAM.
You need to use other pins or a different CPU module that doesn't use Octal PSRAM. You cannot use pins 35, 36 and 37 and expect your device to work.