Altera_Forum
Honored Contributor
15 years agoCyclone III Starter kit--DDR SDRAM address mapping (NIOS II)
Dear all, I did a DDR SDRAM memory test on Cyclone III Starter Kit, I changed the 'hello_world0" program.
When I write '0' to address '0', read the data out at address'0', the result is '0', correct ; But when I write '1' to address '1', read the data out again at address'0', the result at address'0' is not '0' anymore, but change to '1'! It seems the writing at address '1' affects the data on address'0'. My question is: Is address'0' and address'1' the same address for writing SDRAM? The DDR SDRAM is only 13 bit address, but the SOPC SDRAM controller altmemddr has 26 bit address (0x02000000-0x03ffffff), how the 13 bit address is mapping to 26 bit address to connect to Avalon switch fabric? The program and running result is in the following: # include <stdio.h># include "system.h"# include "io.h"# include "altera_avalon_pio_regs.h" int main() { int i; int error_count; int readbyte; error_count = 0; i=0; IOWR_16DIRECT(ALTMEMDDR_BASE, i, i); printf("i is %d\n",i); i = 0; readbyte = IORD_16DIRECT(ALTMEMDDR_BASE, i); printf("readbyte is %d\n",readbyte); i=1; IOWR_16DIRECT(ALTMEMDDR_BASE, i, i); printf("i is %d\n",i); i = 0; readbyte = IORD_16DIRECT(ALTMEMDDR_BASE, i); printf("readbyte is %d\n",readbyte); return error_count; } Nios II console output: i is 0 readybyte is 0 i is 1 readbyte is 1