Possible to use SPI slave driver without Chip Select?

User avatar
itavero
Posts: 16
Joined: Sun Mar 14, 2021 6:41 pm
Location: The Netherlands

Possible to use SPI slave driver without Chip Select?

Postby itavero » Sun Mar 14, 2021 6:53 pm

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?

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

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

Postby ESP_Sprite » Mon Mar 15, 2021 4:12 am

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.

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

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

Postby michcfr » Mon Jun 20, 2022 5:30 pm

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

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

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

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

You could use the pre_cb and post_cb callbacks to set/clear a GPIO that acts as CS.

Who is online

Users browsing this forum: Bing [Bot], VinayDand and 432 guests