2021-09-07 02:03 AM
Hello, I am developing STM32L072.
The library is using ""I CUBE LRWAN".
Inside the library, I have created the part that enters the OFF mode (STANDBY mode.
But the MCU doesn't consider the RTC and just keeps rebooting.
What else should I consider?
void PWR_EnterOffMode(void)
{
/* USER CODE BEGIN EnterOffMode_1 */
UTILS_ENTER_CRITICAL_SECTION();
if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
{
/* Clear Standby flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
}
DBGMCU->CR = 0;
/*SX1276 DEINIT*/
Sx_Board_IoDeInit();
Gpio_PreInit();
Gpio_STOP_PowerHold_Init();
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x2616, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
/* Clear all related wakeup flags */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Enter the Standby mode */
HAL_PWR_EnterSTANDBYMode();
UTILS_EXIT_CRITICAL_SECTION();
/* USER CODE END EnterOffMode_1 */
}
2021-09-07 02:17 AM
Please check SYSTICK whether it is deactivated, otherwise it fires continuously with an interrupt every 1 ms.
Regards
/Peter
2021-09-07 03:00 AM
Thanks for the reply.
But I don't think this is enough.
2021-09-07 03:01 AM
HAL_DeInit();
__HAL_RCC_PWR_CLK_ENABLE();
After adding two more lines, the problem of Jebooting disappeared.
There is an additional problem that the power consumption is fixed at 10 mA.