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

XMC™ Forum Discussions

User11773
Level 4
First like received First solution authored
Level 4
I have a buffer I want to clear often. Its just under 80K bytes.
XMC4700 is running at 144 Mhz. Using DAve ...

Profiling with a digital IO pin and an oscilloscope , I can clear buffer in about 2.7milliseconds using memset(). That seems to work out to about 29 Megabytes per second.
Can I go faster with using a DMA channel?
If so, are there any examples?

Am I correct that the DMA can copy at about 288 Megabytes per second? Peak of course.
Do DMA bursts play havoc with interrupts?
0 Likes
3 Replies
User15087
Level 2
First like received
Level 2
I believe that for memory-to-memory copy operation it takes 2 clock cycles to copy a 32-bit word. So that should result in the 288 Mbyte/s max. transfer speed you calculated.

DMA only uses the bus if it is free to use. So if you are executing some code that does heavy memory operations it will be slower. The main program execution, including interrupts, has priority over DMA.

Question: do you really need to erase the contents of the buffer? It may be just easier to have a flag indicating if the contents of the buffer are valid. Or use two pointers to indicate the region of the buffer that has valid data.
0 Likes
User11773
Level 4
First like received First solution authored
Level 4
Thanks Andrew.
The Block size limit is 4095, so the limit is 4*4095 ~= 16k per "transaction". I'd need to reload the destination address then restart. 5 transaction to complete the buffer clear. Does this sound correct?
Can I do it in one transfer using scatter or gather counts?

The buffer is a screen frame buffer for SPI connected Display controller. I'll also be doing a DMA from memory to SPI, later.
For now, a blast of data is the method.
0 Likes
User15087
Level 2
First like received
Level 2
You can configure the DMA to trigger an interrupt on XMC_DMA_CH_EVENT_BLOCK_TRANSFER_COMPLETE. You can then use that to trigger the transfer of the next block of data.

Not 100% sure, but if I recall correctly the DMA block transfer can be setup such that it transfers 4095 values in one go. So if you transfer 32-bit words (XMC_DMA_CH_TRANSFER_WIDTH_32) that is indeed equivalent to 16k. But it may be less if you only transfer 1 byte at a time (for example when you need a memory-to-peripheral transfer)
0 Likes