Thanks Mark for the reply. That will work for the DMA but I need a total solution. I had the idea to use the RX trigger TX independently and it leads to a nice total solution - except it didn't work. In searching for other solutions I saw your suggestion to do what I was doing so wondered if it could work.
The problem with using the RX to trigger the RX DMA is that each transfer from the SPI receiver needs a separate trigger so the minor loop must have a loop count of 1. The major loop must then perform a single SPI transaction - since it needs to stop at the end of the SPI frame.
In my application I am streaming sample data from a radio chip continuously at the sample rate. The radio chip issues a sample pulse which triggers the read of one sample via SPI - then on the next sample pulse it does the same, and so on. I want to at least double/pingpong buffer the data. So the problem then is, if the minor loop is one SPI byte/word, and the major loop is one SPI frame - then I need a third loop for the double/pingpong buffer. So I could chain the RX to TX and then I suppose further chain to some get a pingpong buffer via some sort of DMA acrobatics (scatter/gather maybe?). I don't really want just a pingpong of a single SPI frame - I really want a block of say 64 samples so each of the ping and pong buffers aren't one SPI frame they are 64 SPI frames.
The TX data just consists of the register address to read within the radio chip and dummy data since you have to send something in order to receive something. But this same data is sent for each SPI transaction - so TX just needs a double loop.
If I chain TX to RX then the RX minor loop is still a single transfer - but the outer loop can be the full pingpong buffer since it doesn't need to stop at the end to the frame - the TX will stop so the RX will do only as many transfers as the TX.
So I am using three DMA channels. The first is triggered from the GPIO pin which receives the sample pulse - which enables (SERQ) the TX DMA which is chained to the RX DMA. The problem of using the TX trigger is that it immediately triggers twice (because the SPI TX is double buffered) so you get two RX transfers before anything was actually received received. It might be possible to pipeline things to offset the transmitter and receiver but I expect the first two values received to be junk but for some reason the third value is also always junk (it is always a repeat of the second byte) - I assume this is some artifact of overrunning the SPI receiver.
If I could use the RX to trigger the TX then I can completely avoid these problems. I just skew the TX SPI frame and I write the first value to the SPI to 'prime the pump' so something is ready to trigger the DMA. This wouldn't take advantage of the SPI double buffering and might have small gaps between transfers and a small speed penalty as you pointed out, but otherwise it would be a good total solution. But as I said, it doesn't seem to work and the root cause seems to be that you can't trigger the TX from RX because it doesn't clear the DMA request.
Thanks,
Matt