Page 1 of 1

Powerswitch: changing USB terminals from Port B to Port D

Posted: Mon Jul 02, 2007 6:18 pm
by iphi
Hi,

in powerswitch I would like to use port D as connection port to the USB cable instead of port B.

When I change in usbconfig.h from
#define USB_CFG_IOPORTNAME B
...
to
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 1

recompile and rewire the USB connections, then it doesn't work. The USB device appears on the bus as it wasn't there, i.e. the 1.5kOhms pullup resistor on D- seems to get pulled down by the port D0.
Have I missed to change something else?

Thanks for your help!

Posted: Mon Jul 02, 2007 6:26 pm
by iphi
P.S.

I have just seen this code segment in main.c:

/* This is the AT90S2313 version of the routine. Change for others. */
static void outputByte(uchar b)
{
PORTB = (PORTB & ~0xfc) | (b & 0xfc);
PORTD = (PORTD & ~0x30) | ((b << 4) & 0x30);
}

Could my problem come from the fact that I run the code on an attiny2313?

Thanks

Posted: Tue Jul 03, 2007 7:41 am
by iphi
Found it.

The port directions were hard coded and did not make use of USB_CFG_IOPORTNAME.