View previous topic :: View next topic |
Author |
Message |
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
PIC16f1823 and consumption during sleep |
Posted: Mon Jan 15, 2018 8:15 am |
|
|
dear everyone,
I have made a very little circuit on a dev_board for playing with sleep/deepsleep and watchdog wake up.
My pcb wake up correctly every Xseconds but i have question about the electrical consumption.
In sleep mode, the consumption is around 23uA. It'seem not to be normal when i compare with the datasheet.
Code: |
#device PIC16f1823
#include <16f1823.h>
#fuses NOPROTECT
#fuses WDT
#use delay(internal=8000000)
//------------------------------------------------
void main(void)
{
setup_oscillator(OSC_8MHZ);
setup_wdt(WDT_OFF);
printf("Bonjour\n\r");
setup_wdt(WDT_8S);
setup_wdt(WDT_ON);
sleep();
RESET_CPU();
}
//------------------------------------------------
|
See my code above. If somenone see a big mistake.... i will be happy |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Mon Jan 15, 2018 9:01 am |
|
|
There are a standard set of comments about this:
1) Are _all_ inputs tied to something?. Either driven by the PIC to an idle state, or driven by an external circuit. Floating inputs will result in extra power being drawn.
2) Are you measuring the actual PIC consumption?. Remember things like regulators themselves draw power.
3) You probably have BOR enabled, since it is not being turned off in your fuses.
A search here will find quite a few threads about other things, but these are the first main ones. |
|
|
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
|
Posted: Mon Jan 15, 2018 10:11 am |
|
|
Thanks for your rapid reply.
I have made two things:
> Changed by board, now ONLY 16f1823/Prog Connector/MCLR resistor (I cannot make less minimal). there is no regulator, supply directly by a laboratory power supply (3.0v).
> Modified my code...
Code: |
#device PIC16f1823
#include <16f1823.h>
#fuses WDT,PUT,INTRC_IO,NOMCLR,NOLVP,NOBROWNOUT,NOPROTECT
#use fast_io(A)
#use fast_io(C)
#use delay(internal=4000000)
//------------------------------------------------
void main(void)
{
setup_wdt(WDT_OFF);
delay_ms(500);
output_low(pin_a0);
output_low(pin_a1);
output_low(pin_a2);
//output_low(pin_a3); // MCLR PIN (200k)
output_low(pin_a4);
output_low(pin_a5);
output_low(pin_c0);
output_low(pin_c1);
output_low(pin_c2);
output_low(pin_c3);
output_low(pin_c4);
output_low(pin_c5);
setup_wdt(WDT_4S);
setup_wdt(WDT_ON);
sleep();
delay_cycles(1);
RESET_CPU();
}
//------------------------------------------------
|
The pads for external conponents are free... every I/O from pic are tied to gnd by program.
My consumption is 19uA....
An idea ? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Jan 15, 2018 10:22 am |
|
|
you also need to disable all internal peripherals that may be on any pin.
such as
ADC
Comparators
UARTs
timers
While I don't use that PIC, today's PICs usually have 2,3 or MORE peripherals available on any/every pin !!
Unless these are disabled, they will draw 'some' power.
Also what VDD are you using? The ultra low power specs tend to be at say 2 or 3 volts not 5 volts. That information will be in the datasheet, usually there's a chart or 2, try 'electrical specs'...
Jay |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Mon Jan 15, 2018 10:49 am |
|
|
Are you turning off the clock while you're going to sleep? What clock is driving the watchdog? If it's a fast clock, can you substitute a slower clock source?
Can you disable the clock altogether (watchdog too), and wake upon an external event (button press)? Your current consumption will be much smaller if you do. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 15, 2018 11:03 am |
|
|
temtronic, He said he's using 3.0v from a lab power supply.
-------------------
Look at the 16F1823 data sheet, in this section on page 330:
30.3 DC Characteristics: PIC12(L)F1822/16(L)F1823-I/E (Power-Down)
http://ww1.microchip.com/downloads/en/DeviceDoc/40001413E.pdf
The sections that are in gray are for the standard "F" part.
It says that for 3.0v, the typical power-down current is 22 ua, for
the following conditions:
Quote: | WDT, BOR, FVR, and T1OSC disabled, all Peripherals Inactive |
22 ua is about what you are seeing. This is correct.
If you look at the non-grayed section, you will see a very low current
of 0.03 ua (30 nano-Amps). But this is for the "LF" version.
The "LF" version in the more modern PICs is not just a slightly better
power-down version. It's a lot better. You need to buy the "LF" chip. |
|
|
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
|
Posted: Mon Jan 15, 2018 11:06 am |
|
|
i have add these lines before sleep() but nothing more..
Code: |
setup_timer_1(T1_disabled);
setup_vref(VREF_OFF);
setup_dac(DAC_OFF);
setup_adc(ADC_OFF);
setup_spi(SPI_DISABLED);
setup_oscillator(OSC_PLL_OFF);
setup_ccp1(CCP_OFF);
disable_interrupts(GLOBAL);
setup_adc_ports(NO_ANALOGS);
|
I know that there is a lot a possibility for use on each pin. I'm little bit surprised, normal CCS don't start module by itself. is it true ?
My ccs version is 5.015 |
|
|
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
|
Posted: Mon Jan 15, 2018 11:09 am |
|
|
PCM programmer wrote: | temtronic, He said he's using 3.0v from a lab power supply.
-------------------
Look at the 16F1823 data sheet, in this section on page 330:
30.3 DC Characteristics: PIC12(L)F1822/16(L)F1823-I/E (Power-Down)
http://ww1.microchip.com/downloads/en/DeviceDoc/40001413E.pdf
The sections that are in gray are for the standard "F" part.
It says that for 3.0v, the typical power-down current is 22 ua, for
the following conditions:
Quote: | WDT, BOR, FVR, and T1OSC disabled, all Peripherals Inactive |
22 ua is about what you are seeing. This is correct.
If you look at the non-grayed section, you will see a very low current
of 0.03 ua (30 nano-Amps). But this is for the "LF" version.
The "LF" version in the more modern PICs is not just a slightly better
power-down version. It's a lot better. You need to buy the "LF" chip. |
you seem to be my hero today !
The mistake is mine ! thanks everybody |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Tue Jan 16, 2018 9:04 am |
|
|
It's perhaps worth just noting that the consumption dropped by 4uA when you applied the little changes on making the pins not float etc.. Now this will be similar on the LF chip, so well worth 'bearing in mind' when you do get to the final version of the code/circuit.... |
|
|
|