This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TL16C754B: Once FIFO enabled, it will loss data while sending data out?

Part Number: TL16C754B

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

  • one message to metion, I polled LSR and found that, when empty(LSR 5 high) and sending the next data, the register LSR bit 5 or 6 will keep HIGH after I write data to THR a few time, is it unnormal?
  • Hello Tao

    Sorry but the issue is not clear to me. LSR register is for reading, it means that you can't write into it.
    Your code is not clear to me as well.
    I'll try to answer your questions.
    1. This device works up to 32 MHz, then I recommend you to use a frequency smaller than this one. I am guessing that the data, /IOW, /IOR and necessary signals that you are sending are inside of these frequency, aren't they?
    2. My recommendation for test and know that your UART is working is, in the beginning apply a reset and read the LCR and LSR registers, you have to have 1D and 60.
    3. Is ok as you say.
    4. Sounds ok, but Can you send me the code or only the instructions that you are executing?
    The behavior that you mention in second part of the post, is normal.

    Regards
    Francisco
  • Hello Francisco,

    This issue has been resolved now. By step down the frequency of the bus , the FIFO works ok.

    Reasons may be that I wrote to the IC too fast so that the data did not wrotten into it.

    However I still wonder the difference between the FIFO mode and NON-FIFO mode of the bus timing?

    Thanks very much

    Regards

    Tao

  • Hello Tao

    Great! When you are working with FIFO mode you can save up to 64 bytes and when you are working with non FIFO mode you can use only one byte, then if you send only one byte in both cases, the timing are the same.

    Please, let me know if you have any other question.
    Regards
    Francisco