Forums › Devices › OSD32MP15x › Wake up through gpio
Tagged: OSD32MP15x
Hi there,
Somebody please help me to understand how to wake up from gpio lines.
My understanding is ST have some predefined wake-up GPIO lines like PA0, PA2, PC1, PC13, PI8, PI11 from AN5109 (page 9).
I tried to wake up from PC1 but didn’t worked.[As this was the only pin available on BRK header]
Then i tried adding I6 GPIO as wake-up source in device tree as :
gpio_keys {
compatible = “gpio-keys”;
#address-cells = <1>;
#size-cells = <0>;
autorepeat;
input-name = “gpio-keys”;
button@1 {
label = “wakeup”;
linux,code = <205>;
gpios = <&gpioi 6 GPIO_ACTIVE_LOW>;
wakeup-source;
};
};
This also don’t helped.
I can wake up A7 successfully from other sources like M4 mailbox, USB, serial etc.
Please help me waking up the linux system from any GPIO.
Thanks, Rishi
Hey Rishi,
Please review this thread from ST forums: https://community.st.com/s/question/0D53W00000cxRieSAE/wakeup-on-gpio-in-linux-on-stm32mp1.
You should be able to set GPIO wakeup in CubeMX and generate the device tree you need from there. Please also take a look at https://wiki.st.com/stm32mpu/wiki/How_to_define_your_low-power_strategy and https://wiki.st.com/stm32mpu/wiki/Power_overview.
Best,
Neeraj
Hi Neeraj,
Thanks for your response. I saw these links, but i still can not find a way to add a gpio as wakeup source in CubeMX tool. Even when i add new wakeup sources in CubeMX i do not see any changes in the device tree files generated.
See another issue is when i am trying to wake up through PONKey,my build blocks at
“INFO: SP_MIN: Preparing exit to normal world”.
But the same thing (waking up through Ponkey) works just fine in your demo build “OSD32MP1_BRK_OpenSTLinux_Trusted_RELEASE_V2.0”.
I tried to compare my device trees with OSD-brk device trees, but i can not find the difference.
Can you please point me to right direction where should i look for the issue, i mean its tfa ,uboot or kernel issue ?
Please see the full logs.
# echo mem > /sys/power/state
[ 52.990628] PM: suspend entry (deep)
[ 53.032482] Filesystems sync: 0.039 seconds
[ 53.036337] Freezing user space processes … (elapsed 0.001 seconds) done.
[ 53.043048] OOM killer disabled.
[ 53.046219] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done.
[ 53.053667] printk: Suspending console(s) (use no_console_suspend to debug)
————– I wakeup by PON Key here ——————————
NOTICE: CPU: STM32MP157C?? Rev.Z
NOTICE: Model: Custom board
INFO: Reset reason (0x810):
INFO: System exits from STANDBY
NOTICE: BL2: v2.2-r2.0(release):
NOTICE: BL2: Built : 06:55:06, Apr 15 2021
INFO: Using crypto library ‘stm32_crypto_lib’
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-DDR3L 16bits 533000Khz
INFO: BL2 runs SP_MIN setup
INFO: BL2: Skip loading image id 4
INFO: BL2: Skip loading image id 5
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0x2ffeb000
INFO: SPSR = 0x1d3
NOTICE: SP_MIN: v2.2-r2.0(release):
NOTICE: SP_MIN: Built : 06:55:10, Apr 15 2021
INFO: ARM GICv2 driver initialized
INFO: Set calibration timer to 60 sec
INFO: ETZPC: UART1 (3) could be non secure
INFO: ETZPC: SPI6 (4) could be non secure
INFO: ETZPC: I2C6 (12) could be non secure
INFO: SP_MIN: Initializing runtime services
INFO: SP_MIN: Preparing exit to normal world <—— It blocks here for around 20 seconds before watchdog kicks in and resets the board.
Thanks, Rishi
Hey Rishi,
My apologies for the delayed response.
It turns out, GPIO wakeup is already implemented in the core device tree for stm32mp1 here: https://github.com/STMicroelectronics/linux/blob/v5.4-stm32mp-r2/arch/arm/boot/dts/stm32mp151.dtsi#L1313. You are right that CubeMX does not generate any wakeup specific device tree nodes to facilitate GPIO wake-up. But, as the pwr_irq nodes are already declared in stm32mp151.dtsi, all GPIO wake-up pins are enabled by default. You should not have to modify device tree in order to be able to implement wake-up. However, note that you will need to make sure that the pin that you are using for wake-up is not configured in the device tree for some other function. I was able to test this with DK2 on Kernel 5.4 with PA0.
For using the ponkey, please also compare your TF-A and U-Boot device trees to the BRK. It looks like there is a proper low power mode entry and wake-up detection. But, the TF-A is running into an error while initializing the board.
Best,
Neeraj
Hi Neeraj,
I’m trying to do something similar on the BRK. I suspend the OSD32MP1 with
1 | shutdown -h 0 |
and want to try and wake the system using one of the wkup pins (I’m using PC1 on the BRK header). But the system is not waking.
Ponkey and wake from RTC work well.
Do you have any ideas?
Please check that the pin is configured correctly in the GPIO registers. You can find information on this in the TRM:
The GPIO register definitions are in Section 13.4 (page 1077). Table 82 (page 1068) shows how the register bits define the pin configuration. Also, Section 13.3.8 (page 1071) discusses the wakeup pins. Finally, the base addresses for each of the peripherals can be found in Table 9 (page 159 – 166, gpio peripherals are on page 162).
Let us know if you continue to have problems.
Octavo Systems LLC all rights reserved
OCTAVO is registered in the U.S. Patent and Trademark Office. OSD, C-SiP, and the Octavo Logo are trademarks of Octavo Systems LLC.
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields