Hi man,
I am using TL16c754b as uarts expantion. When FIFO is disabled, interrupt enabled,by polling LSR bit 5 or bit 6 till to HIGH and send the next data,it works well. However, when FIFO is enabled, wait untill by polling LSR bit 5 or bit 6 to High and send the next data,will loss data? for example, i send ascii char from '0' to '9' out and I will not receive '0' or '1' or '5',etc.Why?
Hardware info, DSP 6713 as controller.emif ce3 configured as async 8 width.
Software cods as follows(partial).
int UART_SENDBYTE(unsigned int port,unsigned char data)
{
volatile unsigned char statustmp=0;
volatile unsigned char tmpst=0x0;
volatile unsigned char tmp=0x0,tmp1,tmp2;
volatile unsigned int lsr_falt;
lsr_falt= *(unsigned int *)(0xb0000004);
tmp1=*(unsigned char *)(BASE_UART + (port <<(20-2)) + 0x4);
tmp2=*(unsigned char *)(BASE_UART + (port <<(20-2)) + 0x5);
statustmp=*(volatile unsigned char *)(BASE_UART + (port <<(20-2)) + UART_LSR);//
tmpst= (statustmp&(1<<LSR_TRANSMIT_AND_SHIFT_EMPTY));//
//tmpst= (statustmp&(1<<LSR_TRANSMIT_EMPTY));
if(tmpst)//if empty then send
{
*(volatile unsigned char *)(BASE_UART + (port <<(20-2))+UART_THR) = data;
return(SENDOK);
}
else
{
lsr_falt= *(unsigned int *)(0xb0000004);
tmp1=*(unsigned char *)(BASE_UART + (port <<(20-2)) + 0x4);
tmp2=*(unsigned char *)(BASE_UART + (port <<(20-2)) + 0x5);
return(SENDERROR);
}
}
int uart_send_byte_while(unsigned int port,unsigned char data)
{
while(UART_SENDBYTE(port,data)!= SENDOK);
}
main()
{
for(i=0;i<1000;i++)
for(k='0';k<='9';k++)
{
uart_send_byte_while(UART1,k);
}
}
//////////////////////
some question here,
1, DSP works in freq 200M,should it too fast? but I try to delay between two sends,not works
2,can you give me a reference code for test?
3,when in FIFO mode, once LSR bit 5 is 1, then I send just only one data to THR, is it ok? or Should I send till the FIFO is full?
4,I initialized the 16C754 as follows, first I reset the 16c754 by pull high the RESET ,then set the baud rate, then the MCR ,FCR, IER,LCR ,is this ok?
5,
thanks for the detailed explanation. This helps a lot.
Regards,
Praveen GD