I am trying to use GPIO4 as output high and GPIO5 as input. To set these pins, i execute AT+WIOM=2015,16 once. Then i use a timer with the interval of 2 seconds, to read GPIO5 value. The timer executes AT+WIOR=5 on every cycle by using adl_atcmdcreate function. And i get the AT response correctly.
There is no problem up to here(i think). But This timer operation affects on my other AT commands being executed in other functions. For exemple, it blocks my AT+IPR commands. Module can not executes AT+IPR commands while timer is active. When i dont start the timer, my AT+IPR commands works perfercly.
I could not find any solution and i could not define the problem exactly. What could cause the module reacts this way?
Thank you for your reply but i have already tried to use gpio service. But the behaviour is the same. I used adl_ioSubscribe function to set and read GPIO values with in an interval. I can successfully read GPIO5 input value but my other AT commands are blocked again.
Also i used adl_atcmdcreate(“AT+WIOR=5\r”, ADL_AT_PORT_TYPE( ADL_PORT_OPEN_AT_VIRTUAL_BASE , FALSE) , “" , NULL); insead of adl_atcmdcreate(“AT+WIOR=5\r”, ADL_AT_PORT_TYPE( ADL_PORT_UART1 , FALSE) , "” , NULL); but no success.
What else can i try? I really wonder what causes this.
I have custom AT commands but I dont execute them. So i think it is not related with the problem. I want to write some piece of code here:
static bool rspHandler_WIOR(adl_atResponse_t *paramsWIOR)
{
// get GPIO5 input value here
return FALSE;
}
static void Check_P5(u8 id)
{
// execute this command to get GPIO5 input value
adl_atCmdCreate( "AT+WIOR=5\r", ADL_AT_PORT_TYPE(ADL_AT_UART1, FALSE), rspHandler_WIOR, "*", NULL);
}
// Subscribe a timer to get GPIO5 input value every 2 seconds
adl_tmrSubscribe( TRUE, 20, ADL_TMR_TYPE_100MS, Check_P5 );
if i dont subscribe this timer written on the last code block, my other AT commands work perfecly.
And here is my other AT command which is executed to change baud rate
// callback function rspHandler_IPR is not triggered when the timer is subscribed!
adl_atCmdCreate( "AT+IPR=9600\r", ADL_AT_PORT_TYPE(ADL_AT_UART1, FALSE), rspHandler_IPR, "*", NULL);
So you’re trying to issue an AT command every 2s - don’t you think that might be a bit quick?
What happens if you reduce the rate?
And, again, why are you messing with AT commands? Why not use the GPIO service?
If you really can’t find it, then go right back to basics: re-start your application, adding just 1 feature at a time - when it stops working, you know that the last feature added is the one to look at!