Page 1 of 1

What are ESP32 SPI Ports for Micropython SPI(1)?

Posted: Sat May 20, 2017 4:23 pm
by choies
I make bin files for ESP32 module( ESP-WROOM-32)
Now I would like to test hardware SPI function using Micropython.

Please let me know the Hardware SPI port in ESP32 module( ESP-WROOM-32) for Micropython code?

For example.
1) SPI(1)
SPI_MISO = HSPIQ(GPIO12)
SPI_MOSI = HSPID(GPIO13)
SPI_CLK = HSPICLK(GPIO14)
SPI_CS = HSPICS0(GPIO15)

Thanks in advanced.

Re: What are ESP32 SPI Ports for Micropython SPI(1)?

Posted: Tue May 23, 2017 12:14 pm
by Damien
The default SPI ports are defined by the ESP32 module itself (and actually the ESP IDF is doing all the low-level work here to configure the pins). If you don't provide sck/mosi/miso pins for a peripheral then the "most recent" pins are used, which is usually going to be the default pins for that peripheral.

According to the ESP IDF, the default pins for SPI(1) are: sck=Pin(6), mosi=Pin(8), miso=Pin(7). For SPI(2) it's: sck=Pin(14), mosi=Pin(13), miso=Pin(12). In MicroPython the CS pin must be handled by user code, it's not controlled by the hardware peripheral.