Help with GPIO


#1

I am trying to read a gpio but when i subscribe i always get ADL_RET_ERR_PARAM (-2)
This is what i do

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

and my handler is

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)


#2

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


#3

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

What version are you using?

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


#4

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


#5

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


#6

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


#7

That’s correct.

You may also use later versions

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


#8

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?


#9

sure, you never supply a handler-function

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:

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

it will work