2018-10-11 05:10 AM
I'm using a 32L152C DISCOVERY board.
I have trouble getting really low current in stop mode (< 10µA).
This is the simple code I test with:
int main(void)
{
PWR_UltraLowPowerCmd(ENABLE);
PWR_FastWakeUpCmd(DISABLE);
// Enters STOP mode
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
while(1);
}
I have have removed the jumper from JP1 and connected a current measurement device between JP1.1 to JP1.2 (this measures the current going in to VDD_MCU.
The current is about 4.6mA when entering main() and 1.0 mA in stop mode. Am I doing something wrong?
Just for reference: If I hold down the RESET button the current is 1.2mA.
2018-10-15 01:53 AM
Could someone post a short example that is known to give µA current in stop mode?
2018-10-15 06:58 AM
Now I managed to get the current down.
The solution was to set all GPIO to analog mode. I guess this is because the JTAG/SWD pins draws some current when enabled.
Now the current decreased down to 370µA.
But this made the LD3 (green LED) glow faintly.
Somehow the PB7 pin outputs enough current to make it glow faintly. I removed the serial resistor to LD3.
Now the current decreased down to 18µA.
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC | RCC_AHBPeriph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_Init(GPIOD, &GPIO_InitStructure);
PWR_UltraLowPowerCmd(ENABLE); // This row makes no difference in this simple example
PWR_FastWakeUpCmd(DISABLE); // This row makes no difference in this simple example
// Enters STOP mode
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
while(1);
}