2020-09-07 05:48 AM
If I put port b all in analog the micro not wake up when in RTC wakeup mode (internal wakeup).
Any help?
Thanks in avance
void EnterStopMode(void)
{
GPIO_InitTypeDef GPIO_InitStruct={0};
/* Configure all GPIO as analog to reduce current consumption on non used IOs */
/* Enable GPIOs clock */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_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(GPIOC, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
// HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOD_CLK_DISABLE();
__HAL_RCC_GPIOE_CLK_DISABLE();
__HAL_RCC_GPIOH_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();
// __HAL_RCC_GPIOB_CLK_DISABLE();
/* RTC configuration */
RTCHandle.Instance = RTC;
RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24;
RTCHandle.Init.AsynchPrediv =0x7F; // LSE as RTC clock: RTC_ASYNCH_PREDIV
RTCHandle.Init.SynchPrediv = 0x00FF; // LSE as RTC clock: RTC_SYNCH_PREDIV;
RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
//__HAL_RCC_PWR_CLK_ENABLE(); // Enable Power Control clock
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 5, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
//__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
//__HAL_RCC_PWR_CLK_ENABLE(); // Enable Power Control clock
HAL_SuspendTick();
HAL_PWR_DisableSleepOnExit();
/* Enter Stop Mode */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
////////////////
// STOP MODE
////////////////
HAL_ResumeTick();
/* Disable Wakeup Counter */
HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle);
ReinitializePeripherial();
}
2020-09-15 08:47 AM
2020-09-16 12:31 AM
Hello Fausto,
There is no files attached to this post !!!
Please check !
Thanks and Best Regards,
Mohamed Aymen.
2020-09-16 12:44 AM
2020-09-17 08:59 AM
2020-09-17 10:44 AM
Hello Mohamed,
Now works,
Can you explain to me where the mistake was. In the final program ADC, SPI and I2C are also used, there is some other setting to do to put the micro to stop with very low current consumption, with other active peripherals.
On Monday I go to the office to measure the current when the micro is in stop mode.
Many thanks for your precious help.
Best regards
Fausto
2020-09-18 12:43 AM
Hello Fausto,
After waking up from stop mode, we need to reconfigure the clock.
Best Regards,
Mohamed Aymen.
2020-09-22 03:14 AM
Hello @FBald.1 ,
Any update !
Best Regards,
Mohamed Aymen.
2020-09-22 03:16 AM