2021-04-29 02:28 AM
Im trying to put STM32H743 in stop mode with wakeup from external interrupt.
So far core wakes up immediately after
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);
EXTI_CPUPRx registers all set to 0, so what wakes up the CPU? Is there any additional falgs that indicates the wakeup source?
2021-04-29 04:29 AM
This can be caused by SYSTICK, which should be disabled before going to STOP.
Regards
/Peter
2021-04-30 04:37 AM
Disabled a systick, doesnt work either. Maybe there is something im doing wrong. With step by step debug it never goes to stop mode, when running without debug, it wakes up one time, and then never wakes, exti on dedicated pin does not work either
EXTI_HandleTypeDef hexti_USB_VBUS;
void WakeUpSourcesInit(void)
{
EXTI_ConfigTypeDef ExtiConfig;
ExtiConfig.Line = EXTI_LINE_9;
ExtiConfig.Mode = EXTI_MODE_EVENT;
ExtiConfig.Trigger = EXTI_TRIGGER_RISING;
ExtiConfig.GPIOSel = EXTI_GPIOA;
ExtiConfig.PendClearSource = EXTI_D3_PENDCLR_SRC_NONE;
HAL_EXTI_SetConfigLine(&hexti_USB_VBUS, &ExtiConfig);
}
void DevStop(void)
{
while(1)
{
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);
HAL_ResumeTick();
LED1_GPIO_Port->ODR ^= LED1_Pin;
SYSCLKConfig_STOP();
}
}
2021-09-30 02:48 AM
Still struggling with wakeup reason. Does anyone have an idea. Here is EXTI and PWR registers immediately after wakeup
2021-09-30 03:22 AM
The 'H7 is an overly complicated beast, and its EXTI is no exception. I don't use it, so following is only from reading the RM.
There are two kinds of EXTI signals - "configurable" and "direct", see EXTI Event input mapping table. Configurable are "legacy" and latch within EXTI in the Pending register(s) - that are all the "real" external interrupts from pins, for example.
Direct signals don't latch within EXTI, they just pass through resynchronization and are subject to gating (CPUIMRx registers, which by default are enabled for all Direct signals). So, for Direct signals, you are supposed to find trace at their source, based on what Wakeup interrupts have you enabled in the individual peripherals.
Also, if you use Cube/HAL, it's Cube/HAL which may get in your way by clearing the pending registers. Using Cube/HAL you agree to play along its own rules, written or not; and to accept its limited scope of "usual usage cases".
JW
2021-09-30 04:53 AM
All peripherals are off at this point. So it is a "direct" event because I see nothing in CPUIMRx registers. Have no idea how to find a cause...
2021-10-01 07:30 AM
> All peripherals are off at this point.
Clear all CPUIMRx registers. Still wakeup?
JW
2021-10-04 06:43 AM
Yes, same
2021-10-04 08:24 AM
Are you sure it goes to sleep at all? How exactly do you test that?
Do you use WFI or WFE?
Could M7_DWT_SLPCNT register give any further insight?
JW
2021-10-04 08:39 AM
It goes like this
while(1)
{
HAL_SuspendTick();
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);
if (__HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG())
{
LED1_GPIO_Port->ODR |= LED1_Pin;
__HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG();
}
else
{
LED1_GPIO_Port->ODR &= ~LED1_Pin;
}
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&RTCHandle, RTC_FLAG_WUTF);
HAL_ResumeTick();
SYSCLKConfig_STOP();
}
with
__WFE ();
in
void HAL_PWR_EnterSLEEPMode (uint32_t Regulator, uint8_t SLEEPEntry)
Didn't know about M7_DWT_SLPCNT, it stays 0. Does that mean that core does not go into sleep? Or some event already active by the time I call WFE?