Powerswitch: changing USB terminals from Port B to Port D

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
iphi
Rank 2
Rank 2
Posts: 68
Joined: Mon Jun 25, 2007 11:37 am

Powerswitch: changing USB terminals from Port B to Port D

Post by iphi » Mon Jul 02, 2007 6:18 pm

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!

iphi
Rank 2
Rank 2
Posts: 68
Joined: Mon Jun 25, 2007 11:37 am

Post by iphi » Mon Jul 02, 2007 6:26 pm

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

iphi
Rank 2
Rank 2
Posts: 68
Joined: Mon Jun 25, 2007 11:37 am

Post by iphi » Tue Jul 03, 2007 7:41 am

Found it.

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

Post Reply