Comments on: ESP32 SPI Communication: Set Pins, Multiple SPI Bus Interfaces, and Peripherals (Arduino IDE) https://randomnerdtutorials.com/esp32-spi-communication-arduino/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 11 Feb 2026 16:20:39 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1161161 Wed, 11 Feb 2026 16:20:39 +0000 https://randomnerdtutorials.com/?p=113804#comment-1161161 In reply to Alan Brown.

Hi.
Thanks for sharing.
We were never able to get an epaper display working.

Regards,
Sara

]]>
By: Alan Brown https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1160872 Tue, 10 Feb 2026 12:33:35 +0000 https://randomnerdtutorials.com/?p=113804#comment-1160872 There’s an “odd” case which I’d like to address.

Most epaper panels (FPC24 interface) tie 4w SPI MOSI and MISO into a single “SDA” pin at the connector – meaning that for the (few) read/write commands, responses come back on the ESP32’s MOSI pin (This is NOT 3w SPI mode and NOT 9-bit)

“For this mode, in the read operation, after CS# is pulled low, the first byte sent is command byte, D/C# is pulled low. After command byte sent, the following byte(s) read are data byte(s), so D/C# bit is then pulled high. An 8-bitdata will be shifted out on every clock falling edge. The serial data output SDO bit shifting sequence is D7,D6, to D0 bit. ”

In essence the command is sent with no payload and the response then comes back whilst CS is held low – meaning that we need to have 4w SPI commands but treat MOSI as bidirectional

Why does this matter?

It’s incredibly easy to destroy epaper panels.

There are multiple chipsets with incompatible command structures and using the wrong command set is usually fatal – sometimes instantly. Adding to that, the commandsets vary slightly between revisions of the SAME panel chip (eg UC8151C/D which may result in panels not working or being destroyed AND the manufacturers (especially Hink) are prone to shipping differing revisions without changing the etched-on panel-id numbers or ID stickers.

It’s bad enough when buying individual panels off Aliexpress (many of thse give no indication of the chipset anyway), but it gets worse:

In some cases they’ve shipped mixed revisions in 1000-10000 panel orders and caused chaos for downstream device manufacturing outfits (imagine having 10% of your devices DOA because of this kind of thing. Even if the supplier replaces the panels it’s a big cost in time and RMAs when this kind of thing happens)

]]>
By: sixbacon https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1159318 Fri, 06 Feb 2026 16:48:23 +0000 https://randomnerdtutorials.com/?p=113804#comment-1159318 Hi, this is a difficult area. Your code for using VSPI and HSPI simultaneously is copied all over the net, but I could not get it to work as it is, I could not find any example of this approach in use. I want to talk to a BMO085 IMU and log data on an SD card, I could get both to work individually relatively easily. In the end I used your approach but had to correct it with lots of iterations with Copilot. Part of the issue is the Adafruit library and its approach to SPI. throw in pointer and no pointers. But this test sketch works –

#include <SPI.h>
#include <SD.h>
#include <Adafruit_BNO08x.h>

//pins for BNO085
#define BNO_CS 5
#define BNO_INT 4
#define BNO_RST 16
#define BNO_SCK 18
#define BNO_MOSI 23
#define BNO_MISO 19
// pins for SD reader
#define SD_CS 27
#define SD_SCK 14
#define SD_MOSI 13
#define SD_MISO 12

//SPIClass SPI_VSPI(VSPI);
//SPIClass SPI_HSPI(HSPI);
//uninitialized pointers to SPI objects
SPIClass vspi(VSPI);
SPIClass hspi(HSPI);

Adafruit_BNO08x bno(BNO_RST);

void setup() {
Serial.begin(115200);
delay(100);
Serial.println();
Serial.println();
Serial.println(“dual SPI check”);
Serial.println();

// VSPI for BNO085
vspi.begin(BNO_SCK, BNO_MISO, BNO_MOSI, BNO_CS);
// HSPI for SD
hspi.begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS);
//set up slave select pins as outputs as the Arduino API
//doesn’t handle automatically pulling SS low
// pinMode(vspi->pinSS(), OUTPUT); //VSPI SS
// pinMode(hspi->pinSS(), OUTPUT); //HSPI SS

