# Safely enable and disable UART1 on Q2687

**URL:** <https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802>\
**Category:** Legacy AirPrime modules\
**Created:** [August 13, 2012, 1:30am UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802 "2012-08-13T01:30:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pvouzis](https://avatars.discourse-cdn.com/v4/letter/p/50afbb/32.png) [@pvouzis](https://forum.sierrawireless.com/u/pvouzis)\
**Post date:** [August 13, 2012, 1:30am UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802/1 "2012-08-13T01:30:36Z")

</div>

I need to use some GPIO pins that are multiplexed with UART1 on a Q2687. My understanding is that I first need to disable UART1 within my application, and then subscribe to the GPIOs. Before trying this I realized that disabling UART1 might be dangerous since there is no way to communicate with the module any more. And sure enough…

The way I do it is to use

adl\_atCmdCreate ( “AT+WMFM=0,0,1”, TRUE, ( adl\_atRspHandler\_t ) NULL, NULL );

to deactivate if, and then

adl\_atCmdCreate ( “AT+WMFM=0,1,1”, TRUE, ( adl\_atRspHandler\_t ) NULL, NULL );

to activate it. However, this doesn’t work that well. The activation doesn’t work, and I end up with a disabled UART1. Then I have to use DWLWin to flash the module and start over. It is annoying and it takes quite some time to do this.

So, does anybody have a recommendation about a safe process to enable and disable UART1?

Thanks1

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [August 13, 2012, 6:39am UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802/2 "2012-08-13T06:39:12Z")

</div>

If you enable and connect through either UART 2 or the USB, then you can re-enable UART 1. Otherwise, you will have to write an Open AT application that enables UART 1 based on an event (e.g. GPIO dropping low etc).

---

<div class="post-metadata">

**Author:** ![pvouzis](https://avatars.discourse-cdn.com/v4/letter/p/50afbb/32.png) [@pvouzis](https://forum.sierrawireless.com/u/pvouzis)\
**Post date:** [August 14, 2012, 2:02am UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802/3 "2012-08-14T02:02:43Z")

</div>

I found my error and I am posting the solution here for future reference:

> [@tomridl](#):
>
> If you enable and connect through either UART 2 or the USB, then you can re-enable UART 1. Otherwise, you will have to write an Open AT application that enables UART 1 based on an event (e.g. GPIO dropping low etc).

I was using an input GPIO to call a function that would send the command:

adl\_atCmdCreate ( “AT+WMFM=0,1,1”, TRUE, ( adl\_atRspHandler\_t ) NULL, NULL );

but the UART wouldn’t get activated back. Well, after RTFM I realized that by using that first “TRUE” in the command above the response would be sent to the UART that was already deactivated (since I had already sent adl\_atCmdCreate ( “AT+WMFM=0,0,1”, TRUE, ( adl\_atRspHandler\_t ) NULL, NULL ); )

So, when the UART is deactivated and it cannot receive the response the command is not executed. Thus, the UART doesn’t get reactivated.

The solution: I used

adl\_atCmdCreate ( “AT+WMFM=0,1,1”, FALSE, ( adl\_atRspHandler\_t ) NULL, NULL );

which doesn’t try to send the response to the UART at all. With this command the UART gets activated just fine.

---

<div class="post-metadata">

**Author:** ![pvouzis](https://avatars.discourse-cdn.com/v4/letter/p/50afbb/32.png) [@pvouzis](https://forum.sierrawireless.com/u/pvouzis)\
**Post date:** [August 14, 2012, 5:27am UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802/4 "2012-08-14T05:27:21Z")

</div>

So, now I am able to disable and enable the UART 1 on the Q2687 without problems. However, after disabling UART1 I try to do

```
adl_ioDefs_t GpioConfig = ADL_IO_DIR_OUT | ADL_IO_LEV_LOW | ADL_IO_GPIO | 42;
GpioHandle = adl_ioSubscribe(1, &GpioConfig, 0, 0, 0);

```

and I get the error ADL\_IO\_ERR\_USED. I remind that GPIO42 on a Q2687 is multiplexed with RI of UART1.

So, I don’t know why after disabling UART1 I am still not able to use GPIO42 as a GPIO. I suspect that the answer is hidden somewhere deep in the manual, but I haven’t been able to find the location 😛

Does anybody know how to use the GPIOs that are multiplexed with UART1?

Thanks!

---

<div class="post-metadata">

**Author:** ![pvouzis](https://avatars.discourse-cdn.com/v4/letter/p/50afbb/32.png) [@pvouzis](https://forum.sierrawireless.com/u/pvouzis)\
**Post date:** [August 14, 2012, 10:33am UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802/5 "2012-08-14T10:33:36Z")

</div>

The module needs a restart after the UART1 is disabled to free the GPIOs.

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forum.sierrawireless.com/u/tobias)\
**Post date:** [October 4, 2012, 2:21pm UTC](https://forum.sierrawireless.com/t/safely-enable-and-disable-uart1-on-q2687/5802/6 "2012-10-04T14:21:29Z")

</div>

The restart is needed with firmware R7.xx, but was not necessary with firmware 6.6x.
