tkvenki
New Member
Hi all,
I'm using a ST16C2550 (Dual UART) to interface to my controller.
I'm using POLLING MODE in controlling the UART.
I'm writing the following configuration to the UART:
Uart_Write(LCR, 0x80); //Divisor latch enable
Uart_Write(DLL, 0x0C); //set the baud rate to 9600
Uart_Write(DLH, 0x00);
Uart_Write(LCR, 0x03); //8data bits-1 stop bit-no parity
Uart_Write(FCR, 0x01); //Enable rx and tx FIFO
Uart_Write(IER, 0x00); //Disable all interrupts.
In my code:
while (1)
{
OSTimeDlyMillisec(1000);
if(Uart_Read(LSR) & 0x01)
{
ch = Uart_Read(RXTX);
printf("\n BYTE IN RX BUFFER = %x\n",ch);
Uart_Write(RXTX, ch);
}
}
I'm polling the LSR register. THe LSB of LSR gets high as soon as a byte is present in the FIFO. Then if the check is successful i read the data and send back the same.
BUt when i read the LSR(in my read routine), I'm getting only the default value(0x60). The value is not getting updated at all. I used my oscilloscope and confirmed that the data is coming till the UART pins.
Please help me out in identifying the problem.
Best Regards
tkvenki
I'm using a ST16C2550 (Dual UART) to interface to my controller.
I'm using POLLING MODE in controlling the UART.
I'm writing the following configuration to the UART:
Uart_Write(LCR, 0x80); //Divisor latch enable
Uart_Write(DLL, 0x0C); //set the baud rate to 9600
Uart_Write(DLH, 0x00);
Uart_Write(LCR, 0x03); //8data bits-1 stop bit-no parity
Uart_Write(FCR, 0x01); //Enable rx and tx FIFO
Uart_Write(IER, 0x00); //Disable all interrupts.
In my code:
while (1)
{
OSTimeDlyMillisec(1000);
if(Uart_Read(LSR) & 0x01)
{
ch = Uart_Read(RXTX);
printf("\n BYTE IN RX BUFFER = %x\n",ch);
Uart_Write(RXTX, ch);
}
}
I'm polling the LSR register. THe LSB of LSR gets high as soon as a byte is present in the FIFO. Then if the check is successful i read the data and send back the same.
BUt when i read the LSR(in my read routine), I'm getting only the default value(0x60). The value is not getting updated at all. I used my oscilloscope and confirmed that the data is coming till the UART pins.
Please help me out in identifying the problem.
Best Regards
tkvenki