Thanks a lot.
I tried some of these things already before starting this thread.
It looks like my changed parameters in a local copy of SystemClock_Config(void), ie. RCC_SYSCLK_DIVx and other, are not having any effect.
That's why I asked for some expertise.
current in deepSleep mode STM32F103C8, STM32F401CC
Re: current in deepSleep mode STM32F103C8, STM32F401CC
Hi,
finally the solution was found.
In deep_sleep the pins staying in the last mode they have been configured,
i.e.
Each configured pin draws a little bit of current.
According to
https://community.st.com/t5/stm32-mcus/ ... ta-p/49801
about 133uA are added (for each pin) on top of the low current the STM32F401 draws in stop mode, some 10uA.
This code has been added before calling LowPower.deepSleep() to fix the issue.
With this the current in deepsleep mode came from about 2mA down to approx. 260uA.
Thanks to all for your help
rudi
finally the solution was found.
In deep_sleep the pins staying in the last mode they have been configured,
i.e.
Code: Select all
pinMode (a_Pin, OUTPUT);
According to
https://community.st.com/t5/stm32-mcus/ ... ta-p/49801
about 133uA are added (for each pin) on top of the low current the STM32F401 draws in stop mode, some 10uA.
This code has been added before calling LowPower.deepSleep() to fix the issue.
Code: Select all
/* Configure all GPIO as analog to reduce current consumption on non used IOs */
GPIO_InitTypeDef GPIO_InitStruct;
/* Enable GPIOs clock */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pin = GPIO_PIN_All;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/* Disable GPIOs clock */
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
// configure a pin for an interrupt
pinMode(my_Interrupt_Pin, INPUT_PULLUP); // Prepare pin
delay(5);
LowPower.attachInterruptWakeup(my_Interrupt_Pin, Rain_Cnt, FALLING, DEEP_SLEEP_MODE);
// this the system wakeup (PA0); connect to a separate switch
LowPower.attachInterruptWakeup(WakeUp_Pin, WakeUp, RISING, DEEP_SLEEP_MODE);
// sleep
LowPower.deepSleep(); // STM32-Stop Mode, low µC current
Thanks to all for your help
rudi