# Read and write on UART1

**URL:** https://forum.sierrawireless.com/t/read-and-write-on-uart1/8841
**Category:** Legacy FX/FXT series
**Created:** [October 10, 2016, 12:46pm UTC](https://forum.sierrawireless.com/t/read-and-write-on-uart1/8841 "2016-10-10T12:46:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fedex\_03](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@fedex\_03](https://forum.sierrawireless.com/u/fedex_03)
#### Post date: [October 10, 2016, 12:46pm UTC](https://forum.sierrawireless.com/t/read-and-write-on-uart1/8841/1 "2016-10-10T12:46:43Z")

</div>

Hi there,

I’m new to Sierra Wireless programmable module and I need the community help.

I have e GL6100 RS232 module.

My goal is Read and Write byte from UART1. To do this I followed the sample project created with Developer Studio (2.3.2).

This is my code:

```auto
void UART_WriteCb( u8 ID, void * Context )
{
	TRACE(( 2, "UART Write callback"));
	uart_if->write( uart1_handler, "Uart opened", 13);
}

/ *************************************************************************** /
/* Function : main_task */
/*-------------------------------------------------------------------------*/
/* Object : Customer application initialisation */
/* */
/*-------------------------------------------------------------------------*/
/ *************************************************************************** /
void main_task ( void )
{
	sUartSettings_t settings;
	sUartLc_t line_coding;

	//adl_InitType_e adl_InitType = adl_InitGetType ();
    TRACE (( 2, "Embedded : Application Initialized" ));

    /* Write on UART */
    //adl_atSendResponse ( ADL_AT_UNS, "\r\nMain task started\r\n" );

    /* UART1 Configuration */
    TRACE (( 2, "Configure UART1" ));

    /* Set the line code parameters */
    line_coding.valid_fields	= UART_LC_ALL;
    line_coding.rate = (eUartRate_t)( UART_RATE_USER_DEF | 115200 );
    line_coding.stop = UART_STOP_BIT_1;
    line_coding.data = UART_DATALENGTH_8;
    line_coding.parity = UART_PARITY_NONE;

    /* Set the UART parameters */
    settings.identity = "UART1";
    settings.role = UART_ROLE_NM;
    settings.capabilities = NULL;
    settings.event_handlers = NULL;
    settings.interface = &uart_if;
    settings.line_coding = &line_coding;

    uart1_handler = adl_OpenDevice( DF_UART_CLID, &settings );

    if( uart1_handler == ERROR)
    {
    	TRACE (( 2, "UART opening error" ));
    }
    else
    {
    	TRACE(( 2, "UART opened"));
    	/* Start time to write periodically on UART */
    	adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, UART_WriteCb );
    }
}
```

I start a timer and when the timer elaps, I want to write on UART1.

To wirte this code I followed the example reported into “OpenAt Tutorial” under “Chapter17 - Open Uart”.

The problem appear when I try to open UART1. The port cannot be opened.

But if I use UART2 the port can be open.

By the way, i use the tab “Target Management” in Developer studio, to view the trace from the target.

Thanks for the help!

---

<div class="post-metadata">

### Author: ![Rex\_alex](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@Rex\_alex](https://forum.sierrawireless.com/u/Rex_alex)
#### Post date: [October 19, 2016, 9:22am UTC](https://forum.sierrawireless.com/t/read-and-write-on-uart1/8841/2 "2016-10-19T09:22:28Z")

</div>

Hi,  
in which port you are running the application? if it’s on UART them i don’t think you can subscribe to it via application.

Also you can check UART1 status using AT+WMFM command

-Alex
