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.

Using DMA to transfer data on C5510 DSK

Hi guys,

I was using DMA to transfer data from an array, src, on SDRAM to an array, dst, on SDRAM. Basically, both the a source array and a destination array were defined and located on the same external SDRAM.

The problem was that if the array size is under 16384, which is 2^14, the program works. But if the size is bigger than 16384, when I do the check after DMA transfer is done:

for (i = 0; i <= (N - 1); i++) {
        if (dst[i] != src[i] ) {
            ++err;
        }
    }

the misreading happens when i=sizeof(dst) - (sizeof(dst) - 16384) *2. For example, if the length of dst is 20000, the misreading happens at i = 20000-(20000 - 16384)*2=12768.

After that i value, the reading of dst[i] will always be 0.

The weirder thing is that when I check the dst data with the watch window in CCS, or even print the dst[i] value, I got the correct value.

I suspected that something wrong with the address bus with EMIF. So, I check the memory by define dst and src with the same length and the same addresses. Without DMA transferring data between dst and src, the reading and checking was fine. I got the correct value.

I am out of ideas now. Can you guys help me to figure out what is going on?

Thank you.

  • Xinwang,

    First I would expect your SDRAM is bigger than 16384 since your said you can read correct data using CPU. I would recommend double check your DMA operation.

    Regards.

  • Hi Steve,

    Thanks for your reply. You are right. I made a mistake on checking DMA operation finish.

    I still have a question:

    It seems that restoring a big amount of data by array is not a good way. The biggest array size seems to be 2^16=65536. For my application, I will need 80K. What do you suggest to use to store this big amount of data? Does "malloc" work for this situation?

    Thank you again for your help.

  • I believe that if you change from the Small memory model to the Large memory model, then you will be able to access more than 65536, but I am not absolutely certain.

    You could write the code in assembly language, where the exact limitations of the processor will be apparent.