# UART2 not working

**URL:** <https://forum.sierrawireless.com/t/uart2-not-working/171>\
**Category:** General\
**Created:** [December 14, 2005, 12:14pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171 "2005-12-14T12:14:29Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.alvarez](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daniel.alvarez](https://forum.sierrawireless.com/u/daniel.alvarez)\
**Post date:** [December 14, 2005, 12:14pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/1 "2005-12-14T12:14:29Z")

</div>

Hi,

I’m trying to use the UART2 of my Q2406B module.  
I did activate the UART2 and checked it through AT interface:

at+wmfm?  
+WMFM: 0,2,1,1  
+WMFM: 0,2,2,1  
+WMFM: 1,2,4,0  
+WMFM: 1,2,4,1

I got UART2 connected to a device sending data at 4800bps.  
First I followed jan’s topic instructions to set the speed up on the serial port:

```auto
adl_atCmdCreate( "AT+IPR=4800", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_IPR_Handler, "*", NULL );
```

In the handler i can see the response of the module is “OK”.

Now i subscribe to the fcm handler:

```auto
HandleUART2 = adl_fcmSubscribe( ADL_FCM_FLOW_V24_UART2, UART2fcmCtrlH, UART2fcmDataH );
```

And in the Control handler i receive the event which indicates that the flow was correctly opened. Then i switch to DATA Mode and the Control handler is called again with the event indicating that it went to DATA MODE.

However, the DATA handler is never called as if it didn’t receive anything.

Any hints please?

_EDITED_  
I’ve spent the whole day trying things with UART2 and have observed something:  
If I send data using:

```auto
adl_atSendResponse(ADL_AT_PORT_TYPE(ADL_AT_UART2,ADL_AT_RSP),buffer);
```

it works. However since I need to use raw data and try to send it with  
adl\_fcmSendData i experiment the following behavior:

When i call this function first i get the next message:  
ADL\_FCM\_RET\_OK\_WAIT\_RESUME  
According to the documentation it means: Success, but the last credit was used.  
Now i am supposed to wait for ADL\_FCM\_EVENT\_RESUME in my control handler but it doesn’t arrive.  
Of course the next times i try to send data the error code is as follows:

ADL\_FCM\_RET\_ERR\_WAIT\_RESUME  
which means that the flow’s got no more credit to use.

I don’t know how to sort this out, could please anybody help me?

Thanks,  
Daniel

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [December 16, 2005, 8:18am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/2 "2005-12-16T08:18:47Z")

</div>

Hi Daniel,

I don’t know what’s going on, but I suspect that the flow is not in data mode. You get the event that it was switched, but I suspect that it was switched back to AT mode for some reason.

Are you using any AT commands sent to ADL\_AT\_UART2 from the internal application _after_ you switched to data mode?

Can you enter AT commands on UART2 via a terminal emulator program - and do you get an answer?

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![daniel.alvarez](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daniel.alvarez](https://forum.sierrawireless.com/u/daniel.alvarez)\
**Post date:** [December 16, 2005, 8:32am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/3 "2005-12-16T08:32:40Z")

</div>

Hi Jan,

I’m still debugging it and I can see that my control handler isn’t called after receiving the event which indicates me that it went into DATA mode. So it doesn’t seem to receive the event indicating a switch back into AT mode.

But anyway I tried to send an at command to the UART2:

```
adl_atCmdCreate( "AT", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_AT_Handler, "*", NULL );

```

every second and I’ve got the Ok answer.  
How can this be possible? Can the module switch back to AT mode without generating the proper event?

Damn, I’m getting mad 🙂

Thank you very much jan for the answer, very accurate as usual  
Now it seems I need to avoid that uncontrolled switch somehow.

Best regards,  
Daniel

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [December 16, 2005, 8:37am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/4 "2005-12-16T08:37:10Z")

</div>

Hi Daniel,

That is exactly what I experienced: The module seems to switch back to AT as soon as you send an AT command using the PORT\_TYPE macro for the port which has a flow in data mode…

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![snoooze](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@snoooze](https://forum.sierrawireless.com/u/snoooze)\
**Post date:** [December 16, 2005, 8:38am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/5 "2005-12-16T08:38:34Z")

</div>

Hello guys,

> [@](#):
>
> every second and I’ve got the Ok answer.  
> How can this be possible? Can the module switch back to AT mode without generating the proper event?

You can always send commands internally via adl\_atCmdCreate.  
You do not need to be in AT-command mode. The switching between AT- and Data mode is only for the external UART.

/Snoooze

---

<div class="post-metadata">

**Author:** ![daniel.alvarez](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daniel.alvarez](https://forum.sierrawireless.com/u/daniel.alvarez)\
**Post date:** [December 16, 2005, 8:38am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/6 "2005-12-16T08:38:40Z")

</div>

hi again,

> [@](#):
>
> Are you using any AT commands sent to ADL\_AT\_UART2 from the internal application _after_ you switched to data mode?

Well my steps are as follows:

I send the AT+IPR command to set up the speed on UART2 (from the embbeded application).  
I subscribe to the FCM flow on UART2.  
I get the FLOW OPENED event on my control handler and then i switch to DATA mode.  
I get the event confirmming me that I’m in DATA mode.  
Now i get my debugging print on UART1 which indicates me that just in this moment the IPR response handler is called.

At this moment it’s not quite easy to send data into UART2 because of electrical levels but I will make an adapter if necesary. According to your answer, Jan I figure out that if i send any AT commands from the embbeded app it will switch modes and if I do from an external device It might not change, is that correct?

Thanks again

Daniel

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [December 16, 2005, 8:42am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/7 "2005-12-16T08:42:58Z")

</div>

Hi,

please try to switch the mode in the IPR handler function. I think it will work then…

And yes, I think only the internal application will cause that mode switch.

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![daniel.alvarez](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daniel.alvarez](https://forum.sierrawireless.com/u/daniel.alvarez)\
**Post date:** [December 16, 2005, 8:48am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/8 "2005-12-16T08:48:53Z")

</div>

Hi guys,

damn… i removed the at+ipr command and now it works !  
I didn’t figure out the switch back to AT mode without generating the event. Is that a bug?

Thank you very much, really.

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [December 16, 2005, 9:01am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/9 "2005-12-16T09:01:56Z")

</div>

Hi again,

> [@daniel.alvarez](#):
>
> Is that a bug?

Looks like one to me now, because if

> [@Snooze](#):
>
> The switching between AT- and Data mode is only for the external UART.

then the mode shouldn’t be affected by adl\_atCmdCreate’d commands…

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![OpenAT\_Fan](https://avatars.discourse-cdn.com/v4/letter/o/f07891/32.png) [@OpenAT\_Fan](https://forum.sierrawireless.com/u/OpenAT_Fan)\
**Post date:** [December 16, 2005, 2:14pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/10 "2005-12-16T14:14:16Z")

</div>

Hi Daniel,  
You can try the following steps to check if the procedure works:

1. First of all, configure the UART2, by sending AT+IPR command. After receiving the response of this command (“OK”), you should subscribe for FCM flow for UART2.
2. Now, you should switch the UART2 to data mode.

I feel that the problem is occuring because UART2 is switched to different baud rate after you switch the UART2 to data mode.

Best Regards.

---

<div class="post-metadata">

**Author:** ![dead\_arhip](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dead\_arhip](https://forum.sierrawireless.com/u/dead_arhip)\
**Post date:** [December 16, 2005, 4:44pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/11 "2005-12-16T16:44:40Z")

</div>

Hi,  
I’m also trying to work with UART2. I have Q2400A module with 3.01 OpenAT virsion and a small circuit with MAX3232 to connect modem to another board. I’ve tried all tips that i’ve found at this board, but the UART is not working.

I’ve compared RTS signals on UART1 and UART2 when start\stop connection in HyperTerminal and have found next thing. The voltage at RTS pin of UART1 is 0 or 5, but at UART2 it is always 0,3V. It seems to me that this pin is at input mode constantly.

The second experiment. I’ve wrote a program that switches UART2 RTS pin (35) from 0 to high voltage. (adl\_ioWrite). This program works fine.  
It works fine even when i open UART2. I thought that when UART2 is opened, GPIO doesn’t work.

Could anyone tell me is this feature (UART2) works in Q2400A with OpenAT v3.01?

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [December 16, 2005, 8:44pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/12 "2005-12-16T20:44:11Z")

</div>

Hello dead\_arhip,

Are you sure that the uart2 is activated with AT+WMFM command?  
If i remember well, you should get an error using pin functions on Uart2 RTS even when you don’t use flow control.

Regards,

tom

---

<div class="post-metadata">

**Author:** ![dead\_arhip](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dead\_arhip](https://forum.sierrawireless.com/u/dead_arhip)\
**Post date:** [December 19, 2005, 12:10pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/13 "2005-12-19T12:10:32Z")

</div>

Tomalex, thanks for reply.

I did my experiments with opened UART2 and even with closed 😃. No result.  
I’ve leave UART2 for better times.  
I just want to know does it work in principal or it’s a problem with my device.

---

<div class="post-metadata">

**Author:** ![daniel.alvarez](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daniel.alvarez](https://forum.sierrawireless.com/u/daniel.alvarez)\
**Post date:** [December 19, 2005, 4:15pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/14 "2005-12-19T16:15:41Z")

</div>

I think that you shouldn’t be able to manage IO pins multiplexed with UART2 if it’s enabled. I’ve just tried it out on OpenAT v3.02 and it doesn’t.

I have a CME ERROR: 3 when trying to write onto RTS2 and UART2 enabled.

have you tried your program even when configured with Flow Control on UART2?

Regards  
Daniel

---

<div class="post-metadata">

**Author:** ![daniel.alvarez](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daniel.alvarez](https://forum.sierrawireless.com/u/daniel.alvarez)\
**Post date:** [December 19, 2005, 4:24pm UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/15 "2005-12-19T16:24:52Z")

</div>

I have just tried an AT+WIOW=0,0 on a Q2406B , ie, write a ‘0’ on GPIO0 (multiplexed with RTS2) and it just works when UART2 is disabled (no matter whether I use Local Flow or not).

Cheers

Daniel

---

<div class="post-metadata">

**Author:** ![dead\_arhip](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dead\_arhip](https://forum.sierrawireless.com/u/dead_arhip)\
**Post date:** [December 20, 2005, 8:03am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/16 "2005-12-20T08:03:08Z")

</div>

Daniel, thank you for reply.

> [@](#):
>
> I think that you shouldn’t be able to manage IO pins multiplexed with UART2 if it’s enabled. I’ve just tried it out on OpenAT v3.02 and it doesn’t.
> 
> I have a CME ERROR: 3 when trying to write onto RTS2 and UART2 enabled.

I think so too. But I do can manage GPIO5(RTS2) without any error when UART2 is opened (AT+WMFM=0,1,1).  
I suppose that the problem is a software one (OpenAT v3.01).  
I should possibly upgrade soft to version 3.02 and try again.

Best Regards.  
Alex

---

<div class="post-metadata">

**Author:** ![samuel](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@samuel](https://forum.sierrawireless.com/u/samuel)\
**Post date:** [August 23, 2006, 10:41am UTC](https://forum.sierrawireless.com/t/uart2-not-working/171/17 "2006-08-23T10:41:23Z")

</div>

I am trying to get teh UART 2 into command mode and using AT commands to do it, any help on how, curently I jsut use AT+WMFM=0,1,2 and not sure how to set the +IPR for UART 2, is this possible to get the command mode with UART 2 any help

Samuel
