# Help with GPIO

**URL:** <https://forum.sierrawireless.com/t/help-with-gpio/1975>\
**Category:** Open AT\
**Created:** [March 8, 2008, 5:29pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975 "2008-03-08T17:29:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergiulungu](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sergiulungu](https://forum.sierrawireless.com/u/sergiulungu)\
**Post date:** [March 8, 2008, 5:29pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/1 "2008-03-08T17:29:10Z")

</div>

I am trying to read a gpio but when i subscribe i always get ADL\_RET\_ERR\_PARAM (-2)  
This is what i do

```auto
s8 GPIO_Handle;
GPIO_Handle = adl_ioSubscribe ( ADL_IO_Q24X6_GPIO_4,0xFFFFFFFF,0, 10, GPIO_TELE_handler);
```

and my handler is

```auto
void GPIO_TELE_handler( u8 gpio_handle, u32 gpio_result ){
	// do someting here
}
```

What i am doing wrong for me it seems all fine? (I looked at the telemetry example but it just confused me)

---

<div class="post-metadata">

**Author:** ![trthaithong](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@trthaithong](https://forum.sierrawireless.com/u/trthaithong)\
**Post date:** [April 23, 2008, 7:01am UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/2 "2008-04-23T07:01:08Z")

</div>

It should be run well, I have tried it. Are you sure that you do not use this GPIO pin for another function?  
ttt

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [April 23, 2008, 7:59am UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/3 "2008-04-23T07:59:13Z")

</div>

GPIO handling has changed a lot between different Open-AT versions! 😮

What version are you using?

Are you sure that you are using the correct API…?

---

<div class="post-metadata">

**Author:** ![sergiulungu](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sergiulungu](https://forum.sierrawireless.com/u/sergiulungu)\
**Post date:** [April 24, 2008, 8:06pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/4 "2008-04-24T20:06:01Z")

</div>

i am pretty sure that i am not using this for something else  
i have OpenAT OS v3.13.02

---

<div class="post-metadata">

**Author:** ![optomation](https://avatars.discourse-cdn.com/v4/letter/o/8e8cbc/32.png) [@optomation](https://forum.sierrawireless.com/u/optomation)\
**Post date:** [May 12, 2008, 4:05pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/5 "2008-05-12T16:05:48Z")

</div>

Hello segiulungu,  
I’m more or less in the same pitfall.

As I understood from my distributor:  
OpenAT v3.x cannot be used with Fastrack Supreme  
OpenAT v4.x cannot be used with Fastrack M1306B

If your are using a Fastrack Supreme then you MUST use OpenAT v4.x (instead of v3,13).  
I’ve check the ADL User’s Guide of both versions and the GPIO section is completely different.

If anyone reads this, please also read my cry:  
[viewtopic.php?f=19&t=2306](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=19&t=2306)

---

<div class="post-metadata">

**Author:** ![tele\_syst](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@tele\_syst](https://forum.sierrawireless.com/u/tele_syst)\
**Post date:** [June 14, 2008, 8:13pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/6 "2008-06-14T20:13:49Z")

</div>

If you use not Q24x6 type modem this my be source of problem .

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 15, 2008, 5:38am UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/7 "2008-06-15T05:38:39Z")

</div>

> [@optomation](#):
>
> As I understood from my distributor:  
> OpenAT v3.x cannot be used with Fastrack Supreme  
> OpenAT v4.x cannot be used with Fastrack M1306B

That’s correct.

> [@](#):
>
> If your are using a Fastrack Supreme then you MUST use OpenAT v4.x (instead of v3,13).

You may also use later versions

> [@](#):
>
> I’ve check the ADL User’s Guide of both versions and the GPIO section is completely different.

Very true! 😮  
There are also some further changes in later versions

---

<div class="post-metadata">

**Author:** ![Ryan](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@Ryan](https://forum.sierrawireless.com/u/Ryan)\
**Post date:** [May 7, 2009, 8:27pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/8 "2009-05-07T20:27:11Z")

</div>

I’m having the same problem with OASIS 2.20. Here is my code:

static s32 gpioEventHandle = -1;  
static adl\_ioDefs\_t gpioDefine = ADL\_IO\_GPIO | ADL\_IO\_DIR\_IN | 10;  
static s32 gpioHandle = -1;

//Turned off keyboard scanning to free up GPIO 10

```
  // In order to set-up an automatic GPIO polling process, the adl_ioEventSubscribe()
  // function has to be called before the adl_ioSubscribe().
  gpioEventHandle = adl_ioEventSubscribe(GpioHandler);
  if (gpioEventHandle < 0 )
  {
     DEBUG_TRACE((DEBUG_LEVEL_ERROR, "ERROR: adl_ioEventSubscribe() failed. gpioEventHandle=%d", gpioEventHandle));
     DEBUG_PRINT_ADL_ERROR((DEBUG_LEVEL_ERROR, gpioEventHandle));
  }

  gpioHandle = adl_ioSubscribe(1, &gpioDefine, ADL_TMR_TYPE_100MS, 3, 0);
  if (gpioHandle < 0)
  {
     DEBUG_TRACE((DEBUG_LEVEL_ERROR, "ERROR: adl_ioSubscribe() failed. gpioHandle=%d", gpioHandle));
     DEBUG_PRINT_ADL_ERROR((DEBUG_LEVEL_ERROR, gpioHandle));
     if (gpioHandle == ADL_RET_ERR_DONE)
     {
        DEBUG_TRACE((DEBUG_LEVEL_ERROR, "ERROR: gpioDefine & ADL_IO_GERR_MSK = 0x%x", gpioDefine & ADL_IO_GERR_MSK));
        DEBUG_TRACE((DEBUG_LEVEL_ERROR, "ERROR: gpioDefine & ADL_IO_ERR_MSK = 0x%x", gpioDefine & ADL_IO_ERR_MSK));
     }
  }

```

As written above, adl\_ioSubscribe() returns the error ADL\_RET\_ERR\_PARAM always. If I remove the timer type and timer value then adl\_ioSubscribe() return success. Why?

Any ideas?

---

<div class="post-metadata">

**Author:** ![Madouc](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Madouc](https://forum.sierrawireless.com/u/Madouc)\
**Post date:** [May 7, 2009, 11:13pm UTC](https://forum.sierrawireless.com/t/help-with-gpio/1975/9 "2009-05-07T23:13:53Z")

</div>

> [@Ryan](#):
>
> Any ideas?

sure, you never supply a handler-function

> [@Ryan](#):
>
> gpioHandle = adl\_ioSubscribe(1, &gpioDefine, ADL\_TMR\_TYPE\_100MS, 3, [size=150]0[/size] );

If I remove the timer type and timer value then adl\_ioSubscribe() return success.  
[/quote]  
if you don’t use polling (set the timer type and value to 0) you don’t need a handler-function. so that succeeds.

if you rephrase it like this:

```auto
gpioHandle = adl_ioSubscribe(1, &gpioDefine, ADL_TMR_TYPE_100MS, 3, GpioHandler);
```

it will work
