Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jamesk
Level 3
Level 3
First solution authored 5 replies posted 5 sign-ins

Chapter 5.2.8 of the XMC4700 XMC4800 Reference Manual states that transfer termination before completion is not supported.

My use case is to do DMA Transfers to the memory of a SPI RADIO device  which is transmitting a packet at a rate that is a fraction of the SPI speed, but the RADIO may trigger an interrupt which needs to be serviced by stopping the DMA transfer and getting control of the SPI to query the radio status.  After servicing the interrupt the DMA transfer can be resumed from the last successful memory transfer location.

The XMCLib DMA API has

XMC_DMA_CH_Suspend() and XMC_DMA_CH_Resume() and the description for CFGL.CH_SUSP says it can be used with FIFO_EMPTY to cleanly disable a channel without losing any data.

Are there any examples of how to use this if the DMA FIFO is not enabled?

Is the FIFO_EMPTY bit valid for single byte/word transfers as well?

Does the XMC_DMA_CH_Resume() restart only with the programmed service request or does it immediately transfer the next byte/word?

Are there any alternatives for interrupting a DMA transfer and determining how much was successfully transferred?

0 Likes
1 Solution
jamesk
Level 3
Level 3
First solution authored 5 replies posted 5 sign-ins

I came up with a solution which uses the multi-block DMA transfer and the block interrupt to update the runtime tx_data_index.  This necessitated modifying SPI_MASTER_StartTransmitDMA to use smaller block sizes and implementing interrupt handler for XMC_DMA_CH_EVENT_BLOCK_TRANSFER_COMPLETE event which clears each block interrupt and disabled DST/SRC reload on the next-to-last block.  Plus some additional helper functions were added in the xmc_dma.h to modify CLEARBLOCK and MASKBLOCK to drive the multi-block transfer according to the reference manual.

If the DMA is interrupted only the content since the last successful block needs to be written back to the RADIO memory.  As long as the interrupt and the data rewrite doesn't take longer than the RADIO needs to transmit those bytes I won't have a RADIO TX underrun.

Overwriting the same data in the RADIO buffer is allowed so I don't need the exact boundary of what was successfully sent.

The alternative would have been to rewrite a single large DMA block everytime the DMA was interrupted.

View solution in original post

0 Likes
1 Reply
jamesk
Level 3
Level 3
First solution authored 5 replies posted 5 sign-ins

I came up with a solution which uses the multi-block DMA transfer and the block interrupt to update the runtime tx_data_index.  This necessitated modifying SPI_MASTER_StartTransmitDMA to use smaller block sizes and implementing interrupt handler for XMC_DMA_CH_EVENT_BLOCK_TRANSFER_COMPLETE event which clears each block interrupt and disabled DST/SRC reload on the next-to-last block.  Plus some additional helper functions were added in the xmc_dma.h to modify CLEARBLOCK and MASKBLOCK to drive the multi-block transfer according to the reference manual.

If the DMA is interrupted only the content since the last successful block needs to be written back to the RADIO memory.  As long as the interrupt and the data rewrite doesn't take longer than the RADIO needs to transmit those bytes I won't have a RADIO TX underrun.

Overwriting the same data in the RADIO buffer is allowed so I don't need the exact boundary of what was successfully sent.

The alternative would have been to rewrite a single large DMA block everytime the DMA was interrupted.

0 Likes