Page 1 of 2

problem with LEDControl example

Posted: Sat Nov 14, 2009 5:50 pm
by tombaugh
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:

Image

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!

Re: problem with LEDControl example

Posted: Sat Nov 14, 2009 5:52 pm
by tombaugh
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)

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 4:27 pm
by maxi
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?

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 5:26 pm
by tombaugh
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.

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 5:41 pm
by maxi
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.

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 9:51 pm
by tombaugh
Here are a few pictures. The caps near the microcontroller and between the supply lines are 100nF and 47µF, not sure if there's any point in adding them twice though. The caps on the crystal are 22pF as required. Let's hope this brings to light an embarassing mistake...

Image
Image
Image
Image

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 10:09 pm
by maxi
Ok, try putting the zeners on the other side of the 68R series resistors and see if that helps.

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 10:20 pm
by tombaugh
maxi wrote:Ok, try putting the zeners on the other side of the 68R series resistors and see if that helps.


No effect unfortunately...

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 10:35 pm
by maxi
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.

Re: problem with LEDControl example

Posted: Sun Nov 15, 2009 11:31 pm
by tombaugh
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:

Code: Select all

#define USB_CFG_DMINUS_BIT      4


I'll correct this in my first post.

Re: problem with LEDControl example

Posted: Mon Nov 16, 2009 12:51 am
by maxi
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 :oops:

Re: problem with LEDControl example

Posted: Mon Nov 16, 2009 3:30 pm
by Guest
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...

Re: problem with LEDControl example

Posted: Tue Nov 17, 2009 12:55 am
by Grendel
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..

Re: problem with LEDControl example

Posted: Fri Nov 20, 2009 1:45 am
by tombaugh
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...

Image
Image

edit: I also changed the fuses to 0x9F and 0xC9 as detailed in the Makefile, no result.

Re: problem with LEDControl example

Posted: Fri Nov 20, 2009 4:34 pm
by Saimon
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!