USB Device not recognized

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

USB Device not recognized

Post by solata10 » Sun Dec 13, 2009 3:19 pm

i get this error when i plug my device to usb ....

USB Device not recognized.
One of the usb devices attached to this computer has malfunctioned ...
---------------



the device is like this : [[ http://www.google.si/url?sa=t&source=we ... phqnaM-pFQ ]]

(you can find shcematics on page 6)

-> i could sucesfuly connect device to LPT port and program it using avrdude. everything went ok (bytes were read out, and compared to what was written, sucesful)
-> when i connect it to usb i get the error message described above.

so something is obviously wrong. first, i have a question about where could the problem be ...
if i could sucesfuly program the device, then all the pins connected to ISP are OK. also the VCC, AVCC, AREF and XTAL pins should be ok right ?
as else i wouldnt be able to program the device=? am i right on this one ? or is it possible to program device, even if connection of crystal oscilator isnt ok ?
so if the above is true, then problem can only be within P1 and P2 (D- and D+ of usb) ?

i checked all the wires and there seems to be no short circuits, all connections work, but, when i measure voltage on Vdd and D- i get something like 7.6 V ....
isnt this a little bit too high for usb ? it should be like 3.3 ? or 5 ? could this be the reason for the problems ?

sorry for posting here, as the software is not V-USB, but its very similar i guess, and i couldt get any support elsewhere.
thanks

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: USB Device not recognized

Post by maxi » Sun Dec 13, 2009 3:51 pm

Since the device does not appear to be self-powered I cannot understand where the 7.6 Volts are comming from. You did detach the isp before plugging it into the usb port didn't you? At a guess I'd say the problem is lack of proper level conversion, whilst this setup may work on some systems it will fail on others. See http://vusb.wikidot.com/hardware

BTW This software is V-USB based. See the sticky http://forums.obdev.at/viewtopic.php?f=8&t=2661

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Sun Dec 13, 2009 10:34 pm

hey. yes i detached it from the programming cable.
i'm a little bit confised to. where do i get 7.6 V, if it should be 5 ?
that way even solutions published on a wiki page wouldnt work (well atlest not solutions under B)

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: USB Device not recognized

Post by maxi » Mon Dec 14, 2009 1:45 am

solata10 wrote:i'm a little bit confised to. where do i get 7.6 V, if it should be 5 ?


I would question the measuring device in this case. Try measuring the output from your usb port without the device connected, if it is 7.6V then you have some serious problem.

I'd say it's more likely 5V and solution B would be the way to go, just add a couple of 3v6 zenners and maybe swap the 2k2 resistor for a 1k5 (2k2 should work though). Also I wonder did you set the fuses correctly as you do not mention this in your initial post.

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Mon Dec 14, 2009 11:14 am

i set fuses exactly as described in pdf pasted above. avrdude said it was sucesful. i will try to add zener diodes.

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Mon Dec 14, 2009 11:18 am

i tried measuring voltage on usb port (without device connected. its in the range fro 7.6 till 8V.
i also measured it on another computer, and got the same results.
then i measured the voltage on standard AA battery, got a reading of 2.2V (it should be 1.5 right?)
so i'm guesing my measuring equipment isnt realy precise.

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: USB Device not recognized

Post by maxi » Mon Dec 14, 2009 7:43 pm

Good quality, high power type AA batteries can give out as much as 2V when they're new, although I think it would be too much of a coincidence for both computers to be reading 8V. You don't by any chance have your meter set to AC?

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Tue Dec 15, 2009 2:51 pm

i changed the batery in my multimeter, and now it shows 5.2V output of usb
and after i connected the 3.6V zener diodes i have 3.0V on D-

however its still not working.
i will try to assemble new circuit, with just one led and will try to run hid-custom-rq (from v-usb examples folder)
i will post my results.

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Tue Dec 15, 2009 3:10 pm

ok here is schematics for my current board.

http://www.yousendit.com/download/MVNlc ... UjdIRGc9PQ

notice that i changed chip to atmel 8535.
i am trying to run the hid-custom-rq from examples folder of latest v-usb
only changed i made are :

main.c : line 19 (changed the port the led is connected to)
#define LED_PORT_DDR DDRB
#define LED_PORT_OUTPUT PORTB
#define LED_BIT 0

usbconfig.h: line 26 (changed the port nad pins where D+ and D- are connected)
#define USB_CFG_IOPORTNAME B
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 1

Makefile: line 10 (changed the device)
DEVICE = atmega8535

i compiled the code, uploaded to my device, and set the fuses to : LFUSE: 0xff HFUSE: 0xC9

when i connect the device, i still get the same error, usb device malfunctioned. voltage on Vdd : 5.2V, voltage on D- : 3.0V

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Tue Dec 15, 2009 5:15 pm

is there some simple firmware i can put on my device which will show if anything on the device side is ok ? (like turn on a led, if usb initialization is ok, and then blink the led if code is executing)
i tried puting this in my main.c just before for(;;) in int main() :

_delay_ms(5000);
LED_PORT_OUTPUT |= _BV(LED_BIT);
_delay_ms(5000);
LED_PORT_OUTPUT |= ~_BV(LED_BIT);

however its not working. when i plug my device in usb it takes 5 second till i get the "device connected sound", and then i get "device disconected sound" right after it.

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Tue Dec 15, 2009 7:48 pm

ok i've been playing with that blinking led addon to the code, and i managed to make it work,
LED_PORT_OUTPUT |= _BV(LED_BIT);
turns the led on sucesfuly, however when i try to "sleep" for a second, then nomather, if i use
_delay_ms(1000);
or if i use for (i = 0; i< 99999; i++) a = 0;
the program seems to reset itself.

LED_PORT_OUTPUT |= _BV(LED_BIT);
_delay_ms(1000);
for (;;) .....

led turns on, stays on for a while ( 1 second ), then the board seems to be reset (led turns off, and then it turns on again right away)
i get the same behaviour even if i increase the delay.

is this ok ? does v-usb have some settings for this behaviour ? or do i have a problem ?

solata10
Posts: 13
Joined: Sun Dec 13, 2009 3:09 pm

Re: USB Device not recognized

Post by solata10 » Tue Dec 15, 2009 8:40 pm

ok solved, the device was not recognized, becouse i didnt set the frequency of device correctly.
Makefile:

F_CPU = 12000000

Post Reply