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.

It took too much time to check SciaRegs.SCIFFTX.bit.TXFFST before send data

Hi,

I have two questions about F28335 SCI

First question: I want to use the F28335 SCI FIFO model to send data to PC, but i found that the statement (While (Sciaregs.SCIFFTX.bit.TXFFST! =0);)used to check the FIFO status takes too much time before i write 16 words to the fifo. It is about 800K cpucycles.

I tried a lot and solved the problem by specific a higher Baud rate(38400) at last. But why?

Second question:I write 4 words to SCITXBUF , but I just received 3 or fewer words ,the rest will be received after i write data to SCITCBUF next time.

It seem it a few words are stucke in there , and i have to write something to push them out. what's wrong with it? 

Regards
lee

  • Lee,

    1)  Higher the baud rate, lower the transmission time.

    16 words means 16*10 = 160-bits (assuming no parity and 8-bit data) have to be transferred.  

    Say you chose 19200 as the baud rate.  

    It will take (baud duration)*(number of bits) = (1/19200)*160 = 8.4ms to send out 160-bits out of SCI TX.  Meaning it takes 1260K cycles assuming 150MHz SYSCLKOUT.  

    2)  May be you are not giving enough time for the SCI to receive the data.  

    If you use RX FIFO, set the RXFFIL value to 4.  This will cause SCI to generate a receive interrupt (assuming interrupt is enabled) upon receiving 4 words.  

    If you are not using RX FIFO, then you can enable RX/BK INT ENA and SCI will generate an interrupt whenever RXRDY gets set.    

    Thanks and regards,
    Vamsi  

              

  • hi Vamsi,

    Thanks for your detail reply. Your are right for the first question. 

    But i still got confused about the second question. I received data from serial port of PC by software tool, and i used SCI FIFO to transmit only.

    For example :

    After i write

    Uint16 SerialSYNCBit[8]={0x5A,0x5A,0x5A,0x5A,0x0,0x0,0xFF,0xFF}; 

    to SCITXBUF like:

    while (SciaRegs.SCIFFTX.bit.TXFFST != 0);
    for(i=0;i<8;i++)
    {
    SciaRegs.SCITXBUF = SerialSYNCBit[i];
    }

    I received 5A 5A 5A 5A 00 00 FF on PC,the last FF did not come out.

    I will get the last FF after i write data to FIFO.

    Thanks and regards,
    lee

  • Lee,

    Please check if you are disabling the transmitter in your code after transmitting some bytes.

    Did you try watching the output in an oscilloscope to make sure that SCI is transmitting all the 8 words?

    Thanks and regards,

    Vamsi