reading from uart.

#include "adl_global.h"
#include "adl_OpenDevice.h"
#include "wm_uart.h"
#include "adl_TimerHandler.h"
//#include "uart_read.c"

/*  Mandatory variables                                                    */
/*  wm_apmCustomStackSize                                                  */
const u16 wm_apmCustomStackSize = 1024;
adl_tmr_t *tt;// pointer to a structure returned by adl_tmrsubscribeExt
u16 timeout_period = 5;// Indicates the timervalue
static psGItfCont_t uart_if;// Operation parameter.
static u32 uart2_hdl;// Pointer to device opened.

static u8 rx_buf[256];// Memory area where the received data is stored.
u8* p_rx_buf;// Pointer to area where received data is stored.
u32 nb_tb_read;// Number of bytes to be read.
u32 nb_read;// Number of bytes read.                       
sUartSettings_t settings;// Settings for the uart.
sUartLc_t line_coding;// Line coding parameters.

/*  Local variables                                                        */

/*  Local functions                                                        */
void a_generic_handler(u8 id, void * context)
    // Open UART DEVICE.
    uart2_hdl=adl_OpenDevice(DF_UART_CLID, &settings);

/*  Function   : uartread                                                  */
/*  Object     : Customer application initialisation                       */
/*                                                                         */
/*  Variable Name     |IN |OUT|GLB|  Utilisation                           */
/*  InitType          |   |   |   |  Application start mode reason         */

//This is the entry point for uart_read.

void UartRead ( adl_InitType_e InitType )
    TRACE (( 1, "Embedded Application : Main" ));
    // TO DO : Add your initialization code here
    // Set the line coding parameters.
    line_coding.rate=(eUartRate_t) (UART_RATE_USER_DEF | 57600);
     //UART2 will be opened in NULL MODEM role/ with synchronus read.
    settings.role= UART_ROLE_NM;
   // settings.interface=&uart_if;
   //   Here settings and configurations of uart are finished.

Can u guys please suggest whether the above code is sufficient to read data from uart in sychronous mode.

I regret unconditionally if my mail annoys you.

Thanks in advance.



What do you mean by “Synchronous Mode”? If you mean that you want to wait and poll the UART for input characters, forget it. You will trip the internal watchdog for sure.

Have you looked at the FCM section of the API?

ciao, Dave


Actually, iam trying to read the incoming data periodically after a fixed time slot.So i used a timer whenever it expired,read data from uart.


So, you’re assuming that the UART will “save up” received characters until you come along and read them?

I don’t know about the “direct access” UART stuff (although I doubt it), but that certainly isn’t the way that FCM works!


As my application involves sending data to uart continuously and the choice of reading data will be user’s.The unread data is intentionally loosed.


Please do suggest which will be optimum method (Direct access or using FCM) while accessing UART2.(As i have told my application involves reading data from uart periodically,while neglecting the unread data).


is there any DOC for adl_OpenDevice(), its not in the AUG … ?


Yes, it is in the ADL User Guide (AUG?) - it’s in the chapter titled, “Device Services”.

In the ADL User Guide for Open AT® OS v6.21, it’s section, starting on page 446.
Reference: WM_DEV_OAT_UGD_080
Revision: 007
Date: February 2009

However, I think that chapter must be a very strong contender for the abosulte worst in that document! :angry:

Note that it’s a fairly recent feature, so won’t be in early versions…


hi thanks cool
glad you understood my TLA (3 letter abbreviation)
where is the easiest place to get WM_DEV_OAT_UGD_080, google gave up on it …


Unfortunately, the Wavecom website does not make getting any of the documetns “easy” :frowning:

The only really “easy” way to get it is to phone your distributor and ask them to send it to you!

To download it from the website you have to log-in as a developer, then go to a Product page, and download it from there.

The developer registration for a login should be free, but quite a few people have reported difficulties with actually getting it to work!

The “developer” registration & login is separate from the forum registration & login.


aha yes like a good boy that is where I went first, but my wife tells me I am not very good at finding things
I went to WMP100, downloads, and installed the full Open AT Software Suite
I also went though all the other boxes on the page, no joy
the distributor option is of course the best, but when you are a developer rather than a customer that’s not so easy
can you put me out of my misery …


In that case, you have all the docs on your hard drive!

Just use the ‘Search’ in the Windows explorer to find all the PDF files…


hmm right under my nose
my wife was right


just looking at the sample code MyFunction() in adl_OpenDevice.h starting line 211
attempting to write to a uart
the uart_if.write() statement should surely be uart_if->write() ?
when changed, calling this function causes a reset, any clues as to why ?


Have you seen:

Also note: viewtopic.php?f=46&t=4522


A close-run thing with the L3 Info chapter, I think… :unamused: