# Wake up from suspend mode on GPIO interrupt

**URL:** <https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720>\
**Category:** Uncategorized\
**Created:** [September 5, 2017, 6:43am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720 "2017-09-05T06:43:33Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Raf](https://mangoh.discourse.group/u/Raf)\
**Post date:** [September 5, 2017, 6:43am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/1 "2017-09-05T06:43:33Z")

</div>

Hi.

I posted this question over on the Legato forums several weeks ago to no avail - see link at bottom.  
Perhaps someone on the more hardware-oriented mangOH forum is able to assist me?

Basically, I need the modem to react (by resuming from suspend mode) on an edge-triggered GPIO interrupt on GPIO21. This _should_ be possible according to my interpretation the WP8548 Product Technical Specification. However, this only works if the system hasn’t already suspended. My system must remain suspended for power conservation but also maintain registration on a cellular network.

I have verified that the system resumes from suspend mode on logic level transitions on pin UIM1\_DET and UIM2\_DET. Presumably the modem’s firmware is handling this.  
Besides configuring the GPIO edge sense and providing a change event callback handler, do I need to do anything else to get this working?

Thanks,  
Raf

> **[Wake up from suspend mode on GPIO interrupt](https://forum.legato.io/t/wake-up-from-suspend-mode-on-gpio-interrupt/2605?u=raf)**
>
> Hi, I’d like to wake the modem up from suspend mode from a GPIO edge-triggered event. I’m trying to implement a software-driven ‘power button’ to safely shutdown the system when a button is pressed. My current setup is as follows. Module: WP8548 ...

---

<div class="post-metadata">

**Author:** ![Raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Raf](https://mangoh.discourse.group/u/Raf)\
**Post date:** [October 11, 2017, 11:37pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/2 "2017-10-11T23:37:51Z")

</div>

Hi,

Is someone from the mangOH or SWI team able to comment on this please?

When the module is `suspended` with the USB cable disconnected, I gather this is not `USB-SS Mode`? If so, how do we make the system respond to GPIO change events in this state?

Currently, I’ve resorted to running a polling timer to periodically wake the system up and check the GPIO state which is unfortunate because it means that either:

1. The reaction time is very slow - long polling interval needed to save power.
2. Fast reaction time but the system essentially never suspends, thus no power saving at all.

As mentioned in my previous post, ULPM is not being used because maintaining registration on a cellular network is essential. Furthermore, if the `wake-up from ULPM` interval is frequent enough, the benefits gained from entering ULPM are almost outweighed by the power consumed during system boot-up (70mA-90mA) and restricted by the system boot-up time (approx. 40 seconds).

Any assistance would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [October 13, 2017, 3:49am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/3 "2017-10-13T03:49:30Z")

</div>

Hi Raf,

Does your module goto SS mode?  
Have you tried to wake up the modules from the wakeable GPIOs as shown in the PTS? Y  
:4.9 Wakeup Interrupt (USB-SS Mode)  
The following pins can be used to wake the device when it is in USB-SS mode (lowpower  
active state):  
• GPIO2  
• GPIO21  
• GPIO36  
• GPIO38  
• GPIO39  
• GPIO42  
• UIM1\_DET  
• UIM2\_DET

regards,  
Ashish

---

<div class="post-metadata">

**Author:** ![Raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Raf](https://mangoh.discourse.group/u/Raf)\
**Post date:** [October 13, 2017, 4:25am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/4 "2017-10-13T04:25:42Z")

</div>

Hi Ashish,

Thanks for the response.

Yes, the module does enter USB-SS mode. The `enable_autosleep.sh` script runs at boot, I don’t have `devMode` installed, and I can see a message on the UART2 console output when the USB cable is unplugged.

I have tried several of the wakeable GPIOs as per the PTS; GPIO21 and GPIO42. These work provided the module hasn’t entered a “deep-sleep” or “suspended” state, eg. USB cable unplugged. I measure ~2mA when the module is in this state which seems to match the current consumption values in the PTS.

I can’t use GPIO36, GPIO38 nor GPIO39 for anything but wakeup events from ULPM since they are accessible via `sysfs/Legato` only (as per the PTS). I can confirm that the module does wake up from ULPM from GPIO36.

Additionally, I have verified that the system resumes from suspend mode on logic level transitions on pin UIM1\_DET and UIM2\_DET.

Raf

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [October 13, 2017, 4:28am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/5 "2017-10-13T04:28:19Z")

</div>

Hi Raf,

Let me check with the team about GPIO21 and GPIO42. I wonder if you need to set them in some special mode using AT commands.

Ashish

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [October 15, 2017, 4:30am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/6 "2017-10-15T04:30:59Z")

</div>

we have opened a ticket internally on this topic and will get back to you.

---

<div class="post-metadata">

**Author:** ![Raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Raf](https://mangoh.discourse.group/u/Raf)\
**Post date:** [October 15, 2017, 11:12pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/7 "2017-10-15T23:12:56Z")

</div>

Thank you, Ashish.

If there’s anything else I can do on my end to assist please let me know.

---

<div class="post-metadata">

**Author:** ![Raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Raf](https://mangoh.discourse.group/u/Raf)\
**Post date:** [November 20, 2017, 10:48pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/8 "2017-11-20T22:48:44Z")

</div>

Hi Ashish,

Has there been any update internally on this?

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [November 30, 2017, 7:37am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/9 "2017-11-30T07:37:40Z")

</div>

Raf,

We are working on fixing it. It will be fixed in WP76 first and then on WP85.

Ashish

---

<div class="post-metadata">

**Author:** ![mrjoso](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mrjoso](https://mangoh.discourse.group/u/mrjoso)\
**Post date:** [February 24, 2018, 9:43pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/10 "2018-02-24T21:43:47Z")

</div>

Hi Ashish,  
It seems I have the same issuse as Raf described but on WP7502  
I tried GPIO38 a GPIO36. It works correctly when USB is connected.  
It there a solution?

Legato: 18.01.0\_727a1e916bc293f90e617778c2037b58\_modified  
Device: WP7502  
Firmware Version: SWI9X15Y\_07.12.09.00  
Thank you.

---

<div class="post-metadata">

**Author:** ![mrjoso](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mrjoso](https://mangoh.discourse.group/u/mrjoso)\
**Post date:** [June 21, 2019, 3:47pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/11 "2019-06-21T15:47:56Z")

</div>

Hi Ashish,  
according to QTI9X06-167 in WP77xx Release 11.  
The GPIO36 and GPIO38 still do not work properly, but the workaround exists.  
How to “explicitly re-enable the interrupt”?

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [June 21, 2019, 6:21pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/12 "2019-06-21T18:21:48Z")

</div>

I will ask internally and get back to you next week

---

<div class="post-metadata">

**Author:** ![mrjoso](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mrjoso](https://mangoh.discourse.group/u/mrjoso)\
**Post date:** [July 2, 2019, 12:53pm UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/13 "2019-07-02T12:53:26Z")

</div>

Hi Ashish, thank you for your willingness.  
Did you find any details internally?

---

<div class="post-metadata">

**Author:** ![kalaivani](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/kalaivani/32/2183_2.png) [@kalaivani](https://mangoh.discourse.group/u/kalaivani)\
**Post date:** [May 4, 2021, 6:40am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/14 "2021-05-04T06:40:03Z")

</div>

hi , any sample available for suspend and wake , can anyone guide with the basic sample to put system in sleep and wake after some time

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [May 4, 2021, 7:21am UTC](https://mangoh.discourse.group/t/wake-up-from-suspend-mode-on-gpio-interrupt/720/15 "2021-05-04T07:21:31Z")

</div>

You can see this document:

[How to use GPIO as wakeup source on WP77xx MangOH Red board.docx](https://mangoh.discourse.group/uploads/short-url/diDlJsO0zM30ult8zcIgI2mrBVO.docx) (277.1 KB)
