Skip to content
An Example for Slave SPI Communication on ESP32 and Arduino Platform
C++
Branch: master
Clone or download
Latest commit 088a6ad May 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Change the output directory. May 14, 2019
figure Add an explaination. Jul 25, 2018
simple-array @ cfdd3bd Adopt the new "simple-array" design. Dec 5, 2018
tmp Add vscode configuration and temporary directory. Jul 26, 2018
.gitignore Add vscode configuration and temporary directory. Jul 26, 2018
.gitmodules Add the simple-array submodule. Sep 28, 2018
README.md No new code is appended. Just a cleaning, and note for future develop… Oct 4, 2018
SimpleArray.cpp Add the simple-array submodule. Sep 28, 2018
SimpleArray.h
SlaveSPI.cpp Rename write() --> writeFromArray(). Dec 5, 2018
SlaveSPI.h Rename write() --> writeFromArray(). Dec 5, 2018
test.ino Rename write() --> writeFromArray(). Dec 5, 2018

README.md

SPI-Slave Class for ESP32.

This class is designed for interfacing with ESP32 SPI module in slave mode. It means to be used and tested on Arduino platform. The main idea of testing with the main arduino .ino file is only to connect between SPI-Master signals and of the Slave. Further information could be found in the topics.

Cheer! iPAS

Acknowledgement

The code was adopted from https://gist.github.com/shaielc/e0937d68978b03b2544474b641328145. Thank you to @shaielc for the scaffolding. Then I found it works a bit currently. However, the adaptation is still required so a SPI-Slave module is functional (transfer data via DMA is disable).

Setup

To test the code, please wiring as the following figure: wriing

The connections are described:

Signal Pin#
MO 22
MI 23
MCLK 19
MS 18
SO 32
SI 25
SCLK 27
SS 34

lolin32

Debugging

I also use the BusPirate for debugging. It is just an option, can be neglected. But, if you have one, SPI-sniffer article and the following BusPirate pinout maybe help:

buspirate pinout

Note

  • In case of Arduino IDE, please rename test.ino as your folder name.
  • You would see that the master cannot get the correct reponsed data. The received response is shifted left by one bit. I am not sure why this is occured. However, the SlaveSPI class works correctly.

Future Works

You can’t perform that action at this time.