byte order microblaze

Dec 12, 2003 3 Replies

Hi,



I've a small program in bram which has a pointer to sdram.



static volatile BYTE * const p_sdram = (BYTE *) XPAR_SDRAM_CTRL_BASEADDR;



in my code I try to fill the sdram (by the way, it's 32-bits wide databus):



for (i = 0; i < 16; i++) { *(p_sdram+i) = i; }



Now comes the problem: when I read back the data, each 2 bytes are exchanged. Reading back is done with the same byte pointer:



for (i = 1; i


I have this piece of code. I have just used char instead of BYTE. I get the proper output. I do not see the interleaving that you specify. If you can give more info about the design you are seeing this problem with, we can take a look.

===== int main() { static volatile char * const p_sdram = (char *) 0xe000000; int i;

for (i = 0; i < 16; i++) { *(p_sdram+i) = i; }

for (i = 1; i Hi,

0F6319F16E1A7BB5E33C7470 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit

Frank,

I've also used char in my code when testing the OPB SDRAM controller and not seen a problem.

There is a bit-ordering difference that is really only important in the address bus simply because when setting the SDRAM mode register, the address bus contains the data for that register.

So I reccommend checking the bit-ordering connections. There are some examples in the design spec.

Thanks! anita

Vasanth Asokan wrote:

I also tested the same code with a pointer to bram, that was working good (I got the expected output). I am using the Virtex II development board. I will check the connections.

Thanks, Frank

not

address

examples

XPAR_SDRAM_CTRL_BASEADDR;

databus):

story

feeling

the

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required