Page 1 of 1

Question about pin configuration of the USB for ATMEGA1281

Posted: Fri Jun 19, 2009 6:08 pm
by UnOrThOdOx
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,

Re: Question about pin configuration of the USB for ATMEGA1281

Posted: Mon Jun 22, 2009 5:30 pm
by ulao
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...

Re: Question about pin configuration of the USB for ATMEGA1281

Posted: Wed Jun 24, 2009 8:19 am
by Grendel
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.
 */

Re: Question about pin configuration of the USB for ATMEGA1281

Posted: Fri Jul 10, 2009 6:01 pm
by christian
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-.