How to work around the 3 devices limit of the SPI Master peripheral

maldus
Posts: 83
Joined: Wed Jun 06, 2018 1:41 pm

How to work around the 3 devices limit of the SPI Master peripheral

Postby maldus » Fri Mar 22, 2019 1:58 pm

Hello everyone,
I'm working on a project running on an ESP32-WROOM-32 module. The board has 4 different SPI integrated circuits, all connected to the same MISO/MOSI/CLOCK lines. From reading the documentation about the SPI Master module (https://docs.espressif.com/projects/esp ... e_handle_t) and through trial and error, I now understand each SPI peripheral device can manage up to three different devices/Chip select lines.

I failed to check this requirement because it seems like an odd limitation; the difference between communicating with each device is simply the Chip Select pin level, something I would not think as limited in any way.
Is there really no way to connect more than 3 devices?

I have tried using both HSPI and VSPI peripherals, but obviously they can't be connected to the same pins at the same time.
Another solution I came up with is to add and remove two of the four SPI devices whenever I need one of them, which appears to work but requires a relatively long time delay (~9ms) between switches.

Alternatively, I could add a mock device with no CS line and use it to communicate with multiple ICs whilst managing two chip selects on my own.

Is my understanding correct? Is there anything I'm missing?

Who is online

Users browsing this forum: No registered users and 83 guests