Hi,
I’m beginner with Q2686 and i need to use the second UART on my software.
I have already read the forum and check my code with “ADL User Guide for Open AT® OS v6.20” doc but I’m unable to access to the UART(read or write data).
I use M2MStudio to developp/compile my code and have a Q2686 dev kit to run software.
This is my code:
#include "adl_global.h"
#include "adl_OpenDevice.h"
#include "wm_uart.h"
/***************************************************************************/
/* Mandatory variables */
/*-------------------------------------------------------------------------*/
/* wm_apmCustomStackSize */
/*-------------------------------------------------------------------------*/
/***************************************************************************/
const u16 wm_apmCustomStackSize = 1024*3;
/***************************************************************************/
/* Function : adl_main */
/***************************************************************************/
void adl_main ( adl_InitType_e InitType )
{
u32 handle;
sUartSettings_t Settings;
sUartLc_t uartLc;
psGItfCont_t pinterface;
/* Device */
Settings.identity = "UART2";
Settings.role = UART_ROLE_DCE;
Settings.event_handlers = NULL;
/* To retrieve the UART SP Interface */
Settings.interface = &pinterface;
/* Line Coding */
uartLc.valid_fields = UART_LC_ALL;
uartLc.rate = UART_RATE_9600;
uartLc.stop = UART_STOP_BIT_1;
uartLc.parity = UART_PARITY_NONE;
uartLc.data = UART_DATALENGTH_8;
Settings.line_coding = &uartLc;
adl_atSendResponse( ADL_AT_UNS, "UART Struct define\n");
/*------------------*/
/* open UART device */
/*------------------*/
if( 0 <= (handle = adl_OpenDevice( DF_UART_CLID, &Settings)) )
{
adl_atSendResponse( ADL_AT_UNS, "successfully opened\n");
TRACE(( 1, "UART successfully opened" ));
pinterface->write( handle, "Tx Some bytes", 13 );
adl_atSendResponse( ADL_AT_UNS, "Close UART\n");
pinterface->close( handle );
}
else
adl_atSendResponse( ADL_AT_UNS, "opening error\n");
adl_atSendResponse( ADL_AT_UNS, "end software\n");
}
Need help to understand why that doesn’t work …
The board/software always reset at “pinterface->write()” function.