Helpful ReplyHot!Current Consumption in sleep Mode PIC16F

Author
Fxlix
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2018/05/17 06:28:56
  • Location: 0
  • Status: offline
2018/08/14 00:13:18 (permalink)
0

Current Consumption in sleep Mode PIC16F

Hello Community, 
 
I'm working on a battery powered project with a PIC16F15376. I'm trying to reduce the current consumption to a minimum, but I'm not able to fall below 6 mA. The PIC is mounted on the DM164143 evaluation board. I turned off all peripheral modules via the PMDx Registers, and I am using the LF internal Oscillator. All Pins are set to Input and the weakpullups are enabled. 
 
This is my main.c:
 
#include <xc.h>
#include "mcc_generated_files/mcc.h"


void main(void) {
    SYSTEM_Initialize();
    INTERRUPT_PeripheralInterruptEnable();
    CPUDOZEbits.DOZEN = 0;
    CPUDOZEbits.IDLEN = 0;
    
    SLEEP();
    NOP();
    while(1){
        
    }
    
}

 
 The device config.c:
 

// CONFIG1
#pragma config FEXTOSC = OFF // External Oscillator mode selection bits->Oscillator not enabled
#pragma config RSTOSC = LFINT // Power-up default value for COSC bits->LFINTOSC
#pragma config CLKOUTEN = OFF // Clock Out Enable bit->CLKOUT function is disabled; i/o or oscillator function on OSC2
#pragma config CSWEN = ON // Clock Switch Enable bit->Writing to NOSC and NDIV is allowed
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit->FSCM timer enabled

// CONFIG2
#pragma config MCLRE = ON // Master Clear Enable bit->MCLR pin is Master Clear function
#pragma config PWRTE = OFF // Power-up Timer Enable bit->PWRT disabled
#pragma config LPBOREN = OFF // Low-Power BOR enable bit->ULPBOR disabled
#pragma config BOREN = ON // Brown-out reset enable bits->Brown-out Reset Enabled, SBOREN bit is ignored
#pragma config BORV = HI // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (VBOR) is set to 2.7V
#pragma config ZCD = OFF // Zero-cross detect disable->Zero-cross detect circuit is disabled at POR.
#pragma config PPS1WAY = ON // Peripheral Pin Select one-way control->The PPSLOCK bit can be cleared and set only once in software
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit->Stack Overflow or Underflow will cause a reset

// CONFIG3
#pragma config WDTCPS = WDTCPS_31 // WDT Period Select bits->Divider ratio 1:65536; software control of WDTPS
#pragma config WDTE = OFF // WDT operating mode->WDT Disabled, SWDTEN is ignored
#pragma config WDTCWS = WDTCWS_7 // WDT Window Select bits->window always open (100%); software control; keyed access not required
#pragma config WDTCCS = SC // WDT input clock selector->Software Control

// CONFIG4
#pragma config BBSIZE = BB512 // ->512 words boot block size
#pragma config BBEN = OFF // ->Boot Block disabled
#pragma config SAFEN = OFF // ->SAF disabled
#pragma config WRTAPP = OFF // ->Application Block not write protected
#pragma config WRTB = OFF // ->Boot Block not write protected
#pragma config WRTC = OFF // ->Configuration Register not write protected
#pragma config WRTSAF = OFF // ->SAF not write protected
#pragma config LVP = ON // Low Voltage Programming Enable bit->Low Voltage programming enabled. MCLR/Vpp pin function is MCLR.

// CONFIG5
#pragma config CP = OFF // UserNVM Program memory code protection bit->UserNVM code protection disabled

 
and my mcc.c:
 
#include "mcc.h"


void SYSTEM_Initialize(void)
{
    PMD_Initialize();
    PIN_MANAGER_Initialize();
    OSCILLATOR_Initialize();
    EXT_INT_Initialize();
}

void OSCILLATOR_Initialize(void)
{
    // NOSC LFINTOSC; NDIV 1;
    OSCCON1 = 0x50;
    // CSWHOLD may proceed; SOSCPWR Low power;
    OSCCON3 = 0x00;
    // MFOEN disabled; LFOEN disabled; ADOEN disabled; SOSCEN disabled; EXTOEN disabled; HFOEN disabled;
    OSCEN = 0x00;
    // HFFRQ 32_MHz;
    OSCFRQ = 0x06;
    // MFOR not ready;
    OSCSTAT = 0x00;
    // HFTUN 0;
    OSCTUNE = 0x00;
}

