Question about pin configuration of the USB for ATMEGA1281

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
UnOrThOdOx
Posts: 1
Joined: Fri Jun 19, 2009 5:50 pm

Question about pin configuration of the USB for ATMEGA1281

Post by UnOrThOdOx » Fri Jun 19, 2009 6:08 pm

Hello,

I have a question about the pins configuration of the usb.
As you can see from the image below (marked in red)

Image

I'm trying to design a usb dongle by using ATMEGA1281

But i'm not sure where to connect the usb pins to the chip.

Could anyone please help me out and give me a hint where I should connect D+ and D- to?

I have no idea so I just connect "D- (usb port)" to the pin "PD1:SDA:INT1" and "D+(usb port)" to the pin "PD0:SDL:INT0" to on ATMEGA1281.
Could someone please confirm that the pins I chose were the right pins? Or could anyone please suggest where I should connect what?

I'd really appreciate your help.

Thank you so much in advance & Best Regards,

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

Re: Question about pin configuration of the USB for ATMEGA1281

Post by ulao » Mon Jun 22, 2009 5:30 pm

If this sounds nutty, then please disregard as I'm way more lost then you. But would you not want to connect the usb pins to what you chose in your software? Unless you didnt write it, or I'm missing something painfully obvious you would want to set your pins in the code and then connect them as such, no? PD1 and 0 are good choices as that is a normal set up, but atmega chips ( or most of them ) allow the coder to choose what pins they like, this should be known if not by you, by the author...

Grendel
Rank 4
Rank 4
Posts: 167
Joined: Sat Dec 16, 2006 9:53 pm
Location: Oregon, USA
Contact:

Re: Question about pin configuration of the USB for ATMEGA1281

Post by Grendel » Wed Jun 24, 2009 8:19 am

Looks good, make sure you setup usbconfig.h accordingly. BTW, you will need a 1.5K pullup resistor on D- to V+ or, alternatively, a port pin.

From the usbconfig.h file:

Code: Select all

/* ---------------------------- Hardware Config ---------------------------- */

#define USB_CFG_IOPORTNAME      D
/* This is the port where the USB bus is connected. When you configure it to
 * "B", the registers PORTB, PINB and DDRB will be used.
 */
#define USB_CFG_DMINUS_BIT      4
/* 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! [You can also use other interrupts, see section
 * "Optional MCU Description" below, or you can connect D- to the interrupt, as
 * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
 * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
 * markers every millisecond.]
 */
[..]
/* ----------------------- Optional Hardware Config ------------------------ */

/* #define USB_CFG_PULLUP_IOPORTNAME   D */
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
 * V+, you can connect and disconnect the device from firmware by calling
 * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
 * This constant defines the port on which the pullup resistor is connected.
 */
/* #define USB_CFG_PULLUP_BIT          4 */
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
 * above) where the 1.5k pullup resistor is connected. See description
 * above for details.
 */

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Question about pin configuration of the USB for ATMEGA1281

Post by christian » Fri Jul 10, 2009 6:01 pm

And you will either have to run the AVR on 3.3 V or use zener diodes to limit the voltage on D+ and D-.

Post Reply