Forum Discussion
Altera_Forum
Honored Contributor
15 years agoYou are performing unaligned accesses. The 'i' variable you are using as an offset in the 32-bit read/write IO macros needs to be multiples of 4 (bytes). I think you meant to access word offset 5, 6, 7 which means the offset for the macro needs to be 20, 24, 28
The fabric doesn't support unaligned accesses so I'm guessing you were actually accessing byte address 4 when you passed in 5, 6, 7. If you want to populate the SDRAM with an increment pattern and read it back try this: volatile unsigned long r; // you don't want the compiler to optimize out the read loop for (i = 0; i < SOMETHING; i++) IOWR_32DIRECT(SDRAM_BASE, i*4; i); for (i = 0; i < SOMETHING; i++) r = IORD_32DIRECT(SDRAM_BASE, i*4);