# ULPM Boot on GPIO Issue

**URL:** <https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942>\
**Category:** mangOH Red\
**Created:** [November 28, 2017, 2:37pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942 "2017-11-28T14:37:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewwestrick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/drewwestrick/32/270_2.png) [@drewwestrick](https://mangoh.discourse.group/u/drewwestrick)\
**Post date:** [November 28, 2017, 2:37pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/1 "2017-11-28T14:37:47Z")

</div>

I’m having a problem setting up ULPM to boot via GPIO. When I use the sample code listed in the Legato API I get the following error when I shut the device down. I’m using ULPM firmware version 002.004. If I change the LE\_ULPM\_GPIO\_HIGH to LE\_ULPM\_GPIO\_RISING I don’t get an error anymore but the device also won’t come out of shutdown when I apply 1.8V to GPIO 36. Any help would be greatly appreciated.

> Nov 21 12:55:42 | powerManagerService[633]/powerMgr T=main | le\_ulpm.c WriteToSysfs() 146 | Error writing to sysfs file ‘/sys/module/swimcu\_pm/boot\_source/enable’ (Input/output error).

> Nov 21 12:55:42 | lowpower[1563]/LowPowerComponent T=main | LowPowerComponent.c \_LowPowerComponent\_COMPONENT\_INIT() 23 | Can’t initiate shutdown

Here is the code I’m using:

> COMPONENT\_INIT  
> {  
> char version[LE\_ULPM\_MAX\_VERS\_LEN+1];  
> // Connect to service  
> le\_ulpm\_ConnectService();
> 
> // Get ultra low power manager firmware version  
> LE\_FATAL\_IF(le\_ulpm\_GetFirmwareVersion(version, sizeof(version)) != LE\_OK,  
> “Failed to get ultra low power firmware version”);
> 
> LE\_INFO(“Ultra Low Power Manager Firmware version: %s”, version);
> 
> // Boot after 1000 second of shutdown.  
> LE\_ERROR\_IF(le\_ulpm\_BootOnTimer(120) != LE\_OK, “Can’t set timer as boot source”);
> 
> // Boot if GPIO36 voltage level is high.  
> LE\_ERROR\_IF(le\_ulpm\_BootOnGpio(36, LE\_ULPM\_GPIO\_HIGH) != LE\_OK, “Can’t set gpio36 as boot source”);
> 
> sleep(60);  
> // Initiate shutdown.  
> LE\_ERROR\_IF(le\_ulpm\_ShutDown() != LE\_OK, “Can’t initiate shutdown”);  
> }

---

<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 28, 2017, 11:21pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/2 "2017-11-28T23:21:21Z")

</div>

Hi @drewwestrick

I too have had this issue when attempting to shutdown after setting up any of the ULPM GPIOs to boot on `LE_ULPM_GPIO_HIGH`. All other trigger options (rising, falling, low) succeed and the module shuts down correctly on the first call of `le_ulpm_ShutDown()`.

I’ve found that if you persist and periodically attempt the set the boot source as `LE_ULPM_GPIO_HIGH` and call the ulpm shutdown function it will eventually succeed. My system runs a timer with a callback funtion to do just that.

Unfortunately, this is only a workaround. You could try running that small snippet of code in a loop or setup a timer to do the work and see if that get’s things working for you in the meantime.

Hopefully someone from Sierra will have an answer.

Raf

---

<div class="post-metadata">

