Page 1 of 1

Atmega8 and v-usb (HIDKeys)

Posted: Fri Apr 15, 2011 8:53 pm
by Nussi
Hello there,

I started to use V-USB yesterday, but could not figure out how to use the whole thing.
I use an AtMega8, wiring is correct, used the shortest distances between the components.
If I download and compile the HIDKeys Example it wont work.
The crystal I use is a 12Mhz Xtal, defined correct in the main.c

The wiring is exactly as shown on the circuit. If I plug it in it says, it is an unknown device.

I have no clue where to start. With UARt it was all easy, but with USB things get complicated.

Used WinAVR to compile it, commented checksize out. Compiles without a problem to main.hex.
I program the hardware with a USP ISP with the BASCOM Programmer.

What could be the problem? I *really* have no clue where to start debugging!
Do i need other VID/PID settings? It is done on a PCB :-)

Thank you :)

Re: Atmega8 and v-usb (HIDKeys)

Posted: Sat Apr 16, 2011 1:09 pm
by Nussi
Linux gives me this info (dmesg excerpt)

[ 1999.404061] usb 6-2: new low speed USB device using uhci_hcd and address 22
[ 1999.584078] usb 6-2: device descriptor read/64, error -71
[ 1999.812065] usb 6-2: device descriptor read/64, error -71
[ 2000.084064] usb 6-2: new low speed USB device using uhci_hcd and address 23
[ 2000.208079] usb 6-2: device descriptor read/64, error -71
[ 2000.488076] usb 6-2: device descriptor read/64, error -71
[ 2000.704075] usb 6-2: new low speed USB device using uhci_hcd and address 24
[ 2001.117043] usb 6-2: device not accepting address 24, error -71
[ 2001.229058] usb 6-2: new low speed USB device using uhci_hcd and address 25
[ 2001.644059] usb 6-2: device not accepting address 25, error -71
[ 2001.644084] hub 6-0:1.0: unable to enumerate USB device on port 2



Voltage on D-: 3,6V .. D+ is 0V

Re: Atmega8 and v-usb (HIDKeys)

Posted: Sat Apr 16, 2011 5:33 pm
by Daid
Did you configure the fuses to use the crystal? By default the ATMega8 runs on internal 1Mhz.

Re: Atmega8 and v-usb (HIDKeys)

Posted: Sat Apr 16, 2011 5:56 pm
by Nussi
Daid wrote:Did you configure the fuses to use the crystal? By default the ATMega8 runs on internal 1Mhz.


Sure! I double checked this! :)

Re: Atmega8 and v-usb (HIDKeys)

Posted: Mon Apr 18, 2011 1:22 pm
by Daid
Ok (forgetting the fuse settings is my most common error :P)

I have no experience using the 12Mhz version (I overclock my ATMega8 to 20Mhz) but it should work.
First, make sure the device is really running. Your computer will try to enumerate the USB device with just the resistor from VCC to D- (remove the uC, and plug it in, most likely you'll see the same error in Linux)

One other problem I noticed is the USB cable. I once wired a USB cable directly to the board, which didn't work. Once I shortened the cable to 15cm it worked. Now I'm always using B-type connectors, with an A->B cable, which hasn't caused me any problems yet.

Re: Atmega8 and v-usb (HIDKeys)

Posted: Thu Jun 16, 2011 4:23 pm
by 4ndreas
Try disable the UART
If i enable the (UCSRB, RXEN) my device is not detected
without the uart all works fine... my bee someone else can help.

Re: Atmega8 and v-usb (HIDKeys)

Posted: Tue Oct 11, 2011 4:25 pm
by herp derp
As far as I can see usb-tiny needs a 12MHz crystal !
I saw that too, the problem is that I don't have an 12Mhz @ the moment. Because I couldn't find the 12 Mhz value back in the code, I tought it wouldn't mather as long the crystal value would be higher then 12.

I'm going to try the V-USB code.phone Card Calling Cards

Thanks for the help! (so far Wink )