// SD on HSPI
if (!SD.begin(SD_CS,hspi,1000000)) {
Serial.println(“SD init failed”);
}else{
Serial.println(“SD init success”);
}

// — BNO085 reset sequence —
pinMode(BNO_INT, INPUT); //The Adafruit library assumes INT is already configured as an input.
//If it’s left floating, the boot handshake can fail.
pinMode(BNO_RST, OUTPUT); //The library toggles reset, but only if the pin is already configured.
//Setting it explicitly avoids undefined behaviour.
digitalWrite(BNO_RST, LOW);
delay(10); //The 10 ms low pulse guarantees a clean hardware reset
digitalWrite(BNO_RST, HIGH);
delay(300); // The 300 ms delay gives the firmware time to boot

// BNO085 on VSPI
if (!bno.begin_SPI(BNO_CS,BNO_INT,&vspi)) {
Serial.println(“BNO085 init failed”);
}else{
Serial.println(“BNO085 init success”);
}
}

void loop() {

}

It might help someone sort out a similar problem.

]]>
By: Ulrich Herschke https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1109924 Wed, 15 Oct 2025 16:54:23 +0000 https://randomnerdtutorials.com/?p=113804#comment-1109924 I found nowhere the SPI SCK pin for the esp32-c3 with 0.42 OLED 16pin board. Thank you so much. SCK on GPIO 4.
regards,
Ulrich

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1053545 Mon, 02 Jun 2025 15:13:12 +0000 https://randomnerdtutorials.com/?p=113804#comment-1053545 In reply to Rene.

Hi.
I never tried it.
But, in theory, yes. As long as you have enough pins.
You can share the SPI pins for both displays, as long as you have a different CS pin for each display.

Regards,
Sara

]]>
By: Rene https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1053477 Mon, 02 Jun 2025 11:40:12 +0000 https://randomnerdtutorials.com/?p=113804#comment-1053477 Hi, is it also possible to connect more then two displays on a esp32.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1019402 Mon, 24 Mar 2025 10:49:22 +0000 https://randomnerdtutorials.com/?p=113804#comment-1019402 In reply to Parthasarathi Elangovan.

Hi.
We’re using the ESP32 DOIT V1 board.
It works well with the examples and using both SPIs.
I thought most ESP32 boards were compatible.
Regards,
Sara

]]>
By: Parthasarathi Elangovan https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1019227 Sun, 23 Mar 2025 20:09:05 +0000 https://randomnerdtutorials.com/?p=113804#comment-1019227 Hi Randomnerstutorials,
It was a good tutorial.
I have some doubts, request that you please give me your comments about below query.
1. Which ESP series microcontroller will work both the HSPI and VSPI?
2. I am using ESP-32_WRROM-32 development board. Here, I can access the VSPI not a HSPI.
3. Can ESP-32_WRROM-32 work both HSPI and VSPI? if not please suggest the suitable microcontroller for me in the ESP32 series?

Thanks
Parthasarathi

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1003173 Mon, 27 Jan 2025 18:23:14 +0000 https://randomnerdtutorials.com/?p=113804#comment-1003173 In reply to Wijnand Nijs.

Hi.
I think you can initialize the display as follows:
Adafruit_ST7789 = Adafruit_ST7789(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk, int8_t rst = -1);

See the Adafruit_ST7789.h file: https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/Adafruit_ST7789.h

Regards,
Sara

]]>
By: Wijnand Nijs https://randomnerdtutorials.com/esp32-spi-communication-arduino/#comment-1003144 Mon, 27 Jan 2025 15:02:13 +0000 https://randomnerdtutorials.com/?p=113804#comment-1003144 OK, I already found that only 3 pins of the display are really relevant for the data communication: MOSI (SDA on the display), SCK and DC (data/control). The problem is MOSI and SCK. How can I force the Adafruit library that he do’nt use the default SPI pins (used for the LoRa module and also not on the edge pads) but the pins for example used by @Stephan for his card reader?

]]>