USB Keyboard emulation problem

Hi all - I'm using an arduino to simulate a USB keyboard using Rancid Bacon's adaptation of the AVR USB code - ProjectLogArduinoUSB

It's working really well, but this post is an appeal to anyone else using it - I'm just having one small difficulty - in order to use this with another shield, I need to change some of the pin assignments, and whenever I do, it stops working and I get 'USB device not recognised' from the PC - if I change it back & re-wire accordingly, it works fine...

the way I'm trying to do this is to edit the usbconfig.h (I've got it running without the USB_CFG successfully, so I've got that pin back):


/* ---------------------------- Hardware Config ---------------------------- */

#define USB_CFG_IOPORTNAME D
/* This is the port where the USB bus is connected. When you configure it to

  • "B", the registers PORTB, PINB and DDRB will be used.
    /
    #define USB_CFG_DMINUS_BIT 4
    //#define USB_CFG_DMINUS_BIT 4
    //#define USB_CFG_DMINUS_BIT 3
    /
    This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
  • This may be any bit in the port.
    /
    #define USB_CFG_DPLUS_BIT 2
    //#define USB_CFG_DPLUS_BIT 2
    /
    This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
  • This may be any bit in the port. Please note that D+ must also be connected
  • to interrupt pin INT0!
    */

/* ----------------------- Optional Hardware Config ------------------------ */

//#define USB_CFG_PULLUP_IOPORTNAME D
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of

  • V+, you can connect and disconnect the device from firmware by calling
  • the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
  • This constant defines the port on which the pullup resistor is connected.
    /
    //#define USB_CFG_PULLUP_BIT 5
    /
    This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
  • above) where the 1.5k pullup resistor is connected. See description
  • above for details.
    */

Is this the right place to make the edits? is there anywhere else I should look?

I'm trying to move the comms to pins 0 & 1 ideally.
I'm running your release 002 with Arduino 0016, as it worked (and 004 with arduino 0018 didn't)

Thanks for any help you can provide!!!!

James

I'm afraid I can't help with changing the pins, but I can confirm that I too cannot get version 4 of the USB HID code to work with Arduino 0018.

Having managed to get it to compile and to enable debugging mode, it looks like it is transmitting data, failing to receive anything back.

But I'm at the limit of my knowledge of C/C++ so I've reverted to v2/0016 (which is a life saver and which I found out from this post, Thanks!)

erm, doesn't trying to use pins 0 and 1 for USB collide with the UART?