void PMD_Initialize(void)
{
    // CLKRMD CLKR enabled; SYSCMD SYSCLK enabled; FVRMD FVR enabled; IOCMD IOC enabled; NVMMD NVM enabled;
    PMD0 = 0xFF;
    // TMR0MD TMR0 enabled; TMR1MD TMR1 enabled; TMR2MD TMR2 enabled; NCOMD DDS(NCO) enabled;
    PMD1 = 0xFF;
    // ZCDMD ZCD enabled; CMP1MD CMP1 enabled; ADCMD ADC enabled; CMP2MD CMP2 enabled; DAC1MD DAC1 enabled;
    PMD2 = 0xFF;
    // CCP2MD CCP2 enabled; CCP1MD CCP1 enabled; PWM4MD PWM4 enabled; PWM3MD PWM3 enabled; PWM6MD PWM6 enabled; PWM5MD PWM5 enabled;
    PMD3 = 0xFF;
    // CWG1MD CWG1 enabled; UART2MD EUSART2 enabled; MSSP1MD MSSP1 enabled; UART1MD EUSART enabled; MSSP2MD MSSP2 enabled;
    PMD4 = 0xFF;
    // CLC3MD CLC3 enabled; CLC4MD CLC4 enabled; CLC1MD CLC1 enabled; CLC2MD CLC2 enabled;
    PMD5 = 0xFF;
}

 
What other steps are necessary to reduce the power consumption? There is nothing connected to the Pins. I'm powering the Board with a power supply connected to Vdd and GND. 
 
I would appreciate any help and thanks in advance, 
Felix
#1
jswanson
Super Member
  • Total Posts : 322
  • Reward points : 0
  • Joined: 2003/11/07 12:44:05
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 01:01:24 (permalink)
0
How are you measuring the current?  I would be surprised if it used 6mA running.
Jeremy.
#2
Fxlix
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2018/05/17 06:28:56
  • Location: 0
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 01:24:38 (permalink)
0
Hi Jeremy,
I'm measuring the current with a Fluke8808A Multimeter placed between the GND Pin of the evaluation board an the Ground of my Powersupply. 
I suppose that the PIC isn't going to sleep mode....
By the way I'm using XC8 Pro compiler
Felix
post edited by Fxlix - 2018/08/14 01:26:07
#3
qɥb
Monolothic Member
  • Total Posts : 3329
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 01:52:00 (permalink) ☄ Helpfulby Jim Nickerson 2018/08/14 06:14:25
+1 (1)
Isn't the other PIC (that does the programming) also on that board, and powered up?
 

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#4
Fxlix
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2018/05/17 06:28:56
  • Location: 0
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 01:58:40 (permalink)
0
Yes there is a PIC16F1454 on the board. But when I'm measuring the current the usb cable is not connected and the datasheet of the 16F1454 also states that its a XLP(extreme low power) device...
post edited by Fxlix - 2018/08/14 05:50:36
#5
jack@kksound
code tags!
  • Total Posts : 2841
  • Reward points : 0
  • Joined: 2014/05/14 10:03:19
  • Location: 0
  • Status: online
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 07:46:53 (permalink)
0
FXLix
Yes there is a PIC16F1454 on the board. But when I'm measuring the current the usb cable is not connected and the datasheet of the 16F1454 also states that its a XLP(extreme low power) device...


Meaning it is capable of very low power operation but NOT that it is always in a low power mode. 
#6
coffee critic
Super Member
  • Total Posts : 265
  • Reward points : 0
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 08:50:38 (permalink)
+2 (2)
Print out the schematic for the board from the users guide and start looking at every component.  Don't forget the passives.  Measure voltages at critical nodes. You will probably determine that the cause of the high current is not the PIC16 but the interaction of the PIC with all the other components. (Note the 10k POT across the supply)
 
A better way to test the current is to put the part in get a DIP part and put it in a bread board to isolate it from all external current paths. 

n_*$
#7
mbrowning
Just a Member
  • Total Posts : 1127
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 09:17:35 (permalink)
+2 (2)
Low power design isn't easy. There can be a lot of leaks you need to plug up. The 5mA leak will be easy to find - it's probably mostly the USB PIC. Then the 300uA leak - the pot. Then the 20uA leaks - the LEDs powered by the weak pullups you enabled. It's useful when designing for ultra low power to put a series resistor (value depends on expected current) in the power for the PIC (and anything else you might want to measure). Then you can see exactly where the current is going.

Go Navy! Beat Army!
#8
Jim Nickerson
User 452
  • Total Posts : 5455
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 09:26:33 (permalink)
0
The series resistor might be a challenge on the DM164143 board.
#9
mbrowning
Just a Member
  • Total Posts : 1127
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 11:04:53 (permalink)
+2 (2)
I assume this is the red "stick" with 40 castellated pins and you are powering through the GND and VDD pins on probably one side. Are you using 3.3V or 5V? Whichever it is, the solder jumper will allow current to backflow to the programmer PIC. Cut or desolder the jumper and then you'll have an isolated PIC to measure.
 
You could replace the jumper with a resistor to measure current flowing either way depending on how you are powering the stick.

Go Navy! Beat Army!
#10
Fxlix
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2018/05/17 06:28:56
  • Location: 0
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 23:36:13 (permalink)
0
Thanks for all your advices. We ordered a DIP package of the PIC. I will try it on the bread board. 
It would be nice to have a jumper on the board for de-/reconnecting the other PIC and Peripherals.....
 
#11
qɥb
Monolothic Member
  • Total Posts : 3329
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: Current Consumption in sleep Mode PIC16F 2018/08/14 23:40:34 (permalink)
0
Have you looked on the schematic?
I think there ARE jumpers on the board, but they are blobs of solder, not links that can be removed by hand.

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#12
Jump to:
© 2018 APG vNext Commercial Version 4.5