Author Topic: Reducing sleep current of PIC10F322 not possible  (Read 1236 times)

0 Members and 1 Guest are viewing this topic.

Offline babolcsTopic starter

  • Newbie
  • Posts: 3
  • Country: hu
Reducing sleep current of PIC10F322 not possible
« on: November 02, 2023, 06:51:32 pm »
Hi,

I try to reduce the sleep current of PIC10F322, but not possible to go below 10.5uA.
Originally I have PWM, ADC, FVR, TMR2 in my project, but now I created an empty one and didn't added any of them.
I use MCC, checked if all the register/service switched off, even the WDT and the BOR too.
But the power usage is 10.5uA still.

My code is extremly simple in that skeleton version:

    while (1)
    {
        // Add your application code
        IO_RA2_SetHigh();
        __delay_ms(2000);
        IO_RA2_SetLow();
        IO_RA1_SetLow();
        IO_RA0_SetLow();
        SLEEP();
        NOP();
    }

WDT disabled and WDT enabled doesn't change the current usage neither.
The device_config.c is the following


pragma config FOSC = INTOSC    // Oscillator Selection bits->INTOSC oscillator: CLKIN function disabled
#pragma config BOREN = OFF    // Brown-out Reset Enable->Brown-out Reset disabled
#pragma config WDTE = OFF    // Watchdog Timer Enable->WDT disabled
#pragma config PWRTE = OFF    // Power-up Timer Enable bit->PWRT disabled
#pragma config MCLRE = ON    // MCLR Pin Function Select bit->MCLR pin function is MCLR
#pragma config CP = OFF    // Code Protection bit->Program memory code protection is disabled
#pragma config LVP = ON    // Low-Voltage Programming Enable->Low-voltage programming enabled
#pragma config LPBOR = OFF    // Brown-out Reset Selection bits->BOR disabled
#pragma config BORV = LO    // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.
#pragma config WRT = OFF    // Flash Memory Self-Write Protection->Write protection off


