PowerSwitch using ATMega168

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ckkwok456
Posts: 2
Joined: Fri Jul 18, 2014 6:50 pm

PowerSwitch using ATMega168

Post by ckkwok456 » Fri Jul 18, 2014 7:13 pm

I just finished the powerSwitch project using ATMega168.

It states in the usbconfig.h that any pin in the port can be used as D-

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

But when I use PD4 as D-, it doesn't work.
When I use PD3 as D- ( as in the USB UART Bridge CDC project by Osamu Tamura ), it works OK.

blargg
Rank 3
Rank 3
Posts: 102
Joined: Thu Nov 14, 2013 10:01 pm

Re: PowerSwitch using ATMega168

Post by blargg » Sat Jul 19, 2014 1:27 am

What pin is D+ on? Which interrupt is being used? INT0 looks to be on PD2, and INT1 on PD3, and only PCINT on PD4. By default it uses INT0 (PD2).

ckkwok456
Posts: 2
Joined: Fri Jul 18, 2014 6:50 pm

Re: PowerSwitch using ATMega168

Post by ckkwok456 » Sat Jul 19, 2014 5:48 am

The D+ is PD2 ( INT0 ) as required.

Post Reply