View previous topic :: View next topic |
Author |
Message |
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
18F45K50 sleep mode |
Posted: Fri May 22, 2015 8:13 am |
|
|
Hi all
I try to put my 18F45K50 in sleep mode but I can't get it under 100uA.
My schematic is really basic regulator 3.3V (17uA Quiescent Current) and the Pic. I have a 5K on MCLR and that's all.
This is my try code
Code: |
#include <18F45K50.h>
#fuses NOWDT
#fuses INTRC // Internal RC Osc
#fuses NOICPRT
#fuses PUT
#fuses ICSP1
#fuses NOCPUDIV
#fuses NOFCMEN
#fuses NOIESO,NOBROWNOUT
#fuses NOLPBOR
#fuses NOMCLR,NOSTVREN,NOLVP
#fuses NOXINST,NODEBUG,NOPROTECT
#fuses NOCPB,NOCPD,NOWRT,NOWRTC,NOWRTB
#fuses NOWRTD,NOEBTR,NOEBTRB
void main() {
setup_oscillator(OSC_31KHZ|OSC_INTRC);
output_A(0);
output_B(0);
output_C(0);
output_D(0);
output_E(0);
sleep(SLEEP_FULL);
}
|
But I can get it down to 100uA. Did I miss something ?
Thanks in advance |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 22, 2015 2:17 pm |
|
|
Post a link to your schematic. Post the part number of your voltage
regulator. Post your compiler version.
How to post an image on the CCS forum:
Go to this website: http://postimage.org/
Upload your image. Select family safe. Then click the first button for
"Hotlink to Forum" to get a link to the image.
Then go to the CCS forum and type Ctrl-V to paste the link into a post.
If postimage.org doesn't work in your country, then use Google to find
another free image hosting site for forums. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Sun May 24, 2015 1:16 am |
|
|
Some further questions/comments:
Do you intend to use USB?.
If so, how are you going to power the USB?.
If you intend to run the chip off 3.3v, then you need to be looking at the LF, not F part. The F can't run the USB off 3.3v. With the F part, the USB requires more than about 4.2v, to run the USB Vreg. The chip itself (without USB) can operate off 3.3v, but needs to switch to using a (near) 5v supply to run USB.
So it can 'run' off 3.3v, but then needs power switching circuitry to switch to using Vusb, when you want to use USB. If you want to run off 3.3v as the main supply to the chip, the LF part has to be used. On this, Vusb can be fed off the 3.3v. You need the capacitor on the Vusb pin. Otherwise this can oscillate and result in unexpected power consumption. People have run the F part and fed 3.3v into Vusb, but this draws more power than the LF part, and is not really a 'legal' setup....
Then separately, there are several peripherals that may well be running. Turn off things like the comparator, Vref, DAC, etc. etc.. |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Mon May 25, 2015 5:53 am |
|
|
Hi all
thanks for your support.
So first my schematic
regulator datasheet.
http://www.ti.com/lit/ds/symlink/tps770.pdf
Compiler version 5.045
I will use Usb has a input so the power will come in from the USB. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Mon May 25, 2015 8:32 am |
|
|
hmm.. you've got the enable pin of the regulator essentially 'floating' with a 3M9 resistor as shown. It should be tied to ground to function correctly.
ANY EMI or 'noise' and the enable pin will turn on/off the regulator at random intervals.
This maybe( is?) the source of your excessive current draw as the PIC will power up/down/???.
I'd tie it to ground, get rid of the resistor and see what happens.
Jay |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Mon May 25, 2015 8:46 am |
|
|
Hi Jay
I try it but no changes.
The regulator is working fine I'm measuring 18uA with only the regulator. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Mon May 25, 2015 1:22 pm |
|
|
So how do you intend to switch to power from the USB?. Since it is the processor's Vdd that has to go up, to power the USB regulator, your regulator would potentially have 5v on it's output....
You need to re-think the circuit significantly.
You should not be reading 18uA 'with only the regulator'. It should only be a couple of uA _max_. That the current is so high suggest the regulator is oscillating....
17uA, is the regulator consumption _when delivering 50mA_.
They recommend a 4.7 to 10uF low ESR capacitor for the output. Not '0.1uF'....
From the data sheet:
"The minimum recommended capacitance is 4.7 μF".
Beware also though that if the ESR is very low (< pehaps 0.2R), then you may need a series resistor to ensure stability..... |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Mon May 25, 2015 2:19 pm |
|
|
Hi Ttelmah
Your right my capacitor value is wrong but it's not the problem.
I have try to remove all the regulation circuit and power up the PIC directly at 3.3v and I still have this 100uA. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 25, 2015 5:34 pm |
|
|
You are using the "F" PIC, not the "LF" one. The 18F45K50 data sheet
says in section 2.4, on page 25:
Quote: | - F devices permanently enable the voltage regulator. |
Voltage regulators have a quiescent current. I can't find a spec for it
in the 18F45K50 data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/30000684B.pdf |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 25, 2015 6:34 pm |
|
|
I breadboarded an 18F45K50. My circuit has minor differences from yours.
I'm using a single 10K resistor on MCLR instead of your circuit. I'm also
using three 0.1 uF capacitors on the Vusb3v3 pin, which gives 0.3 uF total.
I also have 0.1 uF capacitors (to ground) on both of the PIC's Vdd pins.
I'm also using a bench power supply to provide 3.3v to power the PIC.
I have an ammeter stuck between the bench power supply and the
breadboard. You can see from the attached photo that it reads 9.6 ua.
I have the Pickit 3 detached from the breadboard when measuring the
sleep current.
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Tue May 26, 2015 12:48 am |
|
|
Well done. The obvious test...
I had suspected that in fact his regulator is oscillating. Hence the high current with no load, and the even higher current with load.
On the regulators, it gets more complex. There are _two_ regulators in the F chips. The supply regulator (which allows the chip to be operated from voltages above 3.6v), and the USB regulator. Both are permanently enabled. The USB regulator only draws any measurable current, when the transceiver is enabled, and the supply goes above about 4v, _unless_ the Vusb capacitors are missing/inadequate, when it too can start to oscillate. The consumption of the supply regulator, is given 'by implication' only, in power down base current figures at the same supply voltage. Your chip PCM_programmer seems to be drawing a little less than expected here.
If he switched to the 3.3v device, we are talking at least a 100* reduction in the sleep current when asleep.
Generally the original system, is short of smoothing everywhere. Minimum should be perhaps, 4.7uF at the regulator, then another couple of 0.1uF's close by at the PIC, then 0.22uF at the Vusb pin. It's interesting that PCM_programmer's consumption is 'as expected', with his smoothing. Also the question of how supply lines are actually routed. Note how he has decoupling right by the PIC, and decoupling across the breadboard supply rails. |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Tue May 26, 2015 6:46 am |
|
|
Thanks for your support.
I will continue to make test because even with the same setup as you the current still stay at 100uA.
edit:
I finally find a trouble, I connect no use pin to Gnd.
Last edited by in_nursery on Tue May 26, 2015 7:40 am; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Tue May 26, 2015 7:12 am |
|
|
You _are_ disconnecting the programmer when testing?. |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Tue May 26, 2015 7:42 am |
|
|
yes.
When I disconnect no use pin from Gnd I get 9.9uA.
I use the TQFP package and the pin 33 is only an input. |
|
|
|