AnsweredAssumed Answered

16-bit Host Wierdness

Question asked by jfmorris on Oct 14, 2015
Latest reply on Nov 3, 2015 by jfmorris

Ok, I am working in 16-bit mode, and trying to ge the point I am writing the firmware to the ADV212.  At the moment I have a simple loop that writes the values 0x0000 to 0x000f to the first 16 locations at address 0x00050000 in the ADV212, and then I read it back.  I am doing the following in my code:

 

  *adv212_register_BUSMODE = 0x0005;

  *adv212_register_MMODE = 0x0005;

  *adv212_register_STAGE = 0x0005;

  *adv212_register_IADDR = 0x0000;

adv212_firmware_num_words = 16;

  for (t=0;t<adv212_firmware_num_words;t++)

  {

    *adv212_register_IDATA = adv212_firmware_data[t];

  }


  *adv212_register_STAGE = 0x0005;

  *adv212_register_IADDR = 0x0000;

  for (t=0;t<adv212_firmware_num_words;t++)

  {

      tempData[t] = *adv212_register_IDATA;

  }

 

I then dump both the original and the read back arrays. These arrays are 16 bit unsigned values.

 

Here's what I wrote:

0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f

 

And here is what I read back:

0000 0002 0001 0004 0003 0006 0005 0008 0007 000a 0009 000c 000b 000e 000d 000f


I would have expected to read back 0x1, 0x0, 0x3, 0x2, and so on, ending with a 0xe.  In other words, we should have seen the data half-word swapped.  The fact is that it seems that way for the 2nd to the 15th read back, but what is confusing me is the first and the sixteenth word read back are NOT swapped.

 

Can anyone give me a hint what I might be doing wrong in the above sequence?

 

Help is greatly appreciated. Thanks!

Outcomes