AnsweredAssumed Answered

Unexpected DMA transfer when DMA request is enabled for SPI1 TX

Question asked by George Pontis on Jan 20, 2014
Latest reply on Mar 25, 2014 by Doug Mann

K60 / IAR


I am tying to use DMA to transfer a large block of 8b data through the SPI interface. My code is mostly working except for one fatal flaw. That is that I get an unexpected transfer as soon as the DMA request is enabled. At the time that this happens, the DMA has already been set up with CITER, BITER, a source pointer, attributes, and so on. In my case the attributes call for 8 b source and 8 b destination. After the unexpected transfer occurs, I see that CITER has decremented by 4 bytes ! Typically I am making transfer much larger than that, and the remainder of the transfer does not occur until the SPI module is re-enabled by clearing the EOQ flag.


My original code started the transfer by writing the SPI1_RSER to set TFFF_RE, but exactly the same happens if I leave that set and then write the DMA_ERQ.


The transfer of 4 bytes seems completely incorrect given that DMA_TCD4_ATTR = 0. As an additional test I tried pointing the source address to known data, but that data does not appear to be used. The upper 16 bits, which are written to the command field of the TX FIFO, are all 0. This fact makes it difficult to work around the problem.


Has anyone else seen this, or have a suggestion where to look ?