SPI slave - start the transaction without triggering the CS pin

michcfr
Posts: 30
Joined: Mon Jan 29, 2018 5:55 pm

SPI slave - start the transaction without triggering the CS pin

Postby michcfr » Mon Jun 20, 2022 7:31 am

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

a2800276
Posts: 78
Joined: Sat Jan 23, 2016 1:59 pm

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

Postby a2800276 » 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.

michcfr
Posts: 30
Joined: Mon Jan 29, 2018 5:55 pm

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

Postby michcfr » Mon Jun 20, 2022 7:57 am

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.

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

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

Postby ESP_Sprite » Tue Jun 21, 2022 2:59 am

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.

michcfr
Posts: 30
Joined: Mon Jan 29, 2018 5:55 pm

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

Postby michcfr » Tue Jun 21, 2022 10:07 am

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?

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

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

Postby ESP_Sprite » Tue Jun 21, 2022 10:49 am

it should generally work; it's just a callback done before and after the transfer.

Who is online

Users browsing this forum: No registered users and 86 guests