# Trying to read From UART2

**URL:** <https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478>\
**Category:** General\
**Created:** [May 26, 2006, 8:51pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478 "2006-05-26T20:51:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [May 26, 2006, 8:51pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/1 "2006-05-26T20:51:58Z")

</div>

Hello everyone!

IÂ´m using 2406 and 2501 modules and IÂ´m trying to read strings from an external GPS. This external GPS works with 4800bps.

IÂ´ll need the UART1 to enter AT commands and Read status messages with Hyperterminal.

But still then I couldnÂ´t read it…  
Can anybody help me?

HereÂ´s my code:

```auto
adl_atCmdCreate("AT+WGPSCONF=0,0",FALSE,(adl_atRspHandler_t)NULL,NULL);
	adl_atCmdCreate("AT+WMFM=0,1,2",FALSE,(adl_atRspHandler_t)NULL,NULL);
	adl_atCmdCreate( "AT+IPR=4800", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_IPR_Handler, "*", NULL );

bool SerialControl(adl_fcmEvent_e event)
{
	switch(event)
	{
	case ADL_FCM_EVENT_FLOW_OPENNED:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_FLOW_CLOSED:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE_EXT:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_AT_MODE:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_AT_MODE_EXT:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_RESUME:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_MEM_RELEASE:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	}
}

bool SerialData(u16 DataLen, u8 * Data)
{
	adl_atSendResponse(ADL_AT_RSP, "\r\nReceived Data\r\n");
	return FALSE;
}

bool Res_IPR_Handler( adl_atResponse_t *paras ) 
{ 
	adl_atSendResponse(ADL_AT_RSP, "\r\nRs_IPR_Handler\r\n");
   adl_fcmSubscribe( ADL_FCM_FLOW_V24_UART2, SerialControl, SerialData ); 
   return TRUE; 
}
```

The first thing IÂ´m trying to do Is get any “Received Data” message.

Any ideas?

Thanks,

Henrique  
[rickonvb@yahoo.com.br](mailto:rickonvb@yahoo.com.br)  
[/code]

---

<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:** [May 27, 2006, 12:39pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/2 "2006-05-27T12:39:30Z")

</div>

Hello,

I used to manage the uarts this way:

- setup:

1. Issue the AT+WMFM command.
2. Wait until the WMFM response handle receive the “OK”
3. config the uart wiht AT+IPR (speed) and AT+ICF(parity, stop bit…)
4. save with AT&W (you don’t have to set at every restart)

(Make sure that the GPS uart settings matches the wismo settings)

-to use:

1. Open the flow

```auto
UART_Handler = adl_fcmSubscribe (ADL_FCM_FLOW_V24_UARTX, UART_ControlHandler, UART_DataHandler );
```

1. in the UART\_ControlHandler after the ADL\_FCM\_EVENT\_FLOW\_OPENED received switch to data mode, if reading data streams needed like GPS sentences

```auto
adl_fcmSwitchV24State(UART_Handler,ADL_FCM_V24_STATE_DATA)
```

(Always check the return value of the functions)

Best Regards,

tom

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [May 29, 2006, 7:59pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/3 "2006-05-29T19:59:55Z")

</div>

HereÂ´s the thing:  
IÂ´m testing the code with a 2501Q Module, ok?

I want to use the UART1 to display information and enter AT commands.  
I also want to use UART2 with an External GPS.

So I used the AT+WGPSCONF command to disable GSM control over UART2.

When I enter “AT+WGPSCONF?” I get: “AT+WGPSCONF= 0,0,0”

I powered the GPS down too with “AT+WGPSM=0,0”

Now the code is:

```auto
At adl_main:

	adl_atCmdCreate("AT+WMFM=0,1,2",FALSE,(adl_atRspHandler_t)NULL,NULL);
	adl_atCmdCreate( "AT+IPR=4800", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_IPR_Handler, "*", NULL );
```

And the functions:

```auto
bool SerialControl(adl_fcmEvent_e event)
{
	s8 Ret;
	ascii buffer[40];

	switch(event)
	{
	case ADL_FCM_EVENT_FLOW_OPENNED:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		Ret = adl_fcmSwitchV24State(UART2_Handler,ADL_FCM_V24_STATE_DATA);
		wm_sprintf(buffer, "\r\nRet Switch: %d\r\n", Ret);
		adl_atSendResponse(ADL_AT_RSP, buffer);
		break;
	case ADL_FCM_EVENT_FLOW_CLOSED:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE_EXT:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_AT_MODE:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_V24_AT_MODE_EXT:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_RESUME:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	case ADL_FCM_EVENT_MEM_RELEASE:
		adl_atSendResponse(ADL_AT_RSP, "\r\nADL_FCM_EVENT_FLOW_OPENNED\r\n");
		break;
	}
}

bool SerialData(u16 DataLen, u8 * Data)
{
	adl_atSendResponse(ADL_AT_RSP, "\r\nReceived Data\r\n");
	return FALSE;
}

bool Res_IPR_Handler( adl_atResponse_t *paras ) 
{ 
	adl_atSendResponse(ADL_AT_RSP, "\r\nRs_IPR_Handler\r\n");
   UART2_Handler = adl_fcmSubscribe( ADL_FCM_FLOW_V24_UART2, SerialControl, SerialData ); 
   return TRUE; 
}
```

Every function called returns OK results.

The GPS IÂ´m trying to connect to UART2 is a U-BLOX (RX, TX, GND).  
But I never get any response…

Before trying the command “AT+WGPSM=0,0”, just using the “AT+WGPSCONF=0,0” the internal GPS was still polling data from the UART2. Is it normal? I need the UART clear and free to enter with data from my new GPS.

Anybody? Any Ideas? Any ideas Tom?

Thanks!

BEst Regards,

Henrique  
[rickonvb@yahoo.com.br](mailto:rickonvb@yahoo.com.br)

---

<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:** [May 29, 2006, 8:43pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/4 "2006-05-29T20:43:54Z")

</div>

Hello sanabiovilela!

Have you connected your external GPS to GSM\_TXD2 (GPI- Pin 38 ) and GSM\_RXD2 (GPO2 - Pin 40) ?

The GPS\_TXD2, GPS\_RXD2, GPS\_TXD0,GPS\_RXD0 pins are only usable for external communication with the internal GPS receiver. In default GPS configuration GPS\_RXD2 outputs NMEA frames.

Best Regards,

Tom

---

<div class="post-metadata">

**Author:** ![sanabiovilela](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sanabiovilela](https://forum.sierrawireless.com/u/sanabiovilela)\
**Post date:** [May 30, 2006, 5:26pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/5 "2006-05-30T17:26:31Z")

</div>

IÂ´m using a Development Kit from Wavecom. The board has a DB9 connector which is connected to a Converter (I think it is a converter).

This converter has a PIN called T2IN which is connected to GPS\_RXD2 and another PIN called R2OUT which is connected to GPS\_TXD2.

This “converter” has another 2 pins called T2OUT and R2IN which are connected to pins 2 and 3 of my DB9 connector.

This electronic schem can be found on “Wismo Quik Q2501 Customer Design Guidelines”.

So… I think my external GPS is connected correctly.

Is everything I did ok? Is it supposed to be already running as I said?

Thanks!

Best Regards,

Henrique  
[rickonvb@yahoo.com.br](mailto:rickonvb@yahoo.com.br)

---

<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:** [May 30, 2006, 8:14pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/6 "2006-05-30T20:14:05Z")

</div>

Hello,

You have connected to the wrong pins. GPS\_TXD2, GPS\_RXD2, (GPS\_TXD0,GPS\_RXD0) only usable with the internal GPS.

If you want to use UART2 from Open AT with the starter kit, you have to connect to the J200 connector’s pins. GSM\_TXD2 is pin 38, GSM\_RXD2 is pin 45. These pins are at CMOS level.

Best regards,

tom

---

<div class="post-metadata">

**Author:** ![atcaeiro](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@atcaeiro](https://forum.sierrawireless.com/u/atcaeiro)\
**Post date:** [September 1, 2006, 10:14am UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/7 "2006-09-01T10:14:59Z")

</div>

Hello,

I’m working with Q2686H and I’ve the same problem. I’m trying to read data from an external GPS (Falcom) connected to UART2 but I don`t receive anything.

The UART2 connection is well done (I’ve received data from a hyperterminal) and I’m using a Development Kit from Wavecom so it could not be a PIN problem.

Any ideas??

Thanks, Alex.

---

<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:** [September 1, 2006, 11:28am UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/8 "2006-09-01T11:28:37Z")

</div>

Hello,

Please post your 2686 firmware version and do the steps which i wrote above in this topic and write down the answers for at commands and functions.

Best Regards,

tom

---

<div class="post-metadata">

**Author:** ![atcaeiro](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@atcaeiro](https://forum.sierrawireless.com/u/atcaeiro)\
**Post date:** [September 4, 2006, 8:10am UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/9 "2006-09-04T08:10:35Z")

</div>

Hello,

My 2686 firmware version is: a09\_0ggg.Q2686H 0026016CAE5DC7FF  
I did the steps which you wrote (the UART2 was already opened) and the answer of the commands are:

```
Trace	CUS4	1	Embedded : Appli Init
Trace	CUS4	1	Iniciamos SETUP puerto 2
Trace	CUS4	1	Inside FCM Control Handler = 0
Trace	CUS4	1	FCM_FLOW_OPENNED
Trace	CUS4	1	Switch to data : 0
Trace	CUS4	1	Inside FCM Control Handler = 2
Trace	CUS4	1	ADL_FCM_EVENT_V24_DATA_MODE

```

After it, the dataHandler function is not ever called. (But if I disconnect the GPS and I connect the hyperterminal to the port 2, I can send and receive data).

Best Regards,

Alex.

---

<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:** [September 4, 2006, 8:13pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/10 "2006-09-04T20:13:36Z")

</div>

Hello atceoiro,

Please try to use the module with the final version of OS 6.60. (and with the final OAT 4.00)  
I faintly remember that in the early versions the UART2 was not implemented.  
If you use a starter kit do not forget to turn on the RS232 if needed. 😉

Best Regards,

tom

---

<div class="post-metadata">

**Author:** ![atcaeiro](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@atcaeiro](https://forum.sierrawireless.com/u/atcaeiro)\
**Post date:** [September 8, 2006, 7:31am UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/11 "2006-09-08T07:31:48Z")

</div>

Hello tom,

Thanks for your reply.

It is working now with the same firmware. You wrote the answer in an old post. It was a pin connection problem, so if I use a mini adapter between GPS module and UART2 it works fine.

Best Regards,

Alex.

---

<div class="post-metadata">

**Author:** ![bkampers](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bkampers](https://forum.sierrawireless.com/u/bkampers)\
**Post date:** [October 24, 2006, 3:23pm UTC](https://forum.sierrawireless.com/t/trying-to-read-from-uart2/478/12 "2006-10-24T15:23:28Z")

</div>

Hello all,

I did exactly as quoted below on a Q2406B board. I connected the UART2 to my PC’s com port through a MAX233 IC. All I see in Hyper Terminal is garbage. No events occur when I type text in the terminal.

When I do not change the baud rate (I assume it stays on 115200) I see texts in the terminal that slightly look like the ones I sent but a lot of characters are damaged

Anyone any idea?

> [@tomalex](#):
>
> - setup:
> 
> 1. Issue the AT+WMFM command.
> 2. Wait until the WMFM response handle receive the “OK”
> 3. config the uart wiht AT+IPR (speed) and AT+ICF(parity, stop bit…)
> 4. save with AT&W (you don’t have to set at every restart)
> 
> (Make sure that the GPS uart settings matches the wismo settings)
> 
> -to use:
> 
> 1. Open the flow
> 
> ```auto
> UART_Handler = adl_fcmSubscribe (ADL_FCM_FLOW_V24_UARTX, UART_ControlHandler, UART_DataHandler );
> ```
> 
> 1. in the UART\_ControlHandler after the ADL\_FCM\_EVENT\_FLOW\_OPENED received switch to data mode, if reading data streams needed like GPS sentences
> 
> ```auto
> adl_fcmSwitchV24State(UART_Handler,ADL_FCM_V24_STATE_DATA)
> ```
> 
> (Always check the return value of the functions)

Kind regards,

Bart.
