General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
-
tombaugh
- Posts: 11
- Joined: Sat Nov 14, 2009 5:34 pm
Post
by tombaugh » Sat Nov 14, 2009 5:50 pm
I'm trying to use the LEDControl example, but it gives me "Could not find USB device LEDControl with vid=0x16c0 pid=0x5dc".
HARDWARE
I'm using an atmega8 with this configuration:
D- is connected to PD4
D+ is connected to PD2
oscillator is an external 12MHz
the LED is connected to PC5
the programmer is USBASP lite
FIRMWARE
main.c
Code: Select all
#define LED_PORT_DDR DDRC
#define LED_PORT_OUTPUT PORTC
#define LED_BIT 5
Makefile
Code: Select all
DEVICE = atmega8
F_CPU = 12000000 # in Hz
AVRDUDE = sudo avrdude -c usbasp -P /dev/ttyUSB0 -p m8 # edit this line for your programmer
fuse:
$(AVRDUDE) -U lfuse:w:0xff:m -U hfuse:w:0xd9:m
usbconfig.h
Code: Select all
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 4
#define USB_CFG_DPLUS_BIT 2
Any help or suggestion would be very welcome!
Last edited by
tombaugh on Sun Nov 15, 2009 11:31 pm, edited 1 time in total.
-
tombaugh
- Posts: 11
- Joined: Sat Nov 14, 2009 5:34 pm
Post
by tombaugh » Sat Nov 14, 2009 5:52 pm
I forgot to post the lsusb output:
Code: Select all
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 002: ID 16c0:05dc VOTI USBasp AVR Programmer
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:089d Logitech, Inc.
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard
Bus 003 Device 002: ID 045e:0084 Microsoft Corp. Basic Optical Mouse
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
edit:
I'm not sure if this is relevant, but I get a voltage of 3.06V between D- and GND.
edit:
this is what dmesg says
Code: Select all
[ 6236.730024] usb 5-2: new low speed USB device using ohci_hcd and address 80
[ 6236.880023] usb 5-2: device descriptor read/64, error -62
[ 6237.140025] usb 5-2: device descriptor read/64, error -62
[ 6237.391266] usb 5-2: new low speed USB device using ohci_hcd and address 81
[ 6237.540054] usb 5-2: device descriptor read/64, error -62
[ 6237.791277] usb 5-2: device descriptor read/64, error -62
[ 6238.070024] usb 5-2: new low speed USB device using ohci_hcd and address 82
[ 6238.491269] usb 5-2: device not accepting address 82, error -62
[ 6238.641267] usb 5-2: new low speed USB device using ohci_hcd and address 83
[ 6239.060022] usb 5-2: device not accepting address 83, error -62
[ 6239.060051] hub 5-0:1.0: unable to enumerate USB device on port 2
edit:
the zeners I'm using are BZX55C3V6 (500mW)
-
maxi
- Rank 3
- Posts: 122
- Joined: Fri Jul 24, 2009 6:13 pm
Post
by maxi » Sun Nov 15, 2009 4:27 pm
Can't see anything obvious myself but I'm guessing it's a hardware issue. Those zeners should be ok though, I'm pretty sure they're the same ones I use. Perhaps you could provide a bit more info about your setup, eg. is it on breadboard? can you post a photo of it? Might also be helpful to know which linux distro/version it is or if you have tried it on any other platforms?
-
tombaugh
- Posts: 11
- Joined: Sat Nov 14, 2009 5:34 pm
Post
by tombaugh » Sun Nov 15, 2009 5:26 pm
It's on a breadboard. I already thought of making some pictures, I'll post them later today. I'm using Ubuntu 9.10, but I also tried my netbook which runs Ubuntu 9.04, without success. I also tried 3.3V zeners and I added capacitors but that didn't help either.
-
maxi
- Rank 3
- Posts: 122
- Joined: Fri Jul 24, 2009 6:13 pm
Post
by maxi » Sun Nov 15, 2009 5:41 pm
tombaugh wrote:I added capacitors but that didn't help either.
The feedback caps on the crystal are IMO essential for this type of application, check the datasheet to be sure you're using the optimal values. There should also be some filter caps across the supply, I usually go for 100n & 4u7 though this is less critical.
<edit />Since your USBasp programmer works I think we can rule out OS probs, as that is V-USB based.
-
maxi
- Rank 3
- Posts: 122
- Joined: Fri Jul 24, 2009 6:13 pm
Post
by maxi » Sun Nov 15, 2009 10:09 pm
Ok, try putting the zeners on the other side of the 68R series resistors and see if that helps.
-
tombaugh
- Posts: 11
- Joined: Sat Nov 14, 2009 5:34 pm
Post
by tombaugh » Sun Nov 15, 2009 10:20 pm
maxi wrote:Ok, try putting the zeners on the other side of the 68R series resistors and see if that helps.
No effect unfortunately...
-
maxi
- Rank 3
- Posts: 122
- Joined: Fri Jul 24, 2009 6:13 pm
Post
by maxi » Sun Nov 15, 2009 10:35 pm
Hmm, it's difficult to tell from the photo but it looks to my like you might not have connected D+/- to the correct pins on the uC. If it's not that then I'm afraid I can't help.
Perhaps someone a bit more linux savvy can glean more from the dmesg output.
-
tombaugh
- Posts: 11
- Joined: Sat Nov 14, 2009 5:34 pm
Post
by tombaugh » Sun Nov 15, 2009 11:31 pm
maxi wrote:Hmm, it's difficult to tell from the photo but it looks to my like you might not have connected D+/- to the correct pins on the uC. If it's not that then I'm afraid I can't help.
Perhaps someone a bit more linux savvy can glean more from the dmesg output.
In fact, I moved the D- wire from pin 3 to 4 and changed this line accordingly:
I'll correct this in my first post.
-
maxi
- Rank 3
- Posts: 122
- Joined: Fri Jul 24, 2009 6:13 pm
Post
by maxi » Mon Nov 16, 2009 12:51 am
Ok going back to the OP you now say you have D- connected to PD4. D- should be connected to INT0 (Pin 4 PD2) unless otherwise specified in usbconfig.h.
Looking at the photo again I think you may simply have D+ and D- the wrong way round.
<edit /> Sorry my mistake D+ should be connected to the interrupt
-
Guest
Post
by Guest » Mon Nov 16, 2009 3:30 pm
Could the length of the wiring and the fact that I'm using a breadboard be a problem? Too bad there aren't any V-USB kits available...
-
Grendel
- Rank 4
- Posts: 167
- Joined: Sat Dec 16, 2006 9:53 pm
- Location: Oregon, USA
-
Contact:
Post
by Grendel » Tue Nov 17, 2009 12:55 am
Try replacing the 47uF w/ a 4.7uF cap, remove the 2nd elca, and change the lfuses to 0x1f. I also would also suggest to put the diodes/resistors on the data lines as close to the MCU as possible and get rid of the long wires after the USB connector -- your flourescent lamps will wreck havoc w/ the signals..
-
tombaugh
- Posts: 11
- Joined: Sat Nov 14, 2009 5:34 pm
Post
by tombaugh » Fri Nov 20, 2009 1:45 am
Grendel wrote:Try replacing the 47uF w/ a 4.7uF cap, remove the 2nd elca, and change the lfuses to 0x1f. I also would also suggest to put the diodes/resistors on the data lines as close to the MCU as possible and get rid of the long wires after the USB connector -- your flourescent lamps will wreck havoc w/ the signals..
I now put everything on one breadboard and changed the lfuse. The cap is still 10µF, but tomorrow I should have some 4.7µF caps. For the moment, this new setup doesn't work...
edit: I also changed the fuses to 0x9F and 0xC9 as detailed in the Makefile, no result.
-
Saimon
Post
by Saimon » Fri Nov 20, 2009 4:34 pm
As i remember, mega8 use #reset pin combined with another some port pin. May be use forget to pull-up reset or configure it wrong?
Best regards, Saimon!