We are looking for explanation of how the i.MX28 DMA-SSP works with regards to transfer size and the number of words transferred on SSP0 configured as a SPI Master. Specifically need clarification of the relationship between HW_SSP_XFER_SIZE.XFER_COUNT which is the 4th register written when writing PIOWORDS, and HW_APBH_CH0_CMD.XFER_COUNT that is supplied as word 1 in the DMA channel command structure (Ref Manual Fig 6-2). Assume WORD_SIZE is 16 bits always.
According to Reference Manual,
HW_SSP_XFER_SIZE.XFER_COUNT = number of WORD transfers, as referenced in WORD_LENGTH
HW_APBH_CH0_CMD.XFER_COUNT = number of BYTES to transfer.
According to the Reference Manual, DMA_Word_1.XFER_COUNT is in bytes. PIOWORD XFER_COUNT (i.e. HW_SSP_XFER_SIZE) is in Words (16 bits). Here are some results of experiments we conducted with different tranfer counts
A. DMA_Word_1.XFER_COUNT=2 and PIOWORD XFER_COUNT = 2
Results in 16 SCLK pulses on SSP0 interface. --> implies DMA_Word_1.XFER_COUNT = 2 BYTES is right.
B. DMA_Word_1.XFER_COUNT=4 and PIOWORD XFER_COUNT = 2
Results in 16 SCLK pulses on SSP0 interface --> both DMA_Word_1.XFER_COUNT = 4 bytes and PIOWORD XFER_COUNT=2 words are not correct. The reference manual is definitely wrong.
C. DMA_Word_1.XFER_COUNT=2 and PIOWORD XFER_COUNT = 4
Results in 32 SCLK pulses on SSP0 interface --> Looks like PIOWORD XFER_COUNT is actually in bytes, not words? Appears DMA_Word XFER_COUNT is a "don't care"?
D. DMA_Word_1.XFER_COUNT=4 and PIOWORD XFER_COUNT = 4
Results in 16 SCLK pulses on SSP0 interface --> Expected if the DMA_Word’s XFER_COUNT is useless.
E. DMA_Word_1.XFER_COUNT=6 and PIOWORD XFER_COUNT = 2
Result : Transfer fails, which implies BOTH need to be set, yet the correlation between them not well understood.
F. DMA_Word_1.XFER_COUNT=6 and PIOWORD XFER_COUNT = 6:
Results in 48 SCLK pulses on SSP0 interface. --> 3 words / 6 bytes are transferred.
Case (B/F) is what we really want to do. From one DMA transfer to the next, we want to be able to specify different transfer sizes, but without having to write a bunch of PIOWORDS every time. But it seems like we have to write the 4 PIOWORDS to change the HW_SSP_XFER_SIZE.XFER_COUNT register, rather than have the value from the DMA Words transfer to that count register.