This is an example of using SPI on ESP32 in half-duplex mode to transfer data between an ESP32-S3 (master) and ESP32-C6 (slave). It is based on the ESP-IDF SPI Half-Duplex Example.
This is intended to be a reference for implementing transfers using QSPI.
For SPI, the following values should be set in spi_bus_config_t
:
sclk_io_num
(SCLK)mosi_io_num
(MOSI)miso_io_num
(MISO)
For QSPI, the following values should be set in spi_bus_config_t
:
sclk_io_num
(SCLK)data0_io_num
(DAT0)data1_io_num
(DAT1)data2_io_num
(DAT2)data3_io_num
(DAT3)
Based on the structure of spi_bus_config_t
found in
spi_common.h:
mosi_io_num
isdata0_io_num
miso_io_num
isdata1_io_num
quadwp_io_num
isdata2_io_num
quadhd_io_num
isdata3_io_num
Signal | ESP32-S3 (SPI2) | ESP32-C6 (SPI2) |
---|---|---|
CS | 10 | 10 |
CLK | 12 | 6 |
DAT0 | 11 | 7 |
DAT1 | 13 | 2 |
DAT2 | 14 | 5 |
DAT3 | 9 | 4 |
- ESP SPI Slave HD (Half Duplex) Mode Protocol
- ESP-IDF Issue (Closed) about using the example in QSPI mode
- ESP-IDF Issue (Closed) about using QPI mode
- SPI Slave Half Duplex documentation and API