I have been trying to understand how we can use the PPI system to bypass extra callback handlers and threads in Zephyr to retrieve data from external SPI device based on external pin trigger.
So far my understanding of the PPI system is it can hold a configured xfer and trigger it upon even input. This input can come from a gpio pin event output.
This way only works as long as the transfer from the SPI unit is a direct read or write event with no additional transaction data or buffers.
A normal SPI transceive via the normal zephyr drivers and API works by using a transaction manager that keeps the state of the device intact and updates a ctx structure with a set of tx and rx buffers and counts. It then works it's way through these allowing it to send, for example, an address to the external device from the first tx buffer in the set, while ignoring the reception, having a NULL rx buffer before going on to the second set of buffers where the tx buffer is NULL and rx buffer is now valid and a count tells it to receive a set of data values.
It does not look like this is easily translated into the PPI required system and the EasyDMA system that could be used in place of this to potentially reconfigure is not implemented.
From what I understand it would have to use the PPI system by first setting up the transfer complete event in spim to prepare for changing the buffers of the spim, Then set up a spim transfer that is held, expecting a input trigger. The trigger would then cause the initial address transfer to take place, followed by the finish event that causes a reconfiguring of spim to retrieve the data. However, I do not see how this can also reconfigure PPI to not transfer the new config again for the end event. This even event must also be changed to create a callback for transfer done, and set up the initial address transfer again.
Am I missing something here?
Are there really no library or examples already doing this in Zephyr?
This seems like an obvious thing the PPI system was meant for, and it would offload a lot of cpu activity and interrupts.