USB on Mega664 not working

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ThiefMaster
Posts: 5
Joined: Thu Mar 13, 2008 5:17 pm
Contact:

USB on Mega664 not working

Post by ThiefMaster » Thu Mar 13, 2008 5:27 pm

Hi,

I tried the PowerSwitch example on my Mega644 but the PC always says that the connected USB device could not be detected and doesn't work properly (libusb-win32 is installed and HIDKeys has the same problem).

My layout looks like this:
D+ -> 68Ohm -> PC2.
PC2 <-> INT0
D- -> 68Ohm -> PC0
+ -> 1.5k -> D-
- -> GND

I'm using a 12MHz quartz oscillator and lfuse=0xff.
The CPU itself is working fine, but USB isn't.

In case you need it, here are some measurements:
GND,+: 5.03V
GND,D-: 4.04V
GND,D+: 1.63V

Through the serial line, i get the following output (DEBUG_LEVEL=2):

Code: Select all

ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:
ff:


dmesg on a linux box:

Code: Select all

usb 2-2: new low speed USB device using uhci_hcd and address 6
usb 2-2: device descriptor read/64, error -71
usb 2-2: device descriptor read/64, error -71
usb 2-2: new low speed USB device using uhci_hcd and address 7
usb 2-2: device descriptor read/64, error -71
usb 2-2: device descriptor read/64, error -71
usb 2-2: new low speed USB device using uhci_hcd and address 8
usb 2-2: device not accepting address 8, error -71
usb 2-2: new low speed USB device using uhci_hcd and address 9
usb 2-2: device not accepting address 9, error -71

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

Post by Grendel » Thu Mar 13, 2008 8:16 pm

Looks like you are runing the chip at 5V -- try adding 3V6 Z-diodes to GND on D+/D- and change the 1k5 R to 2k2.

ThiefMaster
Posts: 5
Joined: Thu Mar 13, 2008 5:17 pm
Contact:

Post by ThiefMaster » Thu Mar 13, 2008 8:20 pm

I'll try that later.. Which voltage should the chip have?

Very odd thing: after moving to PD2 (=INT0) and PD3 it works fine when connecting it to my linux pc.. when connecting it to my windows PC I still get the same errors.

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

Post by christian » Thu Mar 13, 2008 10:06 pm

The debug log shows that the driver sees one (or multiple) USB RESET(s), but no data received. This probably means that the interrupt routine is not called, otherwise we would at least see a received packet.

If you got it working on one PC but not on the other, it's very likely a voltage level problem. D+ and D- should be limited to 3.3 V (3.6 V at most). We recommend 3.6 V low power Zener diodes (for various reasons 3.6 V, not 3.3 V) if you run the AVR at 5 V. Or you add a 3.3 V voltage regulator for the AVR's supply.

ThiefMaster
Posts: 5
Joined: Thu Mar 13, 2008 5:17 pm
Contact:

Post by ThiefMaster » Thu Mar 13, 2008 10:14 pm

Will the AVR work correctly with 3.3V? According to the datasheet, it needs 2.7-5.5V for 0-10MHz and 4.5-5.5 for 0-20 MHz.

Edit: Seems to work fine with 3.5V on the AVR.

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

Post by christian » Thu Mar 13, 2008 10:26 pm

Some of the AVRs have a diagram in the datasheet: supply voltage vs. maximum clock frequency. This shows a linear dependency of max clock vs. supply voltage.

Post Reply