Page 1 of 1

Possible to use SPI slave driver without Chip Select?

Posted: Sun Mar 14, 2021 6:53 pm
by itavero
Is it possible to use the SPI slave driver without defining a chip select?
I have a device that uses an interface very similar to SPI.
It has a MOSI, MISO and clock line, but no CS (chip select).

I would still like to use the SPI peripheral for this, instead of implementing some implementing it from scratch using interrupts from the clock line.

I tried initializing spics_io_num in spi_slave_interface_config_t as -1, but this results in an exception, when spicommon_cs_initialize is called from spi_slave_initialize:

Code: Select all

E (270) gpio: gpio_set_direction(263): GPIO number error
Is there a way to use the peripheral without the CS line via the ESP-IDF API?

Re: Possible to use SPI slave driver without Chip Select?

Posted: Mon Mar 15, 2021 4:12 am
by ESP_Sprite
Not really... while you may be able to wrangle the SPI hardware to work in a mode that is compatible with what you want, the driver is strictly transaction-based, with transactions being delineated by CS levels.

Re: Possible to use SPI slave driver without Chip Select?

Posted: Mon Jun 20, 2022 5:30 pm
by michcfr
Hello,
Any idea on how to do "software" CS rather than using the CS pin state?
FYI: This is a capability supported by the STM32 microcontroler. See: https://electronics.stackexchange.com/q ... without-cs

Thx

Re: Possible to use SPI slave driver without Chip Select?

Posted: Tue Jun 21, 2022 2:56 am
by ESP_Sprite
You could use the pre_cb and post_cb callbacks to set/clear a GPIO that acts as CS.