Page 1 of 1

HID keys port problem

Posted: Fri Mar 08, 2013 4:05 pm
by Trindade
Hi,

I'm trying to create a project based on Hid Keys. My problem starts when trying to connect the D + and D-port to another.

What happens is that I change the port in the library usbconfig.h and connect the pins where I want but after compiling the program and go to the atmega 8, this always works with the configuration of the original design.

I also changed the configuration of PORT's in main.c but the same thing always happens.

I started just by changing the D-, keeping the D+ connected to INT0. For example, in the port's initial project are defined DDRD, D-= 0 and D + = 2. I changed the D-= 3 but when I connect it to the pc it says the device is unknown. If reconnecting the D-= 0, whith no compile or copy back to the atmega8, it works correctly.

What am I doing wrong?

Re: HID keys port problem

Posted: Tue Jun 25, 2013 3:51 pm
by ulao
I think d+ needs to go to an int pin. Other then that they should work on any pin. see in code Please note that D+ must also be connected
* to interrupt pin INT0!


#

Code: Select all

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      0
/* 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
/* 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!
 */


also make sure to set the pull up

Code: Select all

 #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          1
/* 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.
 */