RFE: SPI-master: support actions from post_cb function

hpeteranvin
Posts: 29
Joined: Tue Feb 28, 2017 3:44 am

RFE: SPI-master: support actions from post_cb function

Postby hpeteranvin » Sat May 14, 2022 1:47 am

Hi,

I would like to add the following feature additions to the ESP-IDF master SPI driver. They should be fairly trivial to implement, but there is no way to obtain this functionality at the moment without completely avoiding this driver.

Specifically, I would like the post_cb function after a transaction to be able to request one of the following operations:

1. Proceed with the next transaction if one exists (the normal case.)
2. Repeat the same transaction again before performing any others. This is really useful for the case where there is a back channel (usually GPIO) bus error signal from the slave, indicating that data was not properly sent or received, e.g. due to a buffer over- or underrun where the operation is otherwise idempotent. (This may not be safe after subsequent transactions have been completed!)
3. Abort all subsequent queued transactions. (This could also be implemented by allowing the pre_cb function to tell the driver to skip the transaction.)

Furthermore, the post_cb operation may very well implement private synchronization primitives, making the result queue redundant. The result queue is a bit obnoxious, because it requires a call for each completed transaction, and does not allow a task to sleep until a whole sequence of transactions have completed, causing completely unnecessary wakeups. Using e.g. an event group can avoid that problem.

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

Re: RFE: SPI-master: support actions from post_cb function

Postby ESP_Sprite » Sat May 14, 2022 6:24 am

I'd suggest you file that as an issue on our Github, that makes tracking a bit easier. Just to set expectations, we have some other things that also need changing in the SPI driver that has some higher priority, so I don't know how quickly we can make these changes if we accept them. (If you're really in a hurry, we do accept pull requests...)

Who is online

Users browsing this forum: Bing [Bot] and 218 guests