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);
} for(i=min; i<max; i++) {
pbase=IOWR(SDRAM_BASE,i);
printf("%d %d \n",i, pbase);
} The first few reads return the last value(14) and the rest -1.
Reading from Mem
0 14
1 14
2 14
3 14
4 14
5 14
6 -1
7 -1
8 -1
9 -1
10 -1
11 -1
12 -1
13 -1
14 -1
I am driving the SDRAM from a PLL(sdram_clk) which is 3 ns leading the system clock(sys_clk) which is driving the other modules. How can I solve this? I am on DE4 board. Cheers,