Swapped D+/D- pins

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
jamesotron
Posts: 5
Joined: Fri May 13, 2011 12:31 am

Swapped D+/D- pins

Post by jamesotron » Mon Jul 18, 2011 1:53 am

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?

ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: Swapped D+/D- pins

Post by ulao » Mon Jul 18, 2011 5:00 am

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!

jamesotron
Posts: 5
Joined: Fri May 13, 2011 12:31 am

Re: Swapped D+/D- pins

Post by jamesotron » Tue Jul 19, 2011 11:57 pm

Right, except that the comments below say that D- must be connected to an INT0 port.

Micha

Re: Swapped D+/D- pins

Post by Micha » Wed Jul 20, 2011 1:50 pm


Post Reply