Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: support for SPI with no CS #384

Open
xopxe opened this issue Feb 4, 2021 · 3 comments
Open

Feature request: support for SPI with no CS #384

xopxe opened this issue Feb 4, 2021 · 3 comments

Comments

@xopxe
Copy link
Contributor

xopxe commented Feb 4, 2021

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.

@the0ne
Copy link
Collaborator

the0ne commented Apr 4, 2022

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;

@the0ne
Copy link
Collaborator

the0ne commented Apr 4, 2022

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.

the0ne pushed a commit to the0ne/Lua-RTOS-ESP32 that referenced this issue May 16, 2022
@the0ne
Copy link
Collaborator

the0ne commented May 16, 2022

Please try out #410 and let us know if that fixes your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants