Gpio handle 0n q2686


#1

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

#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.


#2

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


#3

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


#4

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


#5

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 ?


#6

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.


#7

I redefine the code and removed the adl_ioConfig_t definition and now i get

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

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