SEARCH
TOOLBOX
LANGUAGES
Register    Login    Forum    Search    FAQ

Board index » Electronics Projects » PIC18F USB development




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: PIC18f4550 Not USB Powered?
 Post Posted: Tue Feb 07, 2012 11:08 am 
Offline

Joined: Tue Feb 07, 2012 11:01 am
Posts: 4
Hello!

With regards to the tutorial at http://www.waitingforfriday.com/index.p ... USB_device , has anybody experienced the PIC not being powered by itself, but instead relying on power from the programmer?

When I plug in only the USB side (not the programmer), the LED will flicker slightly and go back off; even though I get +5V over the sides of the breadboard, I get nothing on the computer side.

Only when I provide some connection to the programmer does it work..

Oddly, at the same time, I see this output from the programmer in MPLAB IDE, if I cycle to select programmer > none and then back to PICkit 2:
Code:
Target power detected ( 4.99V)
PIC18F4550 found (Rev 0x7)
PICkit 2 Ready


After doing this cycling, the circuit no longer comes back on and the USB connection is lost...

Is this the typical case? Am I possibly connecting something wrong? I'm seeing no other problems to make me believe so, though...

Thanks for your thoughts!

PS: To Simon: that was a great and eminently readable guide; I really do appreciate it, and thanks very much!

Edit: I saw viewtopic.php?f=7&t=142 and tried it out... changing project > build configuration > debug to release, project > build all, programmer > program, but to no avail; I'm still seeing the same situation.


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Tue Feb 07, 2012 11:26 am 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
Take a look at this guide:

http://www.waitingforfriday.com/index.p ... nd_Windows

In there you will see two different ways to connect the chip. One is USB powered and the other is 'self' powered. If you want to use the device powered from the PICkit programmer you will need to build a circuit like the self-powered one shown however you don't need the 7805 to supply the 5Vs since that will come from the programmers +5V connection.

Note the way in which the USB's 5V power rail is not connected to the PICs +5Vs; instead it is connected to a 'bus sense pin' via a resistor so the PIC can detect when the USB is connected and disconnected.


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Tue Feb 07, 2012 11:33 am 
Offline

Joined: Tue Feb 07, 2012 11:01 am
Posts: 4
Simon Inns wrote:
Take a look at this guide:

http://www.waitingforfriday.com/index.p ... nd_Windows

In there you will see two different ways to connect the chip. One is USB powered and the other is 'self' powered. If you want to use the device powered from the PICkit programmer you will need to build a circuit like the self-powered one shown however you don't need the 7805 to supply the 5Vs since that will come from the programmers +5V connection.

Note the way in which the USB's 5V power rail is not connected to the PICs +5Vs; instead it is connected to a 'bus sense pin' via a resistor so the PIC can detect when the USB is connected and disconnected.


Thanks for the reply!

I do want to get the circuit to eventually be self powered (and, in fact, not run on USB at all); however, I'm just first a bit confused why it's not being bus-powered when I've built the bus-powered circuit on http://www.waitingforfriday.com/index.p ... USB_device (which looks almost identical to the bus-powered one on the page you posted).

It requires the PICkit 2 to even turn on, but doesn't seem to actually demand power according to the IDE. How can I get it to be completely self-sufficient?

Again, thanks, and great guide! (:


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Tue Feb 07, 2012 11:51 am 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
The bus-powered circuit should function perfectly without the programmer. If it doesn't then these are most likely the issues:

1) You have forgotten the 10K pull-up to +5Vs on the reset pin of the PIC (so it needs the programmer to pull it out of reset)

2) You have not connected all of the power pins on the PIC (both sides must always be connected) check the continuity of both the Gnd and +5Vs.

3) Your USB connection/cable is faulty and the 5Vs is not supplied from the host

4) You need 100nF decoupling capacitors near the power inputs to the PC (host supplied power can be noisy)

5) Your PIC is faulty; try another chip

My money is on (1) :)

/Simon


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Tue Feb 07, 2012 12:07 pm 
Offline

Joined: Tue Feb 07, 2012 11:01 am
Posts: 4
Simon Inns wrote:
The bus-powered circuit should function perfectly without the programmer. If it doesn't then these are most likely the issues:

1) You have forgotten the 10K pull-up to +5Vs on the reset pin of the PIC (so it needs the programmer to pull it out of reset)

2) You have not connected all of the power pins on the PIC (both sides must always be connected) check the continuity of both the Gnd and +5Vs.

