Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

Using IOWR/IOWR_32DIRECT macro to transfer char array to SDRAM

Hello,

I'm new to both C and using NIOS and I can't seem to figure out how to use the IOWR_32DIRECT macro. I'm trying to transfer a 2D unsigned char array (rx_frame) from on-chip memory to the SDRAM, 32 bits at a time. The data bus is 32 bits on both the on-chip memory and SDRAM controller.

Here's what I have:

for (i = 0; i < length; i++) {

IOWR_32DIRECT(4*i, 0, rx_frame[0][4*i]);

}

The result is that I get rx_frame[0][0] at location 0x0 but locations 0x1,0x2 and 0x3 are 0.

Then I get rx_frame[0][4] at location 0x4 but locations 0x5, 0x6 and 0x7 are 0.

Then I get rx_frame[0][8] at location 0x8 but locations 0x9, 0xA and 0xB are 0.

Then I get rx_frame[0][12] at location 0xC but locations 0xD, 0xE and 0xF are 0. etc...

Any idea what I'm doing wrong and what I should be doing ?
No RepliesBe the first to reply