-
Notifications
You must be signed in to change notification settings - Fork 105
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
Updating SPI CS management #159
Conversation
Looks good! I tried this out with the spi_dma example on the dma branch. I somewhat expected that with Potentially this is an area where the SPI HAL could be improved. Adding a |
This is an implication of operating SPI in "endless transaction mode" (e.g. TSIZE = 0). The SPI CS pin is held low for the duration of an entire transaction, which means that it is held low indefinitely when in endless transaction mode. I'll add documentation to describe what behavior should be expected. Note that using TSIZE has some weird implications to the SPI FIFO. Notable, once TSIZE "data" have been written to the SPI FIFO, the TXTF is set, which causes all further TX FIFO writes to be ignored:
And the TXTF must be manually cleared by software, so we'd have to continually check + clear the flag in
I think it's a good idea as well, although I think it's somewhat unintuitive to "suspend" the transaction - I think a user would just assume that the transaction is over when they are done sending data. "suspend" requires some understanding as to how we are configuring the underlying peripheral. It likely makes more sense to just automatically suspend the transaction after "sending" all of the data, although with how the |
Indeed the Anyhow everything in this PR is good, thanks! bors r+ |
This PR fixes #158 by correcting the usage of the SPI management bits.
This PR fixes #71 by working around "endless transaction mode" by allowing more control of the way CS is managed.
This PR also exposes methods to allow SPI to be used in tx-only and rx-only configurations. It also allows for CS to automatically be idled when no data is available in the FIFO for transmission.