ESP32S2 - Quad SPI Slave / QPI Example + Notes
Posted: Thu Feb 17, 2022 9:08 pm
I went looking for an example of using the QuadSPI on the ESP32S2 in slave mode and couldn't find one. So I wrote one and am sharing it case anyone in the future goes down this road:
https://gitlab.com/kevinwolfe/esp32s2_qspi
All source code is in a single file: ./main/main.c
Test script included: ./tools/test_qspi.py (requires 'ft4222' lib, "pip install ft4222").
I am using an FT4222 development board in master to interact with the device. It's not a perfect example. First, I'm only doing DMA operations. Next, I could not get QuadSPI reads to work (e.g. master/host PC reads data from ESP32S2 slave device). Writes worked fine. My work-around is to only ever use QPI mode, which firmware automatically enters during SPI init. And lastly, I could only get QPI reads to work if I set the dummy bytes to 0xFF. No idea why that's the case, but it is what it is.
Good luck.
https://gitlab.com/kevinwolfe/esp32s2_qspi
All source code is in a single file: ./main/main.c
Test script included: ./tools/test_qspi.py (requires 'ft4222' lib, "pip install ft4222").
I am using an FT4222 development board in master to interact with the device. It's not a perfect example. First, I'm only doing DMA operations. Next, I could not get QuadSPI reads to work (e.g. master/host PC reads data from ESP32S2 slave device). Writes worked fine. My work-around is to only ever use QPI mode, which firmware automatically enters during SPI init. And lastly, I could only get QPI reads to work if I set the dummy bytes to 0xFF. No idea why that's the case, but it is what it is.
Good luck.