Altera_Forum
Honored Contributor
19 years agowrite & read SDRAM chip
hi all
I try to read and write the external 8M SDRAM chip. At the Nios II IDE, my system library and "Linker Script" with program memory(.text), Read-only data memory(.rodata), Read/Write data memory (.rwdata), Heap memory, Stack memory all setting another RAM chip "sram_0". My program is below: # include <stdio.h># include <alt_types.h># include <io.h># include <system.h># include <string.h># include "system.h" int main(void) { unsigned int value = 0; unsigned int pattern = 0x10; unsigned int i, memory_size; memory_size = 0x800; //SDRAM actual size is 0x7FFFFF for(i = 0; i< memory_size; i=i+0x10) { IOWR_16DIRECT((SDRAM_0_BASE), i, pattern); value = IORD_16DIRECT((SDRAM_0_BASE), i); printf("%d,%d\n", i,value); } return 0; } but in the Console with result is only display 6 data: 0,16 16,16 32,16 48,16 64,16 80,16 Could anyone tell me where it is fault ? At the SOPC Builder->More Settings->Exception Address & Memodule my setting is sdram_0. is this need change to sram_0 or not ? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif