Atmega8 and v-usb (HIDKeys)

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Nussi
Posts: 3
Joined: Fri Apr 15, 2011 8:43 pm

Atmega8 and v-usb (HIDKeys)

Post by Nussi » Fri Apr 15, 2011 8:53 pm

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 :)

Nussi
Posts: 3
Joined: Fri Apr 15, 2011 8:43 pm

Re: Atmega8 and v-usb (HIDKeys)

Post by Nussi » Sat Apr 16, 2011 1:09 pm

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

Daid

Re: Atmega8 and v-usb (HIDKeys)

Post by Daid » Sat Apr 16, 2011 5:33 pm

Did you configure the fuses to use the crystal? By default the ATMega8 runs on internal 1Mhz.

Nussi
Posts: 3
Joined: Fri Apr 15, 2011 8:43 pm

Re: Atmega8 and v-usb (HIDKeys)

Post by Nussi » Sat Apr 16, 2011 5:56 pm

Daid wrote:Did you configure the fuses to use the crystal? By default the ATMega8 runs on internal 1Mhz.


Sure! I double checked this! :)

Daid
Rank 2
Rank 2
Posts: 55
Joined: Mon Apr 18, 2011 12:19 pm

Re: Atmega8 and v-usb (HIDKeys)

Post by Daid » Mon Apr 18, 2011 1:22 pm

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.

4ndreas
Posts: 1
Joined: Thu Jun 16, 2011 4:22 pm

Re: Atmega8 and v-usb (HIDKeys)

Post by 4ndreas » Thu Jun 16, 2011 4:23 pm

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.

herp derp
Posts: 1
Joined: Tue Oct 11, 2011 4:23 pm

Re: Atmega8 and v-usb (HIDKeys)

Post by herp derp » Tue Oct 11, 2011 4:25 pm

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 )

Post Reply