This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Clearing very large buffer using DMA ?

Hi,

I know this request may sounds strange but what I want to achieve is to clear a large array of samples (audio delay) very very fast, ideally at no CPU cost (that's why I thinking of using EDMA) because in the meantime, the rest of the processing has to continue.  memset is far too slow for such a large array.

Let's say I have one small source buffer of 64 float (full of zero) and I would like to copy and replicate (in the circular way) it into a very large 384000 float.

Would it be possible to do it using EDMA, eventually in a single request ?

I was thinking in using chained requests but as the size of the source and destination buffers is different, I don't know exactly how to proceed.  Could someone explain me briefly how to do it (if it's possible anyway) ?

Any other suggestion is welcome !

Thanks !

Renaud

  • Renaud,

    Can you specify why you need to zero out the array of samples. I would assume that the content of the sample array is replaced by the new samples from the next time window, right? Zeroing the array is generally required only during initialization, so I don`t completely understand why you need this requirement inside the loop that has real time requirements.

    EDMA is just an engine to transfer data. If you want to control the content that is being transferred you will end up creating an additional requirement of a temporary buffer that needs to be initialized with the content that you want to transfer. The temporary array will then be your source array in the EDMA transfer and the array that stores delayed audio samples would be the destination.

    Is your application multithreaded?

    Have you considered using Ping-pong buffering mechanism?

    Some information on what device you are using will also help us point you to appropriate examples. This may not have helped you answer the questions, but I am just trying to understand your usecase while providing you with options.

    Regards,

    Rahul

    PS: If you are looking for an example circular buffer implementation look at the app note mentioned below:

    http://www.ti.com/lit/an/spra645a/spra645a.pdf

  • Renaud,

    Here are the PARAM settings you will want to use. You can use a QDMA channel or a DMA channel followed by a write to ESR.

    OPT = TCINTEN=1, TCC=channel# or an unused code, SYNCDIM=ABSync, others 0
    SRC = &floatarray[0]
    ACNT=64*4 (size of the float array in bytes), BCNT=384000/64
    DST = &floatLargeArray[0]
    SRCBIDX = 0, DSTBIDX = ACNT
    BCNTRLD = 0, LINK = 0xFFFF or a link set for reuse
    SRCCIDX = 0, DSTCIDX = 384000
    CCNT = 1

    Three things to point out:

    1. This is a moment of weakness for me. I rarely give out answers when I might try to guide you through doing it yourself, so you know more at the end.

    2. To understand what is going on, I will recommend the Training section of TI.com, where there is a training video set for the C6474. In particular, the EDMA3/QDMA/IDMA Module may help you understand some of the features and options available within the EDMA3 module. You can find the complete video set here.

    3. Just so I feel better about #1, there might be a mistake in the settings above. [Ed: DSTCIDX is not needed, and it is only a 16-bit field so it does not matter.]

    Even if you poll the IPR bit to find out when the operation has completed, it will complete faster than if you used memset. But the best thing to do is to kick off the DMA transfer and go do lots of other things in the DSP code, then wait for the completion bit or ignore it or let it cause an interrupt that sets a flag or Semaphore.

    Regards,
    RandyP