AT91SAM7S USB Framework bytes interchanged

Guest #1174386
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?

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.