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 agoThen you need to change how you use the macros. You need to feed them the actual address you want to write to, but when you write pbase you give them the address contents instead.
try this:
iowr_32direct(pbase+i,0,i);
printf("%d %d \n",i, iord_32direct(pbase+i,0)); or this:
iowr_32direct(pbase,i*4,i);
printf("%d %d \n",i, iord_32direct(pbase,i*4)); or even just use pbase without any IORD/IOWR macro if you don't need to bypass the data cache.
pbase=i;
printf("%d %d \n",i, pbase);