SPI CS Lines - Which GPIO Pins to Use?

Posts: 11
Joined: Sat Mar 06, 2021 12:39 am

SPI CS Lines - Which GPIO Pins to Use?

Postby Xylopyrographer » Fri Jan 28, 2022 6:17 pm

Seeking clarification on which GPIO pins to use for CS lines when multiple devices are connected to an SPI bus using the SPI Master driver.

From this page in the docs: https://docs.espressif.com/projects/esp ... t_device_t

It states:
SPI1, HSPI and VSPI all have three chip select lines, allowing them to drive up to three SPI devices each as a master.
The default CS lines for the HSPI and VSPI buses are GPIO 15 and 5 respectively. That would be one of the three CS lines (for each bus) as described.

Also from the docs:
If the driver is configured with all SPI signals set to their specific IOMUX pins (or left unconnected), it will bypass the GPIO matrix. If any SPI signal is configured to a pin other than its IOMUx pin, the driver will automatically route all the signals via the GPIO Matrix.
So for maximum speed of the bus, the defaults for MISO, MISO, SCLK and CS are significant as they route through the IO_MUX rather than the GPIO_MUX.

However, the docs don't seem to indicate which GPIO pins should be used for the other two (non-default) CS pins on each bus to ensure they also are routed through the IO_MUX and thereby maximizing the bus speed..

Anyone have any insight?

Who is online

Users browsing this forum: No registered users and 52 guests