Hi Alexis
I am using linked descriptors. One difference is that I'm configuring the descriptor for the data read or write based on the information in the first descriptor. If it's a read command, I have to set the .source pointer in the Tx descriptor. If it's a write command, I have to set the .dest pointer in the Rx descriptor. This happens while a 'turn-around' Rx descriptor is being executed. My question is that for a read command, while the 'turn-around' Rx descriptor is being executed, at what point in time does it become invalid to configure the .source pointer and xfercfg length in the Tx data descriptor? It doesn't seem like I have the entire 2-byte time of the 'turn-around' descriptor, which I would expect, in that there would be some non-zero cycle time to load it.
Processor at 96 MHz. Two bytes = 16 bits, 20 MHz SPI clock, I should have around 5 CPU cycles per bit, = 80 cycles.
Interrupt latency = 16 cycles, DMA irq is around 40 cycles, 56 is less than 80. Should work, unless the DMA engine reload mechanism is reading the next descriptor before the current one is exhausted. That's the timing I need to know.
How many cycles before the next descriptor is executed does the DMA engine actually read it?
My use case is:
Rx descriptors: 4-byte 2-byte N bytes
Tx descriptors: 6-byte ------------- N bytes
Interrupt triggered at end of first Rx descriptor, 4 bytes. While 2-byte Rx descriptor and last 2 bytes of first Tx descriptor are executing, configure the third Rx descriptor and second Tx descriptor.
One more question: What is the purpose of the initial descriptor if it's configured identical to the first descriptor? Can't the first descriptor in the sequence be used as the initial descriptor?
In my case I re-use the 3 Rx descriptors and 2 Tx descriptors for processing each SPI DMA operation, where the first Rx and first Tx descriptors are the initial descriptors, and reloaded by the third Rx descriptor and second Tx descriptor, respectively.
One more question: My implementation works for multi-byte exchanges, but not a single byte read or write. Does the descriptor mechanism support single byte reads and writes?