EmbDev.net

Forum: ARM programming with GCC/GNU tools AT91SAM7S USB Framework bytes interchanged


von Lukas S. (Guest)


Rate this post
useful
not useful
Hello!
I have a AT91SAM7S with a modified ATMEL Virtual Com Application (CDC
Application from softpack-1.4-at91sam7s-ek-web)
Everything works fine if I transfer an Array of bytes from the
controller to the PC.
1
static unsigned char buffer[VALUES]; //USB Transmit Buffer
2
[...]
3
CDCDSerialDriver_Write(buffer, VALUES, 0, 0); //Send via USB to PC

CDCDSerialDriver_Write is a function from the Framework and is defined
as:
1
unsigned char CDCDSerialDriver_Write(void *data,
2
                                     unsigned int size,
3
                                     TransferCallback callback,
4
                                     void *argument)

but then I tried to send 16bit Values:
static short buffer[VALUES]; //USB Transmit Buffer
[...]
CDCDSerialDriver_Write(buffer, VALUES*2, 0, 0); //Send via USB to PC

The data is completely transmitted, but the order of the bytes (not
BITS!) is interchanged.

First comes the LOWBYTE and then the HIGHBYTE, but I need the Highbyte
first and then the Lowbyte and I haven't enough time to change the Order
before sending. Changing the PC applichation to read the data in a
different Order is also impossible.

What can I do?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.