# Problem with UART2 Q24Plus

**URL:** https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815
**Category:** General
**Created:** [January 9, 2008, 8:15pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815 "2008-01-09T20:15:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![leohen](https://avatars.discourse-cdn.com/v4/letter/l/a9adbd/32.png) [@leohen](https://forum.sierrawireless.com/u/leohen)
#### Post date: [January 9, 2008, 8:15pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815/1 "2008-01-09T20:15:48Z")

</div>

Hello

I’m trying to receive data through UART2, but i get nothing. I’m using this code:

```auto
s8 bUART2Handler;
                s8 bUARTok = -1;

	//4800
                adl_atCmdCreate("AT+IPR=4800", ADL_FCM_FLOW_V24_UART2, fnBCN13A_UART2HandlerIPR, "*", NULL ); 
                // 8, n, 1
	adl_atCmdCreate("AT+ICF=3,4", ADL_FCM_FLOW_V24_UART2, fnBCN13A_UART2HandlerICF, "*", NULL );

	//Open UART2 
	bUARTok = adl_atCmdCreate("AT+WMFM=0,1,2",FALSE,fnBCN13A_UART2Handler,"*",NULL);
	
	bUART2Handler = -1;

	if(!bUARTok)
	{
		bUART2Handler = adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART2,fnBCN13A_UART2CtrlHandler,fnBCN13A_UART2DataHandler);

		if(bUART2Handler >= 0)
			adl_atSendResponse ( ADL_AT_UNS, "\n\r FCM UART 2 OK \n\r");
	}
	else
		adl_atSendResponse ( ADL_AT_UNS, "\n\r Error Opening UART2 \n\r");
```

I never get anything on fnBCN13A\_UART2DataHandler, can anyone help ?

Regards  
leohen

---

<div class="post-metadata">

### Author: ![wismo\_coder](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@wismo\_coder](https://forum.sierrawireless.com/u/wismo_coder)
#### Post date: [January 9, 2008, 8:35pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815/2 "2008-01-09T20:35:16Z")

</div>

Hello leohen,

What you do is right, but you need to set the data mode for Uart2. You can do it in your control handler like this:

```auto
bool fnBCN13A_UART2CtrlHandler(adl_fcmEvent_e Event)
{
	switch(Event)
	{
		case ADL_FCM_EVENT_FLOW_OPENNED:
                        adl_atSendResponse ( ADL_AT_UNS, "\n\r FCM UART 2 is now opened \n\r");
			if (adl_fcmSwitchV24State(bUART2Handler, ADL_FCM_V24_STATE_DATA) == OK)
			        adl_atSendResponse ( ADL_AT_UNS, "\n\r FCM UART 2 is now in data mode \n\r");
			break;
		case ADL_FCM_EVENT_FLOW_CLOSED:
		        adl_atSendResponse ( ADL_AT_UNS, "\n\r FCM UART 2 is now closed \n\r");
			break;
	}
	return TRUE;
}
```

Regards,

wismo\_coder

---

<div class="post-metadata">

### Author: ![leohen](https://avatars.discourse-cdn.com/v4/letter/l/a9adbd/32.png) [@leohen](https://forum.sierrawireless.com/u/leohen)
#### Post date: [January 11, 2008, 4:56pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815/3 "2008-01-11T16:56:55Z")

</div>

Wismo\_Coder

Thanks for your help, its working now.

Best Regards  
Leohen

---

<div class="post-metadata">

### Author: ![leohen](https://avatars.discourse-cdn.com/v4/letter/l/a9adbd/32.png) [@leohen](https://forum.sierrawireless.com/u/leohen)
#### Post date: [January 22, 2008, 3:23pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815/4 "2008-01-22T15:23:19Z")

</div>

Hello

Another doubt, i set baud rate and flow control before opening the port, but it doesn´t change, can anyone help ?

Regards  
Leohen

---

<div class="post-metadata">

### Author: ![wismo\_coder](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@wismo\_coder](https://forum.sierrawireless.com/u/wismo_coder)
#### Post date: [January 22, 2008, 6:04pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815/5 "2008-01-22T18:04:48Z")

</div>

> [@leohen](#):
>
> Another doubt, i set baud rate and flow control before opening the port, but it doesn´t change, can anyone help ?

In order to change the baud rate aof UART2 you have to issue the command directly on UART2 when it is in AT command mode, or from your program like this:

```auto
adl_atCmdCreate("AT+IPR=9600\r", ADL_AT_PORT_TYPE(ADL_PORT_UART2,FALSE), (adl_atRspHandler_t) NULL, NULL);
```

Do this after you succesfully switched to data mode.  
As for the flow control: there is no hardware flow control for UART2 if that’s what you mean.

Regards,

wismo\_coder

---

<div class="post-metadata">

### Author: ![leohen](https://avatars.discourse-cdn.com/v4/letter/l/a9adbd/32.png) [@leohen](https://forum.sierrawireless.com/u/leohen)
#### Post date: [January 23, 2008, 3:06pm UTC](https://forum.sierrawireless.com/t/problem-with-uart2-q24plus/1815/6 "2008-01-23T15:06:40Z")

</div>

Wismo\_coder

Thanks again for your help. It´s working now.

Best Regards  
Leohen
