it blocks adl_atCmdCreate

i use Fastract wismo inside (Q24x6 I think), V310. It has 10 IOs. I execute AT+WIOM=2015,16 to set GPIO4 output high and GPIO5 input. (1111011111),(0000010000). Then i check AT+WIOR=5 value every 100 miliseconds with a timer. I use adl_atCmdCreate(“AT+WIOR=5”…) to check input value. Everything works fine but when i try to execute adl_atCmdCreate(“AT+CCLK?”) in an other function on the software, it gives me nothing or +WIOR: 1 response.

So I think modem is confused about adl_atCmdCreate responses because I execute AT+WIOR=5 every 100 ms. How can i prevent this confusion? Or Is the problem related to something else?

As you’re doing this from an Open-AT application, why don’t you just use the ADL GPIO service?!

I have started with this way. And i dont know wheater the problem will be over or not when i use adl_gpio service. I think i may face the same problem but there are not many choices. i will try with adl_gpio and i hope it will work. I will write my results.

The ADL GPIO service can be set to automatically poll the inputs, so that your application does not have to do it - thus obviating your problem!

Hi awneil,
I tried adl_gpio service but i have some problems. Insead of creating a new topic, i want to write here. At the beginning of my application, i try to subscribe GPIO4 as output and high, also GPIO5 as input. I try to use adl_ioSubscribe function, like the way documentation tells, but i can not get IO changes.
let me explain more. I have Q26x6 modem and V310 firmware. i tried to apply what documentation tells about io service like following:

void IOHandler(u8 GpioHandle, u32 GpioState)
void StartIO()
 if(adl_ioSubscribe(ADL_IO_Q24X6_GPIO_4 | ADL_IO_Q24X6_GPIO_5, 1, 0xFFFFFFFF, 1, IOHandler)>0)
  WriteToScreen("SUBSCRIBE OK\r\n");

When i execute the function StartIO, It responses SUBSCRIBE OK, CHANGED but then when i change the input value, it doesnt trigger the IOHandler function again.

I am not sure about the parameters that i supplied to adl_ioSubscribe function. GPIO4 must be set to output-high and GPIO5 must be set to input and whenever GPIO5 value gets changed IOHandler function must be triggered. So Is there anything wrong in my code?

The title of the thread no longer has anything to do with the subject you are now discussing!

How did you “change” the input value?

So document each one carefully with comments; eg,

result = adl_ioSubscribe
      ADL_IO_Q24X6_GPIO_4 | ADL_IO_Q24X6_GPIO_5, // what does this do?
      1,                                         // what does this do?
      0xFFFFFFFF,                                // what does this do?
      1,                                         // what does this do?
      IOHandler                                  // what does this do?

I change the input value with an external switch. It works OK when i use AT+WIOR command. So the problem is not releated with switch.
I read the documentation carefully. I write what documentation says about parameters.

adl_ioSubscribe (
ADL_IO_Q24X6_GPIO_4 | ADL_IO_Q24X6_GPIO_5, // here you write which pins to subscribe with logical OR between them.
1,// Mask of GPIO directions to subscribe.For each allocated GPIO, the corresponding bit in the mask should be set to 0 for output, 1 for input.
0xFFFFFFFF,//Mask of GPIO default values when set as an output. If it is set to 0xFFFFFFFF, all subscribed output GPIOs are set to 1.
1,// If some IO is allocated as input, this parameter represents the time interval between two GPIO polling operations (unit is 100ms).
IOHandler // Handler receiving the status of the GPIOs specified by the mask

I want GPIO4 Output-High and GPIO5 Input. Polling operation must be 1*100 ms interval. And Handler function is IOHandler.

The comments in your code should describe what your code is intending to do.

If the parameters are correct then what can cause the handler function doesnt trigger when input pin changes?

I set first parameter as GPIO4 | GPIO5 to subscribe both pin.
I set 1 for GPIO directions. That means GPIO4 Output (0), GPIO5 Input(1) = 01 = 1
I set 0xFFFFFFFF for GPIO output values. There is only one output pin GPIO4 and this must be set to High. So 0xFFFFFFFF must work.
i set 1 for timer interval 100ms.
And i set handler function.

I cant see what is wrong. I cant get input pin’s changes.

But are they?

The point of commenting your intention on each parameter is that it is then easy to see if that matches the actual value…

Are you sure that is correct?

I think it is. What do you think. Mask must be set to 0-1(for GPIO4-GPIO5) that means 01 binary = 1 for both hex and decimal. Note that function accepts u32 values. So i just supply 1 for it. i tried 0x00000001, 0x01 and so many values too but nothing happens.

Does it?
Are you sure that is the correct relation between the GPIOs and the bit positions…?

Yes. Documantation says 0 for output pins, 1 for input pins so the mask should be 1-0 for GPIO4-GPIO5. It equals to 1.
I get stuck.

Hi awneil.
i think i found out the solution. The problem is about the mask value for the pins which you point to. I check the header file and see that GPIO4 constant is 0x200 and GPIO5 is 0x400. So GPIO4 is 10 0000 0000 and GPIO5 is 100 0000 0000. So the direction mask should be 100 0000 0000 = 0x400. I changed 1 to 0x400 and handler function starts to be triggered. It work OK now i hope that doesnt change anything working.
Besides i have a poor knownledge about mask and bit stuff, i think documentation is also poor for explanation. In my opinion, these topics must be supported with a clear and simple example.
Thank you

These really are rather basic concepts in ‘C’ programming, and interfacing, and embedded development.
It isn’t really the place of an API document to teach such basics - it is assumed that you are a competent embedded ‘C’ programmer.

I agree that many of the “examples” provided leave a great deal to be desired! :frowning: