Q24+ writing to GPO1

Hello,

I have the following setup:
Q24Plus (Q24PL003), OpenAT 3.13
I’m using the WIP plugin, but in this example I don’t open a socket.

I’m trying to work with GPO1 and I’m not able to toggle the pin like I thought I should be able to.

Following is my code:

s8 init_gpo1(void)
{ 
    return adl_ioSubscribe (ADL_IO_Q24PLUS_GPO_1, 0, 0x00000000, 0, NULL);  
}

void ioWriter(void)
{
   static testFlag=FALSE;
   s8 result;
   if(testFlag)
   {
      result = adl_ioWrite( (u8) gpio_handle, ADL_IO_Q24PLUS_GPO_1, 0);
      if(result!=OK)
        TRACE((1, "cannot reset GPO1 "));
      else
        TRACE((1, "IO tester reset "));
      testFlag = FALSE;
   }
   else
   {
      result = adl_ioWrite( (u8) gpio_handle, ADL_IO_Q24PLUS_GPO_1, ADL_IO_Q24PLUS_GPO_1);
      if(result!=OK)
        TRACE((1, "cannot set GPO1 "));
      else
        TRACE((1, "IO Tester Set "));
      testFlag = TRUE;
   }
}

void timerHandler(u8 id)
{
    ioWriter(); //toggle every 500 ms    
}

static s8 gpio_handle = -1;
adl_tmr_t *tt;
u16 timeout_period = 5;      

void appli_entry_point() 
{
  gpio_handle=init_gpo1();  
  wip_debug( "[GPIO]: gpio_handle %i...\n", gpio_handle);
  tt=adl_tmrSubscribe(TRUE,timeout_period,ADL_TMR_TYPE_100MS,(adl_tmrHandler_t)timerHandler);
}

All this code does is toggle GPO_1 every 500 ms. I have an oscilliscope attached to my GPO_1 pin and I don’t see the voltage level change. It’s always “low”.

The value of gpio_handle is 5. In ioWriter, the adl_ioWrite calls always return “OK”.

Any ideas what’s wrong?

Thanks in advance,
Coleman

I use ADL_IO_Q24PLUS_GPO_1 in my project. It work.
I see your code. I not find any problem.
This probably is hardware problem.

Thank you for your reply. This was user error in that I had my scope lead on the wrong pin. :blush:

It also turns out that I needed to use GPO_0, which works as well.

It’s my hope that this code can serve as a simple example of how to write to an output. IMHO, this is something the SDK examples are lacking.