Page 1 of 1

ESP32-S3 SPI pin remapping

Posted: Thu Aug 17, 2023 6:04 pm
by jiqz--
Is it possible to remap the SPI pins (/use any pins) on the ESP32-S3 for SPI without a performance hit? I only need to connect MOSI, MISO, SS (Slave Select / CE / CS), and CLK. So far I have been using GPIO11 for MOSI, GPIO13 for MISO, GPIO10 for SS, and GPIO12 for SCK, it works but I need to use different pins due to a PCB layout requirement. Would it be possible to do so without complicated configuration in program settings, or is it as simple as changing the pin numbers when initialising SPI?

SPI.png
SPI.png (158.91 KiB) Viewed 8630 times

Similarly, would I only be able to change the SPI pin numbers I will use to other SPI pins (in the box marked 5e) or to absolutely any GPIO pins?

Re: ESP32-S3 SPI pin remapping

Posted: Fri Aug 18, 2023 4:08 am
by ESP_Sprite
Normally you can use any (not otherwise occupied) GPIO, just pass them to the initialization function. Using the GPIO matrix as such adds a slight delay to the signals, but unless you run SPI at its absolute maximum speed, that likely doesn't matter.

Re: ESP32-S3 SPI pin remapping

Posted: Sun Aug 20, 2023 11:30 pm
by jiqz--
Thank you, I will test this out and provide an update

Re: ESP32-S3 SPI pin remapping

Posted: Tue Sep 05, 2023 7:12 pm
by downisquad
jiqz-- wrote:
Sun Aug 20, 2023 11:30 pm
Thank you, I will test this out and provide an update
Dear jiqz,

could you already test this out?
Could you be so kind and share your code?

Thanks!
downisquad

Re: ESP32-S3 SPI pin remapping

Posted: Fri Sep 15, 2023 10:33 pm
by jiqz--
It worked for me.
Note that:
While in general, speeds up to 80MHz on the dedicated SPI pins and 40MHz on GPIO-matrix-routed pins are supported, full-duplex transfers routed over the GPIO matrix only support speeds up to 26MHz.
https://docs.espressif.com/projects/esp ... e_handle_t

Unfortunately I don't know if I am using GPIO matrix or IO MUX, but I don't need high SPI speeds so this is okay for me.
I am not directly using ESP-IDF. I just put different pin numbers in the SPI setup function.