Skip to main content
Associate II
May 27, 2024
Solved

Sleep mode, GPIOs and RCC_AHB2LPENR - STM32H5, EXTI wakeup sources

Hello

What will happen with the IOs when MCU is put to Sleep mode (one of power modes in PWR) and register bits in RCC_AHB2LPENR for each GPIO-block are reset? When bits are reset, the peripheral clock is disabled during Sleep mode.

Can the IOs still be used to trigger interrupts in Sleep mode with the EXTI controller?

This topic has been closed for replies.
Sarra.SBest answer
ST Employee
May 28, 2024

Hello @Imre, 

Sorry for the misunderstanding! 

>>will the interrupt triggering with EXTI still work when IOs are configured to trigger on rising/falling edge?

YES, the EXTI mux that provides the IO port selection will remain active even with clocking down the GPIO port.

I've tested this with a minimal code, entering sleep mode and waking up with PC13, but before entering sleep mode, I added this mask to disable the GPIOC port: 

 

RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_GPIOCLPEN);

 

The interrupt triggering with EXTI still works! 

I'm curious about how you plan to use EXTI interrupts with disabled GPIO clocks in your project, could you elaborate on your application's context and the reasons for this specific setup?

 

Thank you! 

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.

4 replies

ST Employee
May 27, 2024

Hello @Imre, 

In Stop mode, all I/O pins keep their configuration, this means that even if the peripheral clocks are disabled during sleep mode by resetting the register bits in RCC_AHB2LPENR for each GPIO block, the I/O states are not affected  and will remain in their last configured state

 

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.
ImreAuthor
Associate II
May 28, 2024

With all respect, you did not answer the question related to sleep mode. You mentioned stop mode which is another mode. There are sleep, stop and standby modes.

Let me rephrase my question:
In sleep mode and when GPIO peripheral clocks are disabled by resetting corresponding bits in RCC_AHB2LPENR, will the interrupt triggering with EXTI still work when IOs are configured to trigger on rising/falling edge?

Sarra.SBest answer
ST Employee
May 28, 2024

Hello @Imre, 

Sorry for the misunderstanding! 

>>will the interrupt triggering with EXTI still work when IOs are configured to trigger on rising/falling edge?

YES, the EXTI mux that provides the IO port selection will remain active even with clocking down the GPIO port.

I've tested this with a minimal code, entering sleep mode and waking up with PC13, but before entering sleep mode, I added this mask to disable the GPIOC port: 

 

RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_GPIOCLPEN);

 

The interrupt triggering with EXTI still works! 

I'm curious about how you plan to use EXTI interrupts with disabled GPIO clocks in your project, could you elaborate on your application's context and the reasons for this specific setup?

 

Thank you! 

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.