UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
2,672 Views
Registered: ‎01-20-2012

XAPP502 SlaveSerial.c inconsistency question

I was trying to figure out the correct bit-order to program a Spartan 3E using XAPP502. Looking at the example source code in SlaveSerial.c, I am confused as to the bit-ordering there. The code sends the bits out in this order:

DataOut = (Data16 & 0x0100) ? 1 : 0;

DataOut = (Data16 & 0x0200) ? 1 : 0;

DataOut = (Data16 & 0x0400) ? 1 : 0;

etc. to

DataOut = (Data16 & 0x8000) ? 1 : 0;

DataOut = (Data16 & 0x0001) ? 1 : 0;

DataOut = (Data16 & 0x0002) ? 1 : 0;

etc. to

DataOut = (Data16 & 0x0080) ? 1 : 0;

 

Then there is a comment below saying

/*BE CAREFUL THIS IS BYTESWAPPED!*/

 

The question is, why is it byteswapped when this is a Slave Serial application? XAPP502.pdf states " For this design, byte-swapped data is used for SelectMAP configuration but not for Slave-Serial configuration." So this code could not have worked? Or was the source file for some reason byte-swapped and the code corrects for this by swapping it back?

 

0 Kudos