Forum Discussion
Altera_Forum
Honored Contributor
9 years agoSDRAM read out of sync
I am testing SDRAM read and write using nios. I wrote a simple function with loops to write to 15 memory locations and read them back. for(i=min; i<max; i++) {
IOWR(SDRAM_BASE,0,i...
Altera_Forum
Honored Contributor
9 years agoThanks for your reply.
The IORD was actually a typo. Now I got an example circuit and made the read/write working. But I find it interesting that when I write and read in the same loop(the following code) I can read perfectly. for(i=min; i<max; i++) { IOWR_32DIRECT(pbase,0,i);printf("%d %d \n",i, iord_32direct(pbase,0)); } However, when I write in a loop and read in another loop I got some memory locations read wrong. Is there any explanation for this? for(i=min; i<max; i++) { IOWR_32DIRECT(pbase[i],0,i); } printf("Reading from Mem \n"); for(j=min; j<max; j++) { printf("%d %d \n",j, IOWR_32DIRECT(pbase[j],0)); } Cheers,