View previous topic :: View next topic |
Author |
Message |
curt2go
Joined: 21 Nov 2003 Posts: 200
|
16F1937 and sleep current.. |
Posted: Wed Mar 30, 2011 8:32 am |
|
|
I switched from an 887 to 1937. The 887 would go to 2uA but the lowest I can get the 1937 is 40uA. Is there something I am doing wrong?
Code: |
#FUSES INTRC_IO //Internal RC Osc
#FUSES NOPUT //No Power Up Timer
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#FUSES WRT //Program memory not write protected
setup_timer_1(T1_INTERNAL | T1_DIV_BY_1 );
setup_comparator(NC_NC_NC_NC);//
setup_oscillator(OSC_31KHZ);
top:
sleep();
goto top; |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 30, 2011 6:01 pm |
|
|
Look at your #fuses at the bottom of the .LST file and see what the
compiler enables by default. At least one of them will be the problem.
Hint: It starts with a "B". |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Thu Mar 31, 2011 3:04 pm |
|
|
I had no idea that the Brownout detect took that much power.... Thanks ... |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Thu Mar 31, 2011 3:25 pm |
|
|
Still only getting down to 22uA... Should still see around 1uA... Usually dont have issues with this part.. Any more help would be appreciated.. Thanx |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 31, 2011 3:33 pm |
|
|
How are you measuring the current ? Is the PIC on a board by itself,
or are there external circuits on the board ? Are you sure it's not caused
by voltage regulator quiescent current, or a pull-up or pull-down resistor, etc. |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Fri Apr 01, 2011 7:53 am |
|
|
There is nothing else on the board. I have even tried putting all the outputs low.. I have tried looking at the current on 2 devices and they show the exact same.. I am sure its something dumb I just cant figure it out.. Thanx for sticking with me.. TTY |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Apr 01, 2011 8:28 am |
|
|
Have you forced all pins to be either high or low ?
internal pullups 'enabled' by mistake ?
disabled ADC ?
some internal peripheral not disabled ?
pull the PIC and measure quiescent current, should be zero.... |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Fri Apr 01, 2011 11:32 am |
|
|
tried all of that... with an 887 without issue i can get less than 1uA... I know its going to be something dumb.. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Apr 01, 2011 12:18 pm |
|
|
FVR enabled ????
getting mighty slim pickins for why !! |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Fri Apr 01, 2011 1:11 pm |
|
|
remote device. Its battery powered... the difference between 20uA and 5uA could be 2 years on a battery.. Here is the fuses...
Configuration Fuses:
Word 1: 09A4 INTRC_IO NOWDT NOPUT NOMCLR NOPROTECT NOCPD NOBROWNOUT NOCLKOUT NOIESO NOFCMEN
Word 2: 18FF NOWRT NOVCAP PLL_SW NOSTVREN BORV25 NODEBUG NOLVP |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Apr 01, 2011 2:09 pm |
|
|
Use a battery with greater capacity ?
Cheaper to spend a buck on a better battery than 1,000s on R&D !
Been down that road a few times....
I know it's a nagging you, but you might have to move on..... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 01, 2011 2:18 pm |
|
|
I think I found the problem. If you use the NOMCLR fuse, the MCLR pin
is configured as input pin. But because that pin is "input only", you can't
set to be a low-level output pin, like you can with all the others. So it's
floating, and this causes massive current consumption in Sleep mode.
On my test board, the 16F1937 uses 95ua if MCLR is floating, and 15ua
if I put a 10K pull-up on it. (The pull-up size doesn't matter. It still uses
15ua if I put 100K pull-up on it).
According to this section of the data sheet, the typical Sleep current is
19ua when running at 5v.
Quote: | 30.3 DC Characteristics: PIC16F/LF1934/36/37-I/E (Power-Down)
PIC16LF1934/36/37
|
So the solution is, whether you use the MCLR or NOMCLR fuse, you must
have a pull-up resistor on the MCLR pin.
I tested this on a 5v board, with CCS vs. 4.119. Here's the test program.
The output_high(PIN_B0) line allows me to watch pin B0 with my scope
and to be sure that the PIC "really" is in Sleep mode. I.e., Pin B0 will be
low if stays in sleep mode. It's just a safety check during testing.
Code: |
#include <16F1937.h>
#fuses INTRC_IO,NOWDT,NOBROWNOUT,NOPUT,NOMCLR
#use delay(clock=4M)
//===========================
void main()
{
// Setup unused pins for low current drain in sleep mode.
output_a(0);
output_b(0);
output_c(0);
output_d(0);
output_e(0);
sleep();
output_high(PIN_B0);
while(1);
} |
Last edited by PCM programmer on Fri Apr 01, 2011 2:31 pm; edited 2 times in total |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Apr 01, 2011 2:29 pm |
|
|
MCLR/PIN_E3 is equipped with a programmable pull-up at 16F1937, I think. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 01, 2011 2:43 pm |
|
|
You're right. Here's a revised program that turns on the MCLR pin pullup.
The port_e_pullups() function isn't implemented on vs. 4.119 apparently,
so I made a function to do it. I still get 15ua sleep current.
Code: |
#include <16F1937.h>
#fuses INTRC_IO,NOWDT,NOBROWNOUT,NOPUT,NOMCLR
#use delay(clock=4000000)
void enable_MCLR_pullup(void)
{
#byte OPTION = 0x95
#bit WPUEN = OPTION.7
#byte WPUE = 0x210
#bit WPUE3 = WPUE.3
WPUEN = 0; // Global weak pull-ups enabled
WPUE3 = 1; // MCLR pull-up enabled
}
//===========================
void main()
{
enable_MCLR_pullup();
output_a(0);
output_b(0);
output_c(0);
output_d(0);
output_e(0);
sleep();
output_high(PIN_B0);
while(1); |
|
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Fri Apr 01, 2011 2:53 pm |
|
|
You are right i can get to 18uA but that is at 3v as well.. I thought this part was suposed to be XLP... I can get and 887 to 1uA without and issue on the exact board.. Should I be using a differnt part?
Bigger battery is not an option. I need to get away with coin cells on some of them.. |
|
|
|