Page 1 of 1

PowerSwitch using ATMega168

Posted: Fri Jul 18, 2014 7:13 pm
by ckkwok456
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.

Re: PowerSwitch using ATMega168

Posted: Sat Jul 19, 2014 1:27 am
by blargg
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).

Re: PowerSwitch using ATMega168

Posted: Sat Jul 19, 2014 5:48 am
by ckkwok456
The D+ is PD2 ( INT0 ) as required.