cancel
Showing results for 
Search instead for 
Did you mean: 

Wakeup on GPIO in Linux on STM32MP1

RPiet.1
Associate II

Hello. I am working on standby/wakeup using gpio pin in stm32mp1 custom board. Going to sleep works well using gpio-keys but I can't wakeup. What bothers me most is that interrupt responsible for waking up does not set "waleup" attribute although it is defined in DTS as wakeup-source. I am not sure whether I correctly understand the concept behind exti_pwr and pwr_irq nodes so if there is anyone who can help me with a proper setup I would appreciate your help. Please find enclosed DTS.

 gpio_keys {

  compatible = "gpio-keys";

  #address-cells = <1>;

  #size-cells = <0>;

  autorepeat;

  input-name = "gpio-keys";

   button@1 {

    label = "Suspend";

    linux,code = <205>;

    gpios = <&gpioi 6 GPIO_ACTIVE_LOW>;

   };

   button@2 {

    label = "Wakeup";

    linux,code = <143>;

    interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_RISING>;

    wakeup-source;

   };

 };

};

&pwr_irq {

 wakeup-gpios = <&gpioi 6 GPIO_ACTIVE_HIGH>;

};

11 REPLIES 11
PatrickF
ST Employee

Hi,

PI6 has no WKUP capabilities.

If you really go in SoC Standby (i.e. VDDCORE shutdown), you must use to wakeup one of the 6 available WKUP pins (e.g. PA0/WKUP1 is used on our DK2/EV1 board).

See Reference Manual

See also:

https://wiki.st.com/stm32mpu/wiki/Interrupt_overview

https://wiki.st.com/stm32mpu/wiki/PWR_internal_peripheral

Regards.

In order 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.
I've seen these settings in these dts-es but I thought those i/o pins are arbitrary and any pin can be mapped there. Where those certain pins are mentioned in specification because I haven't seen it ? pon., 8 mar 2021, 17:48 użytkownik ST Community napisał:

So what you're saying is that only PA0, PA2, PC13, PI8, PI11 and PC1 have wakeup capabilities because that's what I see in DTS ?

PatrickF
ST Employee

Wakeup capabilities are shown in Reference Manual (PWR section, e.g. in RM0436 Rev.5, Table 33. "System Low-power mode summary", or "PWR exiting from Standby mode" sub-section).

WKUP pins locations are shown on Datasheet, 6x are present on 18x18 and 12x12 packages, 4x in 16x16 and 10x10 packages.

I confirm, it is PI8 and PI11 (on some packages), plus PC13, PA0, PA2, PC1.

They are present in STM32CubeMX, PWR category.

0693W000008wLytQAE.png

In order 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.

Thank for you support. I have one more question regarding standby. We would like to set certain IO pins with pull-ups or pull-downs during standby but it looks like vddcore is switched off during standby. It looks like in deep standby this is normal but I am wondering how could I go into other LP mode like Sleep so that vddcore is on and gpio pin values will be retained.

Yes, whenever VDDCORE if OFF (STANDBY), all IOs are hi-z (except some IOs related to VSW domain like those for RTC, TAMP).

For your case, if you want to avoid external resistors, you could use LPLV-Stop (VDDCORE only reduced, larger power than STANDBY, but GPIO settings and interrupt capabilities are kept).

Se https://wiki.st.com/stm32mpu/wiki/How_to_define_your_low-power_strategy

Regards.

In order 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.

I'm trying to find whether this is somehow configurable within the Linux kernel but as for now I didn't find anything. Do you know this off the top of your head ?

I'm not specialist of this, maybe read https://wiki.st.com/stm32mpu/wiki/Power_overview or AN5109.pdf

In order 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.

Thanks again. This Power overview pge guided me to the solution. It looks like kernel relies on settings made by TF-A and TF-a sets the deepest mode it has defined in DTS under

system_suspend_supported_modes = <

STM32_PM_CSLEEP_RUN

STM32_PM_CSTOP_ALLOW_STOP

STM32_PM_CSTOP_ALLOW_LP_STOP

STM32_PM_CSTOP_ALLOW_LPLV_STOP

STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR

>;

So what is needed is to define the deepest mode of your choice for the kernel to go.