Go Down

Topic: How does SPI work with ESP32? (Read 116 times) previous topic - next topic

blackbeen

With Arduino there is only one SPI port available for general use and the pin number are hard coded into the SPI library.

But ESP32 has 3 SPI ports available and there is now ESP32 example sketch to see how the 3 possible SPI ports are handled with the ESP32 SPI library.

Riva

Looking at the SPI library for the ESP32 and it seems to have a overloaded function that you can use to specify the SPI pins to use.
Code: [Select]
void begin(int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);

else
is uses defaults
Code: [Select]
       _sck = (_spi_num == VSPI) ? SCK : 14;
        _miso = (_spi_num == VSPI) ? MISO : 12;
        _mosi = (_spi_num == VSPI) ? MOSI : 13;
        _ss = (_spi_num == VSPI) ? SS : 15;
Don't PM me for help as I will ignore it.

srnet

I use this, found by Mr Google.

SPI.begin(SCK, MISO, MOSI, SS);               

SCK, MISO, MOSI, SS are the pin numbers.
$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

Go Up