Page 3 of 3

Posted: Tue Mar 18, 2008 10:54 pm
by kwebdesigns
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?

Posted: Tue Mar 18, 2008 11:21 pm
by christian
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.

Posted: Tue Mar 18, 2008 11:26 pm
by kwebdesigns
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.

Posted: Tue Mar 18, 2008 11:29 pm
by christian
During AVR reset it goes up to 3 V? How can this be?

Posted: Tue Mar 18, 2008 11:33 pm
by kwebdesigns
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.

Posted: Tue Mar 18, 2008 11:43 pm
by christian
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...

Posted: Tue Mar 18, 2008 11:56 pm
by kwebdesigns
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?

Posted: Wed Mar 19, 2008 12:01 am
by christian
Yes, please mail me the code through http://www.obdev.at/products/avrusb/feedback.html

I might have a hardware to run it.

Posted: Thu Mar 20, 2008 8:52 pm
by tvdbon
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.

Posted: Sun Mar 23, 2008 2:24 pm
by kwebdesigns
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.

Posted: Sun Mar 23, 2008 3:50 pm
by christian
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.

Posted: Sun Mar 23, 2008 4:48 pm
by kwebdesigns
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.