Any plans to create a configurable cs_change in spi.c?
Closed this issue · 1 comments
Hi!
It would be nice if there be any function or method to configurate spi_xfer.cs_change to 0 or 1.
My embedded board is supporting burst transfer in SPI and i need to change it to 1 manually in source always to use the normal mode (default is 0 in your code which is the burst mode).
As I understand it, this parameter wouldn't actually have any effect in c-periphery, since spi_transfer()
only uses one spi_ioc_transfer
structure with the SPI_IOC_MESSAGE
ioctl()
. Setting cs_change
to 1 in this structure would deselect and reselect the CS before a subsequent spi_ioc_transfer
transfer (see https://elixir.bootlin.com/linux/v5.5.13/source/include/uapi/linux/spi/spidev.h#L68), but that would require multiple transfer structures in the ioctl()
, which c-periphery doesn't use.
With the simpler c-periphery API, the CS will be selected for each buffer transferred with spi_transfer()
. If you need it deselected before sending additional bytes, it can be done with multiple calls to spi_transfer()
.
If you are finding that your SPI driver is doing a deselect and reselect for each byte in a transfer when you have cs_change
set to 1 for one transfer structure, this is likely a bug in the SPI driver itself, as that isn't the intended behavior of that option as far as I can tell.
Closing for now. Let me know if you run into any other issues with this.