31
NXPTM M522XX, KINETIS and i.MX RT / uart1 appearing on uart0
« on: March 20, 2009, 12:48:59 AM »
Mark,
I'm trying to setup uart1, and I've followed http://www.utasker.com/forum/index.php?topic=54.msg220#msg220 as best as I can. But when I send data to the uart1 handle, it is still appearing on uart0.
My test code:
uart defines in app_hw_m5223x.h
my configuration code in application.c:
and the serial uart configuration:
If anyone can provide some guidance, that would be great.
Thanks,
Aaron
I'm trying to setup uart1, and I've followed http://www.utasker.com/forum/index.php?topic=54.msg220#msg220 as best as I can. But when I send data to the uart1 handle, it is still appearing on uart0.
My test code:
Code: [Select]
void fnMyFirstTask(TTASKTABLE *ptrTaskTable){
unsigned char buffer[]="test code\r\n";
fnDebugMsg("spid1: ");
fnPrint ((unsigned char *)buffer, SerialPortID);//should appear on uart0
fnDebugMsg("spid2: ");
fnPrint ((unsigned char *)buffer, DebugHandle); //should appear on uart0
fnDebugMsg("spid3: ");
fnPrint ((unsigned char *)buffer, SerialPortID1); //should appear on uart1
}
uart defines in app_hw_m5223x.h
Code: [Select]
//#define DEMO_UART 0 // use UART 0
//#define PPP_UART 1 // use UART 1 for PPP
#define UART0 0
#define UART1 1 //uart1
my configuration code in application.c:
Code: [Select]
#ifdef SERIAL_INTERFACE
QUEUE_HANDLE SerialPortID; // serial port0 handle
QUEUE_HANDLE SerialPortID1; // serial port1 handle
#endif
//in fnApplication
#ifdef SERIAL_INTERFACE // this serial interface is used for debug output and menu based control
if (!fnSetNewSerialMode(FOR_I_O)) { // open serial port for I/O
return; // if the serial port could not be opened we quit
}
DebugHandle = SerialPortID; // assign our serial interface as debug port
if (!fnSetNewSerialMode2(FOR_I_O)) { // open serial port for I/O
return; // if the serial port could not be opened we quit
}
#endif
and the serial uart configuration:
Code: [Select]
//configure uart1
extern QUEUE_HANDLE fnSetNewSerialMode2(unsigned char ucDriverMode)
{
TTYTABLE tInterfaceParameters; // table for passing information to driver
tInterfaceParameters.Channel = UART1; // set UART channel for serial use
tInterfaceParameters.ucSpeed = temp_pars->temp_parameters.ucSerialSpeed; // baud rate
tInterfaceParameters.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE; // input buffer size
tInterfaceParameters.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE; // output buffer size
tInterfaceParameters.Task_to_wake = OWN_TASK; // wake self when messages have been received
#ifdef SUPPORT_FLOW_HIGH_LOW
tInterfaceParameters.ucFlowHighWater = temp_pars->temp_parameters.ucFlowHigh;// set the flow control high and low water levels in %
tInterfaceParameters.ucFlowLowWater = temp_pars->temp_parameters.ucFlowLow;
#endif
tInterfaceParameters.usConfig = temp_pars->temp_parameters.usSerialMode;
#ifdef TEST_MSG_MODE
tInterfaceParameters.usConfig |= (MSG_MODE);
#if defined (TEST_MSG_CNT_MODE) && defined (SUPPORT_MSG_CNT)
tInterfaceParameters.usConfig |= (MSG_MODE_RX_CNT);
#endif
tInterfaceParameters.usConfig &= ~USE_XON_OFF;
tInterfaceParameters.ucMessageTerminator = '\r';
#endif
#ifdef SERIAL_SUPPORT_DMA
tInterfaceParameters.ucDMAConfig = UART_TX_DMA; // activate DMA on transmission
//tInterfaceParameters.ucDMAConfig |= (UART_RX_DMA | UART_RX_DMA_HALF_BUFFER); // test half buffer DMA reception
#endif
if ((SerialPortID1 = fnOpen( TYPE_TTY, ucDriverMode, &tInterfaceParameters )) != 0) { // open or change the channel with defined configurations (initially inactive)
fnDriver( SerialPortID1, ( TX_ON | RX_ON ), 0 ); // enable rx and tx
if (tInterfaceParameters.usConfig & RTS_CTS) { // {8}
fnDriver( SerialPortID1, (MODIFY_INTERRUPT | ENABLE_CTS_CHANGE), 0 ); // activate CTS interrupt when working with HW flow control (this returns also the present control line states)
fnDriver( SerialPortID1, (MODIFY_CONTROL | SET_RTS), 0 ); // activate RTS line when working with HW flow control
}
}
return SerialPortID1;
}
If anyone can provide some guidance, that would be great.
Thanks,
Aaron