First try posting a tutorial be brutally honest.
I am a fan of the ESP32.
In search for faster IMU transfer speeds, I drifted over to using SPI. I had been using the ESP32 AD APi for quite sometime for greater performance. I figured, correctly, that by using the ESP32 SPi APi I might get faster SPI speeds.
The user should understand how to split and reassemble 16 or 32 bit data into byte chunks.
Using the ESP32 SPI API.
Why? Simply put, more control and better speeds.
The ESP32 has 4 SPI hardware modules and each module can service up to 3 SPI devices per channel. Two of the SPI modules are available for the ESP32 user. The ESP32 SPI modules that can be used are known as HSPI and VSPI.
The SPI hardware modules or SPI channels are configured and initialized first. The the channel is then configured for device use.
The ESP32 SPI channels VSPI and HSPI should be assigned GPIO pins on the ESP32 portA (GPIO_NUM-0 to GPIO_NUM_32). It’s not a good idea to put a SPI device on portB GPIO pins due to portsB’s design.
The default SPI channel is channel VSPI. VSPI uses the following ESP32 (WROOM) pinouts:
SPI_MOSI = GPIO_NUM_23
SPI_MISO = GPIO_NUM_19
SPI_SCK = GPIO_NUM_18
SPI_CS = GPIO_NUM_5
The natural HSPI pins for the ESP32 are as follows:
SPI_MOSI = GPIO_NUM_13
SPI_MISO = GPIO_NUM_12 <<< a.k.a. the TDI pin
SPI_SCK = GPIO_NUM_14 <<< a.k.a. the TMS pin
SPI_CS = GPIO_NUM_15
Be aware, the trick to using HSPI is that the SPI device cannot send data before its requested. During program load the ESP 32 program loaded will use GPIO_NUM_12 and GPIO_NUM_14. GPIO_NUM_12 and GPIO_NUM_14 must not be made to randomly change state during program load. I know, not a SPI device but its an easy example to use, a GPS unit with its tx pin connected to GPIO_NUM_12 can cause the program load to fail if the GPS just starts sending data as soon as its energized.
Of course, with the ESP32, any pin function can be reassigned to most other pins.
The ESP32 SPI module is an independently operating module that does not require CPU intervention to operate. The ESP32 SPI can be ran in full duplex mode and can send and receive data in the background. The ESP32 SPI module uses freeRTOS Queue’s.