3) Your USB connection/cable is faulty and the 5Vs is not supplied from the host

4) You need 100nF decoupling capacitors near the power inputs to the PC (host supplied power can be noisy)


Thanks for the information!

I've looked at both the 10K pull-ups, on pins 1 and 3, and they both look fine (I suppose the reset pin is 1).

I've checked the power pins with a multimeter and they're all seemingly connected fine...

I've connected a decent lab power supply to the +5 and ground rails, and still, it doesn't work without the programmer connected.

And I'm seeing the 100nF capacitors connected and I think they are all the way in the breadboard, although somewhat high right now (haven't clipped them).

So, I agree, it's most probably 1 and maybe 5. But, I'm pretty sure I've got the pull-up resistors in...

It's quite okay if USB-powered doesn't work, but it's another thing if reset doesn't work if I'm trying to make a standalone device. ):

If I short pin 1 with +5, I do see the LED come on, but it goes back off if I release.

Do you happen to have any other thoughts? I'd love to hear them. (:

Thanks!


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Tue Feb 07, 2012 1:16 pm 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
Does the led come on if you connect pin 1 with +5V via a 10K resistor? It should have the same effect (shorting it to +5V will just mean the programmer can't pull it to 0V). The PIC is 'running' when pin 1 is at 5Vs and in reset when pin 1 is at 0V.

If shorting it makes it run, then the reset is the issue.


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Wed Feb 08, 2012 12:04 am 
Offline

Joined: Tue Feb 07, 2012 11:01 am
Posts: 4
Simon Inns wrote:
Does the led come on if you connect pin 1 with +5V via a 10K resistor? It should have the same effect (shorting it to +5V will just mean the programmer can't pull it to 0V). The PIC is 'running' when pin 1 is at 5Vs and in reset when pin 1 is at 0V.

If shorting it makes it run, then the reset is the issue.


Ah, I'm ridiculous. I forgot that there's internal circuitry in the programmer, and unplugged the programmer only on the USB-computer side and not the programmer-circuit side. It's all fixed now; thanks very much!

However, now I've come across a different problem... The PIC is running the code fine, standalone bus-powered (for example, I modified the switch to turn on/off the LED), but now on the computer side, I'm no longer detecting the USB HID device.

On the visual studio program, I'm getting "USB Status unknown" in the status bar and "unknown" for both the LED state and the push-button state. I did disconnect everything before I left the bench yesterday, and rebooted my computer...

I'm not seeing Device Manager refresh devices like it normally does when I unplug/plug in a device, which is odd. Have you seen this behavior before? Perhaps it's something silly again, but perhaps you'd know? I've also tried changing the PID (but I haven't changed anything else USB-wise), so I'm not sure what's up...

Edit: Ah, it must be to do with my computer. Device manager does see it on a different computer. Is there something I can do flush my work computer back to... working?

Thanks very much for your time and thoughts!

Edit 2: Apparently my USB doesn't work fully (I suppose it's a power control thing) when I don't have AC power connected to my laptop.

Everything works fine now, if I remember to hit Programmer > Release from reset in the IDE with the programmer plugged in, and with the programmer completely away from the circuit, bus-powered mode works great .

Thanks so much, Simon!


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Wed Feb 08, 2012 6:51 am 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
Glad you got it figured out :)

IMHO the MPLAB IDE should show a far better representation of the programmers reset state. Making the icon go red when reset is being held would prevent this type of confusion (and yes I've done the same thing in the past too!).


Top 
 Profile  
 
 Post subject: PIC18f4550 Not USB Powered
 Post Posted: Tue Mar 13, 2012 2:14 pm 
Offline

Joined: Sun Feb 19, 2012 12:26 pm
Posts: 5
I have a usb device that requires more power when pluged into the zaurus. I still need to be mobile so Im wondering if there are any goot battery powered usb hubs out there that will add the extra power needed to allow powered usb devices to work? Does anyone know of any?


Top 
 Profile  
 
 Post subject: Re: PIC18f4550 Not USB Powered?
 Post Posted: Tue Mar 13, 2012 5:22 pm 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 893
If your designing something 'real' that needs to be self-powered by batteries then the battery and the battery management should be included in the design. However, you can get round it by using one of the many USB 'battery boosters' for mobile phones which you can charge via the USB port and then plug in a device and run it from the booster's battery supply.


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

Board index » Electronics Projects » PIC18F USB development


Who is online

Users browsing this forum: No registered users and 0 guests

 
 

 
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