AVR-USB Device Not Recognized on Atmega8

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
kwebdesigns
Rank 1
Rank 1
Posts: 23
Joined: Sat Mar 15, 2008 7:46 pm

Post by kwebdesigns » Tue Mar 18, 2008 10:54 pm

The voltage levels at D+ and D- are at 4V without clamping diodes and 3V with. What should I be using to connect the USB interface. I do not have a LE35 and the AVR has to run at 5V powered by the USB port. I have tried many combinations of hardware, but something isn't right. Would a new Atmega8 help?

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

Post by christian » Tue Mar 18, 2008 11:21 pm

3 or 4 V on D+ AND D- when connected to USB? You should see ~ 3V on D- and almost 0 V on D+. Both data lines at high level is an illegal state.

kwebdesigns
Rank 1
Rank 1
Posts: 23
Joined: Sat Mar 15, 2008 7:46 pm

Post by kwebdesigns » Tue Mar 18, 2008 11:26 pm

Sorry about that. D+ stays at 0, but during a reset it comes up to 3V temporarily. I'm rebuilding the circuit and what should I have for resistor values, clamping diodes, etc.

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

Post by christian » Tue Mar 18, 2008 11:29 pm

During AVR reset it goes up to 3 V? How can this be?

kwebdesigns
Rank 1
Rank 1
Posts: 23
Joined: Sat Mar 15, 2008 7:46 pm

Post by kwebdesigns » Tue Mar 18, 2008 11:33 pm

Yes. Whenever I plug in the USB cable and keep the multimeter on D+ it goes up to 3V. Is that bad? If so, it's possible that I am getting bad readings somehow.

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

Post by christian » Tue Mar 18, 2008 11:43 pm

Since you don't get any debug logs, AVR-USB does not send any data (except the disconnect at boot time, but that would be D+ and D- at 0 V). The static 3 V level must therefore come from the host. But there's no situation where you can see extended periods of high level on D+, not even a pulse sequence with an average close to 3 V.

A scope would be pretty useful to see what's going on...

kwebdesigns
Rank 1
Rank 1
Posts: 23
Joined: Sat Mar 15, 2008 7:46 pm

Post by kwebdesigns » Tue Mar 18, 2008 11:56 pm

I rebuilt the circuit and I am still getting ~3V levels on both lines. I have built the circuit exactly like the easylogger circuit. This must be a hardware error. This isn't making sense. I don't have an oscilloscope, but I think I am going to order one. Is it okay if I e-mail you the code I'm using to rule out that possibility?

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

Post by christian » Wed Mar 19, 2008 12:01 am

Yes, please mail me the code through http://www.obdev.at/products/avrusb/feedback.html

I might have a hardware to run it.

tvdbon
Posts: 1
Joined: Thu Mar 20, 2008 8:50 pm

Post by tvdbon » Thu Mar 20, 2008 8:52 pm

I'm getting the same problem, although I still trying everything on a breadboard with a 16Mhz crystal. I also don't have anything wired in terms of the powerswitch switching stuff. Just everything that I need for the usb itself.

kwebdesigns
Rank 1
Rank 1
Posts: 23
Joined: Sat Mar 15, 2008 7:46 pm

Post by kwebdesigns » Sun Mar 23, 2008 2:24 pm

Christan,
Have you had time to test the code I sent you? Sorry I haven't contacted you in a while, but I have been gone the past few days. Thanks for taking the time to help me.

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

Post by christian » Sun Mar 23, 2008 3:50 pm

I've tried your code just now (sorry, did not have the time to do it earlier).
First one comment: You have set F_CPU and DEBUG_LEVEL in main.c. This is not the place where they should be set since these are global settings for all modules. They should be added to the compiler command line with -DF_CPU=12000000 -DDEBUG_LEVEL=2.

Since 12 MHz is the default anyway and since the debug level does not matter for functionality, I've left it as it is for testing. However, my board has D+ on Port D bit 2 and D- on Port D bit 4. I've therefore updated usbconfig.h and the initialization in main() to

Code: Select all

    DDRD = ~((1 << 2)|(1<<4));


Then I found that you left a modification you made for testing: You renamed the interrupt vector in usbdrvasm12.inc from USB_INTR_VECTOR to USB_INTRA_VECTOR. I've reverted this change, compiled the project and flashed it.

The resulting device enumerates correctly and the descriptors can be read. It is recognized as PowerSwitch. In other words: It works for me.

kwebdesigns
Rank 1
Rank 1
Posts: 23
Joined: Sat Mar 15, 2008 7:46 pm

Post by kwebdesigns » Sun Mar 23, 2008 4:48 pm

I finally got it! I made those changes you told me, but I do not think any of those were the problem. I have been using an Olimex development board and I finally breadboarded the circuit without it. Now the device is recognized and I am having no problems. I do not know why I never checked that, but apparently it was the problem. Thank you very much for your help and patience Christan.

Post Reply