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.