# adl\_atCmdCreate with multiple tasks - suggestions

**URL:** <https://forum.sierrawireless.com/t/adl-atcmdcreate-with-multiple-tasks-suggestions/7335>\
**Category:** Open AT\
**Created:** [July 24, 2014, 10:03am UTC](https://forum.sierrawireless.com/t/adl-atcmdcreate-with-multiple-tasks-suggestions/7335 "2014-07-24T10:03:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlkuhn](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@karlkuhn](https://forum.sierrawireless.com/u/karlkuhn)\
**Post date:** [July 24, 2014, 10:03am UTC](https://forum.sierrawireless.com/t/adl-atcmdcreate-with-multiple-tasks-suggestions/7335/1 "2014-07-24T10:03:10Z")

</div>

Hi, I am executing AT commands from multiple tasks in my OpenAT application (2.52 FXT009). Since these tasks run independently it sometime occurs that two commands are sent before any response is received. This is a problem(In hind sight) as the response is sent to the task with higher priority, causing my command in the lower priority task to never get a response. This is documented in the OpenAT user guide (2.2.2. Multitasking limitations).

My question is, how can I successfully deal with this situation? I can’t use semaphores as that blocks the response from being received. Does anyone have a suggestion I could easily retrofit into my code. I don’t want to have to run timers and wait until a global flag is set (if possible). I wonder if there is a better solution?

Additionally it seems that any AT commands sent thereafter do not get executed at all. e.g. AT+CFUN=0 gets ignored. Is there a way to recover from this, as I can’t even restart the modem.

Any help appreciated!

Thanks,

Karl

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [July 24, 2014, 11:24am UTC](https://forum.sierrawireless.com/t/adl-atcmdcreate-with-multiple-tasks-suggestions/7335/2 "2014-07-24T11:24:24Z")

</div>

How about a separate task just to manage AT commands?

> [@karlkuhn](#):
>
> Additionally it seems that any AT commands sent thereafter do not get executed at all. e.g. AT+CFUN=0 gets ignored. Is there a way to recover from this, as I can’t even restart the modem.l

adl\_errHalt() ❓

> [@Roaming networks with AT+COPS](https://forum.sierrawireless.com/t/roaming-networks-with-at-cops/7207/4):
>
> A nicer way to force a reboot would be adl\_errHalt() - which can also place diagnostic information into the backtrace for debugging… Does the reboot due to AT+WRST still work on a unit in this state?

---

<div class="post-metadata">

**Author:** ![karlkuhn](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@karlkuhn](https://forum.sierrawireless.com/u/karlkuhn)\
**Post date:** [July 24, 2014, 12:45pm UTC](https://forum.sierrawireless.com/t/adl-atcmdcreate-with-multiple-tasks-suggestions/7335/3 "2014-07-24T12:45:08Z")

</div>

Hi Awneil, thanks for the suggestions. adl\_errHalt() has solved the restart problem… I will look into the extra task option as well.

I guess I will need to create a queue on the extra task with callbacks to the original code?

Thanks,

KArl

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [July 24, 2014, 5:21pm UTC](https://forum.sierrawireless.com/t/adl-atcmdcreate-with-multiple-tasks-suggestions/7335/4 "2014-07-24T17:21:56Z")

</div>

> [@karlkuhn](#):
>
> I guess I will need to create a queue on the extra task with callbacks to the original code?

That’s the kind of way I was thinking…
