Lua-RTOS-ESP32
Lua-RTOS-ESP32 copied to clipboard
Feature request: support for SPI with no CS
There are devices that can be run in "Arduino ICSP mode", this is SPI but no CS signal. This also makes sense if you only have one SPI device and want to save a gpio pin.
esp-idf supports this setup in spi_bus_add_device setting cs as -1, but there are several checks in whitecat's SPI driver that do not allow for this.
I can confirm from spi_master.h where what you say is documented:
int spics_io_num; ///< CS GPIO pin for this device, or -1 if not used
But actually in components/sys/drivers/spi.c this seems to be supported properly.
Everywhere it seems the flags are checked against SPI_FLAG_CS_AUTO.
Especially, if SPI_FLAG_CS_AUTO is not set, then the spics_io_num is explicitly set to -1 in case SPI_FLAG_NO_DMA is not set:
.spics_io_num = ((flags & SPI_FLAG_CS_AUTO)?spi_bus[spi_idx(unit)].device[device].cs:-1),
which seems to be the only possible case, as that flag is removed at the beginning of the function:
flags &= ~SPI_FLAG_NO_DMA;
Please try out #400 and let us know if that fixes your issue. Either way, #400 will need to be redone before pulling to trunk, as git-cola unintentionally had added the websocket submodule.
Please try out https://github.com/whitecatboard/Lua-RTOS-ESP32/pull/410 and let us know if that fixes your issue.