My application is communicating with a SPI Flash Memory chip. I have code working flawlessly when directly accessing the SSI peripheral in a tight, optimized loop. I have attempted to improve performance by changing the data transfer from direct SSI access to uDMA. I've kept the Flash Memory command byte and address bytes (usually 4-Byte address) in direct SSI access, so that only the longer Flash data transfer is handled by uDMA.
I have the uDMA Channel Control set to UDMA_SIZE_8 | UDMA_ARB_4 for efficiency. Channel Transfer is UDMA_MODE_PING_PONG. Channel Attribute has UDMA_ATTR_USEBURST set, and I believe that I am careful to wait for the SSI Busy to be de-asserted and then only program the uDMA size to a multiple of 4 bytes.
The symptom is that my data is being transmitted almost exactly correctly, but at a random point in the transfer a single bit error begins to occur. About 22 bytes in, or in the 5th 32-bit word, it's as if 0x00004000 is being OR'd into my data stream. This bit error is word aligned, not byte aligned, so I first suspect the uDMA setup since the SSI is operating with 8-bit word size. I tried briefly turning off USEBURST, but that seemed to make things worse.
Note that I have Flash Memory read working under most conditions, but it sometimes gets shifted by a single 32-bit word - all the correct data appears, but one word too late in the transfer. This particular bug report, as described above, is happening during Flash Memory write operations. I have confirmed with a logic analyzer that the data is corrupted on the wire when it's written to the external Flash Memory chip. So, when I read back corrupted data, it does match what was actually sent on the wire.
Other than looking for general help, based on the above issues, I'm also wondering whether there is some way to flush or reset the uDMA peripheral that I'm missing. This seems to be particularly important since accessing external SPI Flash Memory involves a mix of single-byte commands, address bytes, and hopefully larger uDMA buffer transfers.