usb_control_msg length

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ahulap
Posts: 16
Joined: Tue Dec 26, 2006 1:30 pm
Location: Kharkiv, Ukraine

usb_control_msg length

Post by ahulap » Thu Feb 22, 2007 10:05 am

Hello!
I'm developing AVR-USB device on tiny2313 and want to implement usbFunctionWrite and usbFunctionRead. In control message there is a 2-byte transfer length (bytes 6 and 7), but this software driver can handle maximum 254 bytes.
Can i ignore length high byte and use byte-size counter instead of word-size? (this will save around 30 bytes of code, what is great for 2k device). Is there needed any checks for transfer bigger than 254 bytes or driver will reject such transfers at low level? My PC software will not send more than 254 bytes in one transfer, but to be sure...

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Wed Mar 07, 2007 2:02 pm

Yes, you can safely ignore the high byte. The driver does the same thing in order to save some bytes of code.

ahulap
Posts: 16
Joined: Tue Dec 26, 2006 1:30 pm
Location: Kharkiv, Ukraine

Post by ahulap » Wed Mar 07, 2007 4:17 pm

Thank you!

Post Reply