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

von Lukas S. (Guest)

Rate this post
0 useful
not useful
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.
static unsigned char buffer[VALUES]; //USB Transmit Buffer
CDCDSerialDriver_Write(buffer, VALUES, 0, 0); //Send via USB to PC

CDCDSerialDriver_Write is a function from the Framework and is defined
unsigned char CDCDSerialDriver_Write(void *data,
                                     unsigned int size,
                                     TransferCallback callback,
                                     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?


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.