Page 1 of 1

sending at least 50 bytes from PC to AVR

Posted: Thu Dec 27, 2007 6:04 pm
by Kernel
I already have established a connection between PC and the AVR and can exchange commands and data between both of them.
Now I want to send at least 50 bytes from PC to the AVR to store these and later print them on an external display.
My question now is, how I can arrange this.
Can please somebody tell/show me, what I have to do, to send the data over the USB to the AVR?

Thanks a lot.

Posted: Thu Dec 27, 2007 8:41 pm
by christian
You need to implement usbFunctionWrite() and return -1 in usbFunctionSetup() for a particular request. When you send this request from the host, the driver will call usbFunctionWrite() in chunks of 8 bytes until all data is received.

See usbdrv.h for a description of usbFunctionWrite() and usbFunctionSetup(). You need to enable usbFunctionWrite() in usbconfig.h.

An example for this can be found in Automator, although this is also a HID compliant device. On the other hand, you might want to be HID compliant, too.