Q2400A UART-interface

Hi everybody,

I am trying to connect a gps-device to a Q2400A Wavecom modem. This is done through the UART-interface. I do not have access to an other wavecom-modem with gps-support built in.

GPS-device -> serial port -> serial cable -> serial port -> Q2400A

I like to know how i can receive data through the UART.
I know you have different modes for the UART-interface:

  1. AT-mode
  2. Data-mode
  3. ATO-mode
    You can switch between this modes with:
wm_ioSerialSwitchState(WM_IO_UART1,WM_IO_SERIAL_ATO);
wm_ioSerialSwitchState(WM_IO_UART2,WM_IO_SERIAL_ATO);

Am i correct if i think that if i set the modem in ATO-mode. You can switch between AT-mode and Data-mode with sending a “+++” string?

In data-mode, can i still flash the Wavecom? (Since i need AT+WDWL, AT+Wopen, to program the device). Is this still possible?

And what happens if i send a character over the UART? How can i tell my program, that any character received should be put in a receive-buffer?
I know there is a command ioRead(); but that is just returning ‘OK’.
— Is there something like: getDataFromSerialPort(); ? or “receivebuffer”?

Thanks in advance.

Hello,

No, the “1 sec silence +++ 1 sec silence” string on the UART1 (serial) interface, will take you from DATA_MODE to AT_MODE.
You switch to DATA_MODE with wm_ioSerialSwitchState function.

You need to be in AT_MODE in order for the command parser to recognize the +WDWL or +WOPEN command. In DATA_MODE are all characters received just considered as data and not parsed by the Wavecom AT-parser.

In DATA_MODE: all characters are concidered as data characters.

This function is only related to the GPIO API. Nothing to do with the dataflow.

This is just my interpretation of how it works, I might have gotten something wrong but if that is the case then I hope that someone smarter will correct me…

/Snoooze

Hi

I use

FcmUartHandle = adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART1,EventHandler,DataHandler);

Where the second parameter is a callback function that is called when data is received on the port. You can then copy/process the data as desired.

Cheers, Danny

I also prefer using the ADL API, but I assumed that [color=blue]Trout was using basic Open AT API…

Question to [color=blue]Trout: Why cant you use ADL API?

/Snoooze

Thanks already for answering my questions, it helped me further a lot.

I can’t use the ADL api because im using a Wavcom-device that my school gave me. It has an attached LCD-display, LED’s etc. etc. and all those drivers they gave me are in basic open AT.
And i have received documentation about basic open at and not about the ADL API. It will be quite difficult for me to use the ADL API. (Especially now when im getting used to basic open at).

I found the following code:

s32 Serial_Dsr;
Serial_Dsr = 0;

//----- Task 1:

s32 wm_apmAppliParser ( wm_apmMsg_t * pMessage )
{
    char    strMsgTrace[255];

    switch ( pMessage->MsgTyp )
    {
case WM_OS_TIMER :

// FROM HERE:
      	    if ( Serial_Dsr != wm_ioSerialGetSignal ( WM_IO_SERIAL_DSR ) )
      	    {
      	        Serial_Dsr = wm_ioSerialGetSignal ( WM_IO_SERIAL_DSR );
      	        wm_osDebugTrace ( 1, "New Serial DSR : %u", Serial_Dsr );
      	    
      	        wm_sprintf ( strMsgTrace, "\r\nNew Serial DSR : %d\r\n", Serial_Dsr );
      	        wm_atSendUnsolicitedExternalApp ( ( u16 ) ( wm_strlen ( strMsgTrace ) + 1 ), strMsgTrace );
      	    }
// TO HERE
        break;
       
        default :
        break;
    } /* switch (pMessage->MsgTyp) */
    
    return TRUE;
}

(sorry for maybe unreadable code)
Am i correct if this bit of code (marked) is triggered when a set of data has been received with the UART?
(Since DSR stands for Data Set Ready)

Where do i find my data which should have been received??

Thanks in advance

Hi Trout
The code that you have shown only gets triggered by a timer and it will only tell you when in what state the Handshaking lines is

In the document “BUG_Open-AT_Basic_Development_Guide_3-02_v11.pdf” under section 3.5.6 it explains “receiving Data blocks”
under the wm_apmAppliParser() you have to use the
case WM_FCM_RECEIVE_BLOCK:
then you will have a data buffer containing your data.
They have some good information in this section on reading from UART.
I hope this is usefull
Regards
Walter

Ok, thanks it was very usefull. I tried a lot, but it still doesn’t seem to work.

My questions:

  • How do i certainly know if the Wavecom UART is in data-mode?
wm_ioSerialSwitchState(WM_IO_UART1,WM_IO_SERIAL_DATA_MODE);
wm_ioSerialSwitchState(WM_IO_UART2,WM_IO_SERIAL_DATA_MODE);

… The UART should be in DATA-mode. But if i send “AT” it still responds with “OK”.
(I placed above code in the wm_apmAplliInit1(); )

I also did what [color=blue]waltersenekal has told me.

case WM_FCM_RECEIVE_BLOCK :
 wm_atSendUnsolicitedExternalApp ( 12, "\r\nReceived\r" );
break;

But i’m not reading anything in my HyperTerminal screen.
So i think i am not switching to ‘DATA_MODE’ correctly and the “WM_FCM_RECEIVE_BLOCK”-case doesn’t get triggered.
Or is ‘wm_atSendUnsolicitedExternalApp’ wrong, because i was in data-mode after all?

I also added:

case WM_IO_SERIAL_SWITCH_STATE_RSP :
	wm_atSendUnsolicitedExternalApp ( 8, "\r\nTest\r" );
break;

But i still aint receiving anyting in my HyperTerminal screen. (But if i send “AT” i do receive “OK”).

Second question:
You refer to “BUG_Open-AT_Basic_Development_Guide_3-02_v11.pdf” I only have “BUG_Open_AT_Basic_Development_Guide_002-010.pdf”
On the wavecom-site only v.09 seems to exist.
So where do i get that documentation? (paragraph 3.6.5 does not exist in v.10, so i definitely need it).
(You could also email me at troutdude-at-gmail.com, but if you don’t like to, i’ll accept that).

Thanks in advance