UART Open Error


#1

Hi,

I have used the UART before with no porblems, but now I’ve been having some trouble. I have checked that the ports are enabled with +WMFM, but I still get “-1” returned everytime I run adl_odOpen. Unfortunately it’s the general error code.

Is there any other hardware configuration which could be interferring with opening the UART?

Here is the UART code and the callback table structure
static const sGCbDesc_t uartCbTab[] =
{
{ (void*)-1L,NULL},
{ (void*)-1L,NULL},
{ (void*)UART_CB_ON_RX_DATA_AVAILABLE,&uart_OnRxDataAvailable},
{ (void*)-1L,NULL},
{ (void*)-1L,NULL},
{ (void*)-1L,NULL}
};

            // UART  Code
            /*Subscribe to UART2*/
UartLineCoding.valid_fields = UART_LC_ALL;
UartLineCoding.stop = UART_STOP_BIT_1;
UartLineCoding.parity = UART_PARITY_NONE;
UartLineCoding.rate = (eUartRate_t)(UART_RATE_USER_DEF | 115200); 
UartLineCoding.data = UART_DATALENGTH_8;


// Events
Events.user_data = (void*)0;			
Events.valid_cb = UART_CB_ON_ALL;	         
TRACE (( 2, "Uart.c bug checker" ));
memcpy((u8*)Events.cb_list, (u8*)uartCbTab, 6*sizeof(sGCbDesc_t)); 

UartSettings.identity = "UART2";
UartSettings.event_handlers = &Events;
UartSettings.interface = &pinterface;
UartSettings.role = UART_ROLE_NM;
UartSettings.capabilities = NULL;
UartSettings.line_coding = &UartLineCoding;


UartHandle = adl_odOpen(DF_UART_CLID,&UartSettings);

Thanks!


#2

Hi,

Please make sure that you disable the port using +WMFM before trying to open using Open device API and also the port that you are trying to disable should be different from the port where the command is issued.

Hope it helps!

Regards,
Rex