There is only 1 lead on the pins (with a resistor to VDD, but If I remove it is the same.)
only 1 10uF cap is there (if I remove it is the same.

The current measure unit is an old voltcraft m-4650B which is 4.5 digits and quite punctual it has 200uA limit and capable to measure 0.1uA too.
 VDD=2.8V if I reduce to 2.3 it goes down to 9.5uA but not below 1uA.


No other idea.

Thanks,

Szabolcs
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: Reducing sleep current of PIC10F322 not possible
« Reply #1 on: November 02, 2023, 07:05:25 pm »
And the init code? Gpio config plays a big role.
« Last Edit: November 02, 2023, 07:08:16 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3250
  • Country: de
Re: Reducing sleep current of PIC10F322 not possible
« Reply #2 on: November 02, 2023, 07:10:17 pm »

#pragma config BORV = LO    // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.


I would switch all analog functions off.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: Reducing sleep current of PIC10F322 not possible
« Reply #3 on: November 02, 2023, 07:16:37 pm »
I would switch all analog functions off.

It is:
Code: [Select]
#pragma config BOREN = OFF    // Brown-out Reset Enable->Brown-out Reset disabled
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline babolcsTopic starter

  • Newbie
  • Posts: 3
  • Country: hu
Re: Reducing sleep current of PIC10F322 not possible
« Reply #4 on: November 02, 2023, 08:07:59 pm »
Hi, Since I haven't added and services, I didn't initialized anything from code just from MCC.
So in main just there is the  MCC generated code:

void main(void)
{
    // initialize the device
    SYSTEM_Initialize();

    while(1) ....


which is realized in the mcc.c: (also MCC generated code)

void SYSTEM_Initialize(void)
{

    PIN_MANAGER_Initialize();
    OSCILLATOR_Initialize();
    WDT_Initialize();
}

void OSCILLATOR_Initialize(void)
{
    // LFIOFR 31.25KHz_osc_not_ready; HFIOFS unstable; HFIOFR 16MHz_osc_not_ready; IRCF 31KHz;
    OSCCON = 0x00;
    // CLKROE disabled;
    CLKRCON = 0x00;
    // SBOREN disabled; BORFS disabled; BORRDY BOR Circuit is inactive;
    BORCON = 0x00;
}

void WDT_Initialize(void)
{
    // WDTPS 1:262144; SWDTEN OFF;
    WDTCON = 0x1A;
}

/**
 End of File
*/

Adn this is in pin_manager.c :

void PIN_MANAGER_Initialize(void)
{
    /**
    LATx registers
    */
    LATA = 0x00;

    /**
    TRISx registers
    */
    TRISA = 0x00;

    /**
    ANSELx registers
    */
    ANSELA = 0x00;

    /**
    WPUx registers
    */
    WPUA = 0x00;
    OPTION_REGbits.nWPUEN = 1;






   
   
}
 
void PIN_MANAGER_IOC(void)
{   
}

/**
 End of File
*/
« Last Edit: November 02, 2023, 08:10:07 pm by babolcs »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: Reducing sleep current of PIC10F322 not possible
« Reply #5 on: November 02, 2023, 08:40:17 pm »
Make use of the code tags!
The adviced ultra low power is based on very specific settings, a simple GPIO being enabled can change it completely.
Also the advertised 20nA are at 1.8V.
If you really want low power consumption, then you must get the PIC10LF322.

Since you're using MCC, you'll have to check what these functions do. My advice is to not use MCC, PIC10 are extremely easy to configure.

Check datasheet page 44:
Quote
I/O pins that are high-impedance inputs will be pulled to VDD or VSS externally to avoid switching currents caused by floating inputs.

So, you might try this, connect nothing to the pins:
Code: [Select]
TRISA=0x0F;               // All pisn as inputs
ANSELA = 0;                 // All pins as digital
WPUA = 0x0F;               // Enable all pullups
OPTION_REGbits.nWPUEN = 0;  // Enable pullups

You can also try disabling the pullups and using external 100K pull-downs.

Or setting all pins to analog, so the pin digital interfaces becomes disabled, might lower the power consumption:
Code: [Select]
ANSELA = 0x07;                 // All pins as analog

Read:
https://www.eevblog.com/forum/microcontrollers/help-reducing-sleep-current-in-pic10f322/
https://www.electro-tech-online.com/threads/pic10f322-sleep-current-challenge.130596/


Also, try disabling MCLRE:
Code: [Select]
#pragma config MCLRE = OFF
« Last Edit: November 02, 2023, 11:26:04 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: Reducing sleep current of PIC10F322 not possible
« Reply #6 on: November 03, 2023, 08:26:42 pm »
Any input pin left floating is indeed the #1 cause of excessive current draw with CMOS devices.
Many MCUs, PIC10 included, have their GPIOs default to inputs on reset and will remain so unless you configure them as outputs. If there's no pull-up or pull-down on those pins, you'll have excess current draw, 99.99% guaranteed.

Only a very few MCUs do have input pads on their GPIOs that can be disabled (and even fewer have these disabled by default on reset), with those you can afford not to care to configure them explicitely as they will draw no current when disabled even if left floating. But that's the exception rather than the norm.
 

Offline babolcsTopic starter

  • Newbie
  • Posts: 3
  • Country: hu
Re: Reducing sleep current of PIC10F322 not possible
« Reply #7 on: November 04, 2023, 12:19:44 am »
Hi Put to all input/output a resistor (1M to GND), power usage increase to 18uA (understandable, because some were output.) So it hasn't solved the issue. So still without any functions the PIC10F322 sleep current is minimum 10.5uA for me.

Can anyone produce smaller? I strongly doubt that the <1uA can be achieved.
???
 

Offline errorprone

  • Contributor
  • Posts: 39
Re: Reducing sleep current of PIC10F322 not possible
« Reply #8 on: November 04, 2023, 12:23:55 pm »
It may be worthwhile to try and leave OSCCON at its default value instead of changing it to the 31khz oscillator (0x00).  The 31khz may still be operating.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: Reducing sleep current of PIC10F322 not possible
« Reply #9 on: November 04, 2023, 12:32:42 pm »
understandable, because some were output
Why you keep doing what you want? I'm out.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: SiliconWizard

Offline boz

  • Regular Contributor
  • *
  • Posts: 75
  • Country: nz
    • Roving Dynamics Ltd
Re: Reducing sleep current of PIC10F322 not possible
« Reply #10 on: November 05, 2023, 05:30:26 am »
Hi Put to all input/output a resistor (1M to GND), power usage increase to 18uA (understandable, because some were output.) So it hasn't solved the issue. So still without any functions the PIC10F322 sleep current is minimum 10.5uA for me.

Can anyone produce smaller? I strongly doubt that the <1uA can be achieved.
???
A pin set as an output driver with nothing connected would not consume any current as they are push/pull MOSFETs
Fearless diver and computer genius
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 828
Re: Reducing sleep current of PIC10F322 not possible
« Reply #11 on: November 05, 2023, 11:35:42 pm »
I have a 10LF322 as an ir remote, it draws 20na in sleep as the datasheet claims.

There is nothing special to do to get there-
https://github.com/cv007/2button_remote/blob/master/main.c
not my favorite code, but there is essentially nothing there other than setting 2 pins to digital in w/pullups (switches) and 2 as digital outputs (leds). Fuses not shown, but brownout is disabled, watchdog unused.

If you have a 10F322 instead of a 10LF322, then you may be losing the XLP low power feature. I don't remember what the difference is, but I'm pretty sure the difference is not insignificant when low power is important.

You should also disconnect the programmer when doing current measurements. Not sure if necessary in this particular case, but it can be a source of invalid measurements.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf