Page 1 of 1

Swapped D+/D- pins

Posted: Mon Jul 18, 2011 1:53 am
by jamesotron
Hi there.

On my latest set of prototype boards I accidentally flipped D+ and D- so that D- is connected to D2 and D+ is connected to D4! (This is an ATMega328p) - is it possible to work around the interrupt being on the wrong port in the software or should I get out the iron and try and fudge something together?

Re: Swapped D+/D- pins

Posted: Mon Jul 18, 2011 5:00 am
by ulao
Going to go out on a limb here an assume I'm missing the point. However if I'm not, my question to you... Why not switch the defines in the config.h ?

Assuming you use the default for most projects.

Code: Select all

#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!


to

Code: Select all

#define USB_CFG_DMINUS_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.
 */
#define USB_CFG_DPLUS_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. Please note that D+ must also be connected
 * to interrupt pin INT0!

Re: Swapped D+/D- pins

Posted: Tue Jul 19, 2011 11:57 pm
by jamesotron
Right, except that the comments below say that D- must be connected to an INT0 port.

Re: Swapped D+/D- pins

Posted: Wed Jul 20, 2011 1:50 pm
by Micha