GPIO control?


#1

hi

I am trying to write a code to make a flasher using GPIOs. But I couldn’t achieved. According to code it must work but when I measure related I/O pin I can’t see any difference.

Q2406B
OpenAT 3.02
GCC

void adl_main ( adl_InitType_e InitType )
{
   TRACE((1,"Embedded application main"));


   GpioHandle = adl_ioSubscribe(ADL_IO_Q24X6_GPIO_5,0,0,0,(adl_ioHdlr_f)NULL);

   adl_atUnSoSubscribe("+WIND: 4",(adl_atUnSoHandler_t)Wind4_Handler);
   
}

s16 Wind4_Handler(adl_atUnSoHandler_t *paras)
{
timerHandleFlashIO = adl_tmrSubscribe(TRUE,5, ADL_TMR_TYPE_100MS,(adl_tmrHandler_t)timerFuncFlashIO);
return TRUE;
}

void timerFuncFlashIO(u8 timerid)
{

s8 ReturnCode;
ascii buffer[30];

if(toggle == 0)
   toggle=1;
else if(toggle != 0)
   toggle = 0;
   
ReturnCode = adl_ioWrite(GpioHandle,ADL_IO_Q24X6_GPIO_5,toggle);

if(ReturnCode == ADL_RET_ERR_UNKNOWN_HDL)
   adl_atSendResponse(ADL_AT_UNS,"\r\nADL_RET_ERR_UNKNOWN_HDL");
else if(ReturnCode == ADL_RET_ERR_PARAM)
   adl_atSendResponse(ADL_AT_UNS,"\r\nADL_RET_ERR_PARAM");
else if(ReturnCode == ADL_RET_ERR_FATAL)
   adl_atSendResponse(ADL_AT_UNS,"\r\nADL_RET_ERR_FATAL");

if(ReturnCode == ADL_ERR_IO_WRITE)
   adl_atSendResponse(ADL_AT_UNS,"\r\nADL_ERR_IO_WRITE");
else if(ReturnCode == OK)
   adl_atSendResponse(ADL_AT_UNS,"\r\nReturnCode of ioWrite is OK");


   wm_sprintf(buffer,"\r\nReturnCode == %d\r\n",ReturnCode);
   adl_atSendResponse(ADL_AT_RSP,buffer);
}

what do You think?


#2

Hello,

This is high level:

adl_ioWrite (GpioHandle,ADL_IO_Q24X6_GPIO_5,ADL_IO_Q24X6_GPIO_5);

low level:

adl_ioWrite (GpioHandle, ADL_IO_Q24X6_GPIO_5, 0);

You have to set the corresponding bit in the the third parameter of adl_ioWrite(). You set the first byte of the mask, which is probably not the ADL_IO_Q24X6_GPIO_5.

And note that the ADL_IO_Q24X6_GPIO_5 is multiplexed with UART2!

Regards,
tom


#3

Hi Piedos,

I already pointed out that mistake to you, see http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?t=105

How come your code is still wrong, and you posted in the other thread that it doesn’t work? Of course it doesn’t work if you didn’t make the changes I was suggesting…

Best Regards,
Jan