# Gpio handle 0n q2686

**URL:** <https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176>\
**Category:** Legacy AirPrime modules\
**Created:** [March 11, 2007, 2:56pm UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176 "2007-03-11T14:56:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![embeddedOne](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@embeddedOne](https://forum.sierrawireless.com/u/embeddedOne)\
**Post date:** [March 11, 2007, 2:56pm UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/1 "2007-03-11T14:56:38Z")

</div>

Hello.  
Firstly i was making flasher for gpio pin 5, but i give up. Now im just testing the gpio handle with this code:

```auto
#include "adl_global.h"

u32 wm_apmCustomStack [1024];
s8 GpioHandle;
const u32 wm_apmCustomStackSize = sizeof ( wm_apmCustomStack );
adl_ioConfig_t Gpio5Config [1] = {{ ADL_IO_Q2686_GPIO_5, 0, ADL_IO_OUTPUT, ADL_IO_HIGH }};
//-----------------------------------------------------------
u8 Gpio5=0;

void Gpio5_TimerHandler ( u8 ID )
{
   if(Gpio5 == 0)
   {
      TRACE (( 3, "PIN 5 HIGH" ));
      adl_ioWriteSingle(GpioHandle, ADL_IO_Q2686_GPIO_5, ADL_IO_HIGH);
      Gpio5=1;
   }else{
      TRACE (( 3, "PIN 5 LOW" ));
      Gpio5 = 0;
      adl_ioWriteSingle(GpioHandle, ADL_IO_Q2686_GPIO_5, ADL_IO_LOW);
   }
}
void setGpio (void)
{
   GpioHandle = adl_ioSubscribe ( 1, Gpio5Config, 0, 0, 0 );
   adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, Gpio5_TimerHandler );
}
//------------------------------------------------------------
void adl_main ( adl_InitType_e InitType ){
	s8 Returncode;
	TRACE (( 1, "Start" ));
	GpioHandle = adl_ioSubscribe(ADL_IO_Q2686_GPIO_5,0,0,0,(adl_ioHdlr_f)NULL);
}
```

but in the trace i get [ADL] Gpio subs 7 0 : -2 and thats it.  
What’s is the meanning of -2. Wrong declaration ? Anyway, the code is not working.

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [March 12, 2007, 11:12am UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/2 "2007-03-12T11:12:14Z")

</div>

Hello,

I had the same problem with OS 6.61,OAT 4.10.  
I’ve just tried with beta OS 6.62,OAT 4.20 and the same code is working now.  
Give it a try on OS 6.62. Final OS 6.62 is expected in mid-april.

Best Regards,

tom

---

<div class="post-metadata">

**Author:** ![Wallace](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@Wallace](https://forum.sierrawireless.com/u/Wallace)\
**Post date:** [March 12, 2007, 1:52pm UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/3 "2007-03-12T13:52:17Z")

</div>

Hi,

GPIO5 is multiplexed with Keypad interface. So if keypad interface is enabled you cannot subscribe it.

use AT+WHCNF command (forgot parameter) to disable keypad function and retry

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [March 12, 2007, 3:57pm UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/4 "2007-03-12T15:57:48Z")

</div>

Hello,

Yes Wallece, you’re right. GPIO5 is multiplexed with keypad by default configuration. However, with activated keypad the correct adl\_ioSubscribe() answer would be “ADL\_RET\_ERR\_ALREADY\_SUBSCRIBED” (-4 value) not “ADL\_RET\_BAD\_PARAM” (-2 value).

Best Regards,

tom

---

<div class="post-metadata">

**Author:** ![embeddedOne](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@embeddedOne](https://forum.sierrawireless.com/u/embeddedOne)\
**Post date:** [March 12, 2007, 6:16pm UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/5 "2007-03-12T18:16:28Z")

</div>

Hello.  
I tryed with few others different gpios and i get the same result so i guess i have to wait for new version.

In the meantime, do you have some tested code where i can set input and output pin and test it on my target ?

---

<div class="post-metadata">

**Author:** ![Wallace](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@Wallace](https://forum.sierrawireless.com/u/Wallace)\
**Post date:** [March 13, 2007, 8:38am UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/6 "2007-03-13T08:38:36Z")

</div>

Hi,  
For me (started with 6.61 firmware + OpenAT 4.11) I do not get error -2.  
But now 4.12 is available so we may go for it.

---

<div class="post-metadata">

**Author:** ![embeddedOne](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@embeddedOne](https://forum.sierrawireless.com/u/embeddedOne)\
**Post date:** [March 14, 2007, 2:28pm UTC](https://forum.sierrawireless.com/t/gpio-handle-0n-q2686/1176/7 "2007-03-14T14:28:22Z")

</div>

I redefine the code and removed the adl\_ioConfig\_t definition and now i get

> [@](#):
>
> Trace 23 [ADL] Gpio Single Write -4 : -2.

What is the meaning of -2 ?  
I know that -4 stands for already subscribed but what is -2.

> [@](#):
>
> GpioHandle = adl\_ioSubscribe (ADL\_IO\_Q2686\_GPIO\_19,0,0,0,(adl\_ioHdlr\_f)NULL);

p.s. i have set pin 19 as test pin and this pin is free.
