Den Ned

stm8l151f3 halt - how get current 2uA?

Discussion created by Den Ned on Jul 25, 2017
Latest reply on Jul 26, 2017 by Den Ned

Hi. In datasheet supply current in halt mode - 2uA. It is imoprtant in my currrent project to get this low current. But for now its - 100uA. Create project just to get - 2uA. To get this result make next steps:
hardware - microcontroller stm8l151f3 without any external connection, exept SWIM, +3V and GND;
software - IAR Embedded Wornbench IDE.
code -

#include <iostm8l151f3.h>

long volatile cnt = 100000; // to make some delay


int main( void )
{
CLK_CKDIVR = 0x02; // Fhsi = Fcpu = 4 МГц
PWR_CSR2_ULP = 1; // Internal reference voltage stopped in Halt/Active-halt mode
CLK_ICKCR_SAHALT = 1; // main voltage regulator OFF in HALT/Active-halt modeв halt

PA_DDR = 0xFF; // all gpio - output
PB_DDR = 0xFF;
PC_DDR = 0xFF;
PD_DDR = 0xFF;

PA_ODR = 0x00;
PB_ODR = 0x00;
PC_ODR = 0x00;
PD_ODR = 0x00;


CLK_PCKENR1 = 0; // no peripfheral
CLK_PCKENR2 = 0;
CLK_PCKENR3 = 0;

while(cnt) // delay
{
cnt--;
}


CPU_CFG_GCR_SWD = 1; // disable SWIM

asm("HALT"); //go halt


while(1)
{

}
}


results;
while delay (in active mode ) - current 1mA,
in halt mode - 100uA.
What steps i should do to get 2uA?
What bits do i miss?

Outcomes