SEARCH
TOOLBOX
LANGUAGES
Register    Login    Forum    Search    FAQ

Board index » Electronics Projects » General Project Questions




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: USBDeviceState enters endless loop
 Post Posted: Wed Apr 25, 2012 8:11 am 
Offline

Joined: Tue Apr 24, 2012 1:32 pm
Posts: 3
Location: Pretoria, South Africa
Hi, I am having a problem with the PIC18f4550 USB project. I built circuit the same way as shown on the project here on WFF and I am also using the project firmware files. I program the target device and on attach to system, the device LED turns on to show the device is working but the host system does virtually nothing - not even the "USB Device not recognized" message comes up at all. So I debugged the firmware using the PicKit2 and MPLab.

There I discovered that the firmware is working but the reason why the device is never picked up by the host is because it somehow gets stuck looping through USTAT FIFO empty - which is experienced when USBDeviceState becomes 0x04. Last night USBDeviceState became 0x01 but somehow according to comments the program executed code for when it receives an unknown command from the host. It did this after I let it sit for a couple of minutes, I left it on a bit because there is a note that the device may take sometime to set itself up because the internal pull-up resistors might take some time to get sorted.

But in the end, the program just keeps looping between USBDeviceState being either 0x04 or 0x01. I would like to know, what might I be missing that's causing this issue? My main aim is to build a 10 button gamepad and I am using this to learn USB HID device building. Any help is highly appreciated as this is a crucial school project.

Many thanks.


Top 
 Profile  
 
 Post subject: Re: USBDeviceState enters endless loop
 Post Posted: Wed Apr 25, 2012 8:57 am 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
Hi

If you are using the circuit and the firmware from the project then the most likely issue is that you have a hardware problem.

Start by ensuring that the USB cable is wired correctly (some have incorrect colour coding) and then verify the VUSB capacitor is the correct value. If this doesn't help you will need to check your circuit part by part for a mistake.

Since the project has been used so many times it is unlikely that the issue is with the design or the firmware itself. If you can't find the issue get back to me and I will try to help.

Regards
/Simon


Top 
 Profile  
 
 Post subject: Re: USBDeviceState enters endless loop
 Post Posted: Thu May 10, 2012 9:20 am 
Offline

Joined: Tue Apr 24, 2012 1:32 pm
Posts: 3
Location: Pretoria, South Africa
Hi, thank you very much for the advice. :D

I would like to know, what type of capacitors are being used for the VUSB and the GND and Vdd pins? :ugeek:


Top 
 Profile  
 
 Post subject: Re: USBDeviceState enters endless loop
 Post Posted: Thu May 10, 2012 5:09 pm 
Offline

Joined: Thu Sep 22, 2011 2:35 am
Posts: 77
Location: Carlisle England
Simons circuit uses 470nF for Vusb and power suplly decoupling.

I have used Simons project as the basis for two of my own projects and had no problems so as Simon says it is your hardware that has a problem.


Top 
 Profile  
 
 Post subject: Re: USBDeviceState enters endless loop
 Post Posted: Fri May 11, 2012 6:31 am 
Offline

Joined: Tue Apr 24, 2012 1:32 pm
Posts: 3
Location: Pretoria, South Africa
Hi Nigel, thank you. The problem is indeed with my hardware, that is why I am asking about the type of capacitors used in the circuit, particularly on the VUSB pin. My current capacitor for some odd reason was causing my circuit not to work properly, when I tested it using a multimeter, the host system began recognizing and unknown USB device so I am thinking that my capacitor type may be an issue. I read a bit on the effects of capacitors in a circuit and I think this may be an issue.

So yes, which capacitor type were you using in your circuit? I have ceramic, which is the standard or most common type.


Top 
 Profile  
 
 Post subject: Re: USBDeviceState enters endless loop
 Post Posted: Fri May 11, 2012 4:33 pm 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
The VUSB was a 470nF polyester cap. This can actually be between 220nF and 470nF.

The rest of the decoupling caps are 100nF polyesters, so basically the same thing.

Hope this helps!


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 6 posts ] 

Board index » Electronics Projects » General Project Questions


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Translated by MaĆ«l Soucaze © 2009 phpBB.fr