The Waveshare demo example uses HW SPI. You need to use the HW SPI pins on your ESP32 Driver Board, not the SPI pins used on the FPC connector that would require SPI pin remapping.
I have the 4.37" 4-color board. I think I tried it also with the Waveshare demo code, but I can't find the modified epdif.h I might have used.
// mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
// NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
Thank you so much! With that information I was able to get the example partially working. When running the demo code, I can only run one command before it freezes up. It gets hung up when it calls epd.Init() on line 46 of epd3in0g.ino. When debugging, I found that it gets hung up when it is trying to call SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0)); in the IfInit() function. Anybody know what is causing this? I'm just curious.
Thank you, @ZinggJM for helping me get my project up and running.
This occurs on ESP32 when beginTransaction is called twice, when beginTransaction and endTransaction calls are not matched.
Does this occur with the unmodified demo code? Or did you modify it?
I could take a look at it.
int EpdIf::IfInit(void) {
pinMode(CS_PIN, OUTPUT);
pinMode(RST_PIN, OUTPUT);
pinMode(DC_PIN, OUTPUT);
pinMode(BUSY_PIN, INPUT);
SPI.begin();
SPI.endTransaction(); // ignored if no beginTransaction() has been called
SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
return 0;
}
still not clean, but a hack that should make it work on ESP32.
-jz-