Hello,
I am observing is that there is no activity on the Tx line even though the code is writing data to the THR register. Also the code monitors bit 6 of the LSR register to ensure that both the Tx FIFO and the Tx shift register are empty. The Tx line remains at 3.3V.
Which is the solution?
CSL_UartSetup mySetup =
{
// Input clock freq in MHz
100000000,
// Baud rate
38400,
// Word length of 8
CSL_UART_WORD8,
// To generate 1 stop bit
0,
// Disable the parity
CSL_UART_DISABLE_PARITY,
// Enable trigger 14 fifo
CSL_UART_FIFO_DMA1_DISABLE_TRIG14,
// Loop Back enable
CSL_UART_NO_LOOPBACK,
// No auto flow control
CSL_UART_NO_AFE ,
// No RTS
CSL_UART_NO_RTS ,
};
void Init_Uart(void)
{
CSL_UartIsrAddr isrAddr;
CSL_Status
status;
Uint32
sysClk;
sysClk = getSysClk();
mySetup.clkInput = sysClk;
// Loop counter and error flag
status =
UART_init(&uartObj,CSL_UART_INST_0,UART_INTERRUPT);
if(CSL_SOK != status)
{
printf("UART_init failed error
code %d\n",status);
return;
}
else
{
printf("UART_init Successful\n");
}
// Handle created
hUart = (CSL_UartHandle)(&uartObj);
// Configure UART registers using setup structure
status = UART_setup(hUart,&mySetup);
if(CSL_SOK != status)
{
printf("UART_setup failed error
code %d\n",status);
return;
}
else
{
printf("UART_setup
Successful\n");
}
// Configure and Register the UART interrupts
isrAddr.tbeiAddr = uart_txIsr;
// Configuring Interrupt
IRQ_plug (UART_EVENT, &UART_intrDispatch);
Buff_tx_uart[0] = 'L';
Buff_tx_uart[1] = 0xAA;
// Enabling Interrupt
IRQ_enable(UART_EVENT);
// Set the UART callback function
status = UART_setCallback(hUart,&isrAddr);
if(status != CSL_SOK)
{
printf("UART_setCallback
Failed\n");
}
}
void uart_txIsr(void)
{
status = UART_eventDisable(hUart, CSL_UART_XMITOR_REG_EMPTY_INTERRUPT);
}
interrupt void
UART_intrDispatch(void)
{
Uint16 eventId = 0;
IRQ_disable(UART_EVENT);
/* Get the event Id which caused interrupt */
eventId = UART_getEventId(hUart);
return;
}
void main()
{
status = UART_eventEnable(hUart, CSL_UART_XMITOR_REG_EMPTY_INTERRUPT);
UART_write( hUart,Buff_tx_uart,2,0);
}