Trying to read From UART2


#1

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:

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
[/code]


#2

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
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
adl_fcmSwitchV24State(UART_Handler,ADL_FCM_V24_STATE_DATA)

(Always check the return value of the functions)

Best Regards,

tom


#3

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:

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:

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


#4

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


#5

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


#6

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


#7

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.


#8

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


#9

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.


#10

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. :wink:

Best Regards,

tom


#11

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.


#12

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?

Kind regards,

Bart.