Skip to main content
Associate
November 28, 2024
Question

stm32H73** sleep mode

  • November 28, 2024
  • 2 replies
  • 642 views

Hi, 

My test board can enter sleep mode OK, but doesn't wake up when PC13 goes high: (never reach __enable_irq())

 

 

void Sleep() {
__disable_irq();

SysTick->CTRL = 0;

// Enable WKUP4 (PC13)
PWR->WKUPEPR = PWR_WKUPEPR_WKUPEN4; // Enable WKUP4
PWR->WKUPCR = 0xFFFFFFFF; // Clear all wake-up flags

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
PWR->CR1 |= PWR_CR1_LPDS; // Low Power Deep Sleep

__DSB();
__ISB();
__WFI(); // Enter deep sleep

__enable_irq();
}

 

 
 

2 replies

ST Employee
November 28, 2024

Hello @harareyd, welcome to the ST community,

Consider using __WFE() instead of __WFI() to enter sleep mode. The __WFE() instruction can be more suitable for event-driven wake-up scenarios.

But your code is correct... maybe the issue is with the physical button! could you test it? 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
harareydAuthor
Associate
November 28, 2024

When using __WFE() the board doesn't enter sleep mode at all unfortunately. It just skips right over the __WFE() instruction. I verified that the input is working. Sleep() is called when PC13 goes low. 

Michal Dudka
Lead
November 28, 2024

I am not much oriented in sleep modes, but it looks like you go to sleep with disabled interrupts.