ESP32-S3 SPI pin remapping

User avatar
jiqz--
Posts: 9
Joined: Thu Aug 17, 2023 12:39 pm

ESP32-S3 SPI pin remapping

Postby jiqz-- » Thu Aug 17, 2023 6:04 pm

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 5978 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?

ESP_Sprite
Posts: 9052
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 SPI pin remapping

Postby ESP_Sprite » Fri Aug 18, 2023 4:08 am

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.

User avatar
jiqz--
Posts: 9
Joined: Thu Aug 17, 2023 12:39 pm

Re: ESP32-S3 SPI pin remapping

Postby jiqz-- » Sun Aug 20, 2023 11:30 pm

Thank you, I will test this out and provide an update

downisquad
Posts: 1
Joined: Tue Sep 05, 2023 7:05 pm

Re: ESP32-S3 SPI pin remapping

Postby downisquad » Tue Sep 05, 2023 7:12 pm

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

User avatar
jiqz--
Posts: 9
Joined: Thu Aug 17, 2023 12:39 pm

Re: ESP32-S3 SPI pin remapping

Postby jiqz-- » Fri Sep 15, 2023 10:33 pm

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.

Who is online

Users browsing this forum: No registered users and 125 guests