Mega1280 as USB client

Hi all,

I'm trying to get to run the UsbKeyboard library that can be found at Project Log : Arduino USB - ProjectLogArduinoUSB

So far, I built a protoshield which I wired according to http://www.practicalarduino.com/pics/virtual-usb-keyboard-schematic.jpg

The only difference between this schematics and my board is, that the 2.2k pullup runs to digital pin 8 and D- is connected to digital pin 7 to leave pins 3..6 for other projects.

I changed the usbconfig.h accordingly (at least I think so):

...
#define USB_CFG_DMINUS_BIT 7
...
#define USB_CFG_PULLUP_BIT 8

After applying the 0018 fix (#ifdefs around usbInit and usbPoll in usbdrv.h), I tried the UsbKeyboardDemo1 sketch on a Diecimila clone (Seeeduino v2.12) and an ArduinoMega clone (Seeeduino Mega v1.1).

The sketch compiles and uploads fine, but both devices won't do anything with the code in place. I.e. the LED on pin 13 stays lit all the time and the device doesn't show up anywhere in the USB logs of the connected PC.

Interestingly, if I just upload a random sketch, that doesn't do anything USB related, whenever I connect the USB-Socket to my PC, it tries to enumerate a full speed USB device (as noted at 7 March 2008 on
Project Log : Arduino USB - ProjectLogArduinoUSB):

usb 5-1: new full speed USB device using uhci_hcd and address 64
usb 5-1: device descriptor read/64, error -71
usb 5-1: device descriptor read/64, error -71
usb 5-1: new full speed USB device using uhci_hcd and address 65
usb 5-1: device descriptor read/64, error -71
usb 5-1: device descriptor read/64, error -71
usb 5-1: new full speed USB device using uhci_hcd and address 66
usb 5-1: device not accepting address 66, error -71
...

Therefore I assume that at least most of my protoboard is fine. :wink:

Any suggestions what I'm doing wrong here? And is the UsbKeyboard code even expected to be working on an Atmega1280?

I think, in regard to the ports and interrupts used, the 1280 is closer to the 168 than the 328p, right?

Any help is greatly appreciated!

Best regards,
Torsten