ESP32-C3 has a nice feature called GPIO Matrix which allows to map most of it's peripherals to any GPIO pin. And it has feature called IO_MUX which allows direct & faster operations for some of the high speed peripherals, including SPI. The API from ESP-IDF (HAL SDK) provides some library documentation on SPI functions.

But Arduino-ESP32 core documentation seems to completely miss SPI library & it's functions. It refers to basic Arduino SPI class, but it lacks description of features ESP32 family has.

I've found this example for ESP32 (note that I'm looking for ESP32-C3 info) which sets SPI pins through SPI.begin method actually.

I've also found this source which seems to feature a lot of SPI internal HAL functions. And a C++ SPI class sources are here. But it's actually doesn't have any useful comments on how to use IO_MUX or allowed values for ::setFrequency() method.

So basically I'm asking for a documentation on ESP32-C3 Arduino specific SPI class features. But to narrow things down I'm actually looking now how to initialize SPI2 (which is the only generally available SPI master on C3) as IO_MUX at the fastest SPI clock speed possible from the Arduino core/SPI class. Any suggestions are also welcomed!

  • Hi NStorm, I know your post is from a while ago, but for everyone's and anyone's sake: I'm still figuring out how to use the GPIO Matrix with ESP32-C3 and Arduino, but if you are using Arduino with it, then the default pins for SPI2 are defined here. Depending on whether you're initializing the peripheral yourself or a device is doing it for you, there are ways to pass in a different SPI clock speed.
    – Nick S.
    Jan 30 at 4:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.