Can i use GPIO16 pin for both UART and SPI?

spaceman123
Posts: 1
Joined: Fri Nov 14, 2025 4:45 am

Can i use GPIO16 pin for both UART and SPI?

Postby spaceman123 » Fri Nov 14, 2025 4:50 am

I'm trying to wire external flash memory (W25Q32) to ESP32 C6 WROOM. I saw in documentation that the CS pin for SPI2 is GPIO16. However, GPIO16 is used for TXD of CP2102. I'm wondering if i can use the same pin for SPI and UART. Thank you
Image

Image

MicroController
Posts: 2672
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can i use GPIO16 pin for both UART and SPI?

Postby MicroController » Fri Nov 14, 2025 11:31 am

I saw in documentation that the CS pin for SPI2 is GPIO16
That's not completely accurate. The SPI bus doesn't have "the" CS pin; multiple devices (slaves) can share a single SPI bus, and each device gets its own CS pin/signal. Consequently, you have to configure the CS pin to use for each slave yourself.
However, GPIO16 is used for TXD of CP2102. I'm wondering if i can use the same pin for SPI and UART.
This can work if the UART peripheral isn't initialized (connected to the pin) while the pin is used by the SPI and vice versa.
However, you should probably just use some other pin for the W25Q32's CS signal.

Who is online

Users browsing this forum: No registered users and 3 guests