**Author:** ![drewwestrick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/drewwestrick/32/270_2.png) [@drewwestrick](https://mangoh.discourse.group/u/drewwestrick)\
**Post date:** [November 29, 2017, 12:04pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/3 "2017-11-29T12:04:41Z")

</div>

@Raf

Thanks for the insight regarding the `LE_ULPM_GPIO_HIGH` signal. It is definitely odd that you need to call that function and the shutdown function multiple times to get that to set properly.

When you setup the pin for rising, falling, or low does the device successfully come out of ULPM for you? I’ve tried several of those settings and toggled the proper pin but haven’t been able to get the device to successfully reboot other than the `POWER_ON` button.

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [November 29, 2017, 12:14pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/4 "2017-11-29T12:14:35Z")

</div>

Do you have the `devmode` app installed? I think I remember that causing ULPM to fail.

---

<div class="post-metadata">

**Author:** ![drewwestrick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/drewwestrick/32/270_2.png) [@drewwestrick](https://mangoh.discourse.group/u/drewwestrick)\
**Post date:** [November 29, 2017, 12:27pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/5 "2017-11-29T12:27:32Z")

</div>

@dfrey

Yes, I did uninstall devMode. When running it won’t let the device enter ULPM. I can get the device to go into ULPM but can’t get it come back out even when I use the `le_ulpm_BootOnGpio` to setup a GPIO wake-up source. I can get the device to wake up using the timer source, however.

---

<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 29, 2017, 11:32pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/6 "2017-11-29T23:32:27Z")

</div>

@drewwestrick

It is odd. Occasionally it will work first time but more often than not it needs another “kick”, or two.

I’ve been successful in booting from ULPM with pins setup for HIGH and LOW but my module (WP8548) is on a custom PCB and not on mangOH Red.

1. Which 1.8V supply are you using to set the level on the GPIOs?

2. Can you measure 1.8V on the GPIO(s) when the module is in ULPM?

3. What are your Module Signal Control (SW401) dip positions?

---

<div class="post-metadata">

**Author:** ![drewwestrick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/drewwestrick/32/270_2.png) [@drewwestrick](https://mangoh.discourse.group/u/drewwestrick)\
**Post date:** [November 30, 2017, 12:50am UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/7 "2017-11-30T00:50:17Z")

</div>

@Raf

Right now I’m using the `1V8_ULMP` which is enabled using I beliteve pin 3 on the SW401 dip switch. I’ve measured the voltage with a meter when the device is powered down and still see 1.8V. I’m using that voltage and tapping it to the proper GPIO pin on the same header on the mangOH Red.

I’m wondering if I need to apply some pull up or pull down resistors to create a sharp edge for wake up.

Do you know if the GPIO pins on these modules have weak internal pull-ups?

---

<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 30, 2017, 2:45am UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/8 "2017-11-30T02:45:45Z")

</div>

@drewwestrick

Here’s a link to the product technical specification:  
[https://source.sierrawireless.com/resources/airprime/hardware\_specs\_user\_guides/airprime\_wp75xx\_wp8548\_product\_technical\_specification\_rev\_13/](https://source.sierrawireless.com/resources/airprime/hardware_specs_user_guides/airprime_wp75xx_wp8548_product_technical_specification_rev_13/)

See Table 10-1 on page 121.  
According to the PTS: GPIO36, GPIO38 and GPIO39 have no internal pull-up or pull-down resistors (denoted NP).

Adding a pull-down if you want to boot on `LE_ULPM_GPIO_HIGH` is a good idea.

FYI, we have the wakeable GPIOs buffered through level translators on our design so they’re not left floating.

For the sake of testing, another way to quickly invoke and configure ULPM is from the command line with [pmtool](http://legato.io/legato-docs/latest/toolsTarget_pmTool.html).

---

<div class="post-metadata">

**Author:** ![drewwestrick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/drewwestrick/32/270_2.png) [@drewwestrick](https://mangoh.discourse.group/u/drewwestrick)\
**Post date:** [November 30, 2017, 7:24pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/9 "2017-11-30T19:24:46Z")

</div>

After doing some more testing I’ve found that using ADC1 and ADC2 work just fine as boot sources. I’m still having issues getting GPIO 36 or 38 to work however.

If I use the pmtool to setup a GPIO boot source via:  
`pmtool bootOn 36 low`

I get the following error:  
`Bad boot source: 36`

I also looking into which GPIOs are setup using the following AT command: `AT+WIOCFG?`

> +WIOCFG: 2,0,0,0,1,0,0  
> +WIOCFG: 7,0,0,0,1,0,0  
> +WIOCFG: 8,0,0,0,1,0,0  
> +WIOCFG: 13,0,0,0,1,0,0  
> +WIOCFG: 21,0,0,0,1,0,0  
> +WIOCFG: 22,0,0,0,1,0,0  
> +WIOCFG: 23,0,0,0,1,0,0  
> +WIOCFG: 24,0,0,0,1,0,0  
> +WIOCFG: 25,0,0,0,1,0,0  
> +WIOCFG: 32,0,0,0,1,0,0  
> +WIOCFG: 33,0,0,0,1,0,0  
> +WIOCFG: 35,0,0,0,1,0,0  
> +WIOCFG: 42,0,0,0,1,0,0

As you can see pin 36 and 38 aren’t setup as GPIOs. I’m not sure if they should or should not be, just some additional information. It also may help to know I’m using a `WP7603` as my module currently.

---

<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, 8:59pm UTC](https://mangoh.discourse.group/t/ulpm-boot-on-gpio-issue/942/10 "2017-11-30T20:59:09Z")

</div>

We are working towards the fix for WP76 and the fix is currently being tested by the teams
