Altera_Forum
Honored Contributor
21 years agoSDRAM byte (8-bit) write access
Hi all,
I've a NiosII system based on EP1C6144, with an extrernal 2Mb 16-bit wide SDRAM. While writing SDRAM with 16 or 32-bit wide data gives the expected result, if I try to write a single byte (8-bit) I find 2 adiacent bytes written in SDRAM with the same value. To check this behaviour I wrote a simple in-line assembler that make me sure I have not compiling problems: __asm__ ("nop \n\t"
"movi r6, 0x12 \n\t"); // Loads data to be written (0x12) in register R6
__asm__ ("movhi r7, %hi(0x1F7F84) \n\t"
"ori r7, r7, %lo(0x1F7F84) \n\t"); // Loads address data has to be written to (0x1F7F84) in register R7
__asm__ ("stb r6, 0(r7) \n\t"); // Writes BYTE in R6 in address pointed by R7+0
Before these instructions I have the memory window displaying 0x001F7F84 0x00 0x00 0x.... and after instructions... 0x001F7F84 0x12 0x12 0x.... I checked all SDRAM's timing parameters and they seems to be right, in effect code runs from SDRAM and 16 and 32-bit accesses are correct, and also any read access. Any idea? Thanks all, Paolo