Page 1 of 1

SPI slave - start the transaction without triggering the CS pin

Posted: Mon Jun 20, 2022 7:31 am
by michcfr
Hello,
When the ESP32 is in SPI slave mode, can the ESP32 start the transaction itself (using the spi_slave driver) without needing the master to pull CS LOW?
This is to save ESP32 pins.

Regards,
Michel

Re: SPI slave - start the transaction without triggering the CS pin

Posted: Mon Jun 20, 2022 7:41 am
by a2800276
Chip select is integral to addressing devices on the bus in SPI. While you might be able to hack around chip select, if you want to save pins use I2C for your protocol instead.

Re: SPI slave - start the transaction without triggering the CS pin

Posted: Mon Jun 20, 2022 7:57 am
by michcfr
a2800276 wrote:
Mon Jun 20, 2022 7:41 am
Chip select is integral to addressing devices on the bus in SPI. While you might be able to hack around chip select, if you want to save pins use I2C for your protocol instead.
This is not true.
The term "SPI" is used to describe a wide variety of protocols where a master device communicates with one or more slave devices. Some other SPI slaves use different approaches for synchronization. There's no conceptual reason why slaves should need to use a select wire (but many of them do).

Please stay focus on my question.

Re: SPI slave - start the transaction without triggering the CS pin

Posted: Tue Jun 21, 2022 2:59 am
by ESP_Sprite
You could use the GPIO matrix for this; iirc there are two 'virtual pins' on the ESP32 that are always-high and always-low respectively. You could route CS to those to manually select the SPi slave peripheral.

Re: SPI slave - start the transaction without triggering the CS pin

Posted: Tue Jun 21, 2022 10:07 am
by michcfr
Thank you ESP_Sprite.
Is this solution still operate at high speeds? Even if I keep SPI2 or SPI3 IO_MUX pins for SPI buses.
Another question: Does it work for the ESP32-C series?

Re: SPI slave - start the transaction without triggering the CS pin

Posted: Tue Jun 21, 2022 10:49 am
by ESP_Sprite
it should generally work; it's just a callback done before and after the transfer.