Go Down

Topic: arduino2560 - can I use 16u2 USB protocol stack? (Read 659 times) previous topic - next topic

tangofoxtrot

I have an Arduino Mega 2560 that uses a 16U2 to do serial/USB translation between the 2560 and the host PC. Up to now, I've only used it to program the 2560.

I would like to use the 2560 to implement an HID (Joystick and some switches) that talks USB to a game on the host. Is there a way to setup (provide USB Descriptors to) and access the USB stack on the 16U2 from the 2560 without changing the 16U2's firmware?

jayjay1986

Nop, you will have to use the LUFA library to reprogram the 16u2. I don't think there is a way around that.
You would be better off with an Arduino Leonardo. It was designed to do things like that.

Jay
Jaycon Systems LLC
   Automate Your Life!

www.jayconsystems.com

tangofoxtrot

Thanks for the response. I was afraid that was the answer.
Concerning LUFA, the little reading I've done makes me think that it must be used with an Atmel chip that had USB hardware. Is that true, or can I write a bit-banging driver for the low-level USB functions? If so, where would that fit in the LUFA framework?

Nantonos

The HIDUINO library should be suitable, if you decide to reprogram the 16U2 on your Mega2560.

Alternatively, I wonder if there is an add-on board that has a second 16U2 and a second USB socket. This could be flashed, and connected to one of the other three serial ports on the Mega2560. That way the original USB port would remain available for code upload and the additional USB port would be seen as a HID.

Go Up