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.

TMS320F28379D: SCI UART communication issues

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hello,

I am trying to transmit data through SCI in asynchronous mode continuously with a baud rate of 6.25 Mbps.

I have a interrupt enabled at 30 kHz and during the ISR and the following is performed within the interrupt.

for (i = 0; i <2; i++) // Transmitting three integers within the ISR

{

TX [i] = i+1;

sci_xmit(TX[i]); 

}

When visualizing the data in the scope, only 2 of them are transmitted in every ISR. I checked if the baud rate is impacting this and it is not so.

Why am I always losing the third packet. Please help me debug this.

SCI FIFO initializations: TXFFST = 0; SCIO FIFO enhancements disabled and SCI Reset disabled

Regards,

Radha

  • Hello Radha,

    Thanks for your question!

    The reason for this is actually C-related. To fix this, you will need to change "i<2" to be "i<=2".

    The reason is that with your current code, when the loop gets to "2", it will fail the test (because 2 is not less than 2).

    Let me know if that fixes the issue!

    Regards,

    Vince

  • Hello Vince,

    Sorry my bad that should be 3. And if 3 in the code as well. 

    I am trying to send a three messages during every ISR at 30 kHz and I still end up missing one. I get a limit of 2 always and I am not able to send more than 2 at any point. The transfer time for all the messages is 3.4 us. Is this something related to the FIFO initialization ?

    Thanks & Regards,

    Radha

  • Hi Radha,

    This can definitely be caused by the FIFO initialization. If your "xmit" function does not wait for the transmit to complete, then you can end up requesting a transmit while the previous transmit occurs. Would you be able to try a blocking version of your xmit function, similar to this function from C2000Ware:

    //*****************************************************************************
    //
    //! Waits to send a character from the specified port.
    //!
    //! \param base is the base address of the SCI port.
    //! \param data is the character to be transmitted.
    //!
    //! Sends the character \e data to the transmit buffer for the specified port.
    //! If there is no space available in the transmit buffer, or the transmit
    //! FIFO if it is enabled, this function waits until there is space available
    //! before returning. \e data is a uint16_t but only 8 bits are written to the
    //! SCI port.  SCI only transmits 8 bit characters.
    //!
    //! \return None.
    //
    //*****************************************************************************
    static inline void
    SCI_writeCharBlockingNonFIFO(uint32_t base, uint16_t data)
    {
        //
        // Check the arguments.
        //
        ASSERT(SCI_isBaseValid(base));
    
        //
        // Wait until space is available in the transmit buffer.
        //
        while(!SCI_isSpaceAvailableNonFIFO(base))
        {
        }
    
        //
        // Send a char.
        //
        HWREGH(base + SCI_O_TXBUF) = data;
    }

    This should avoid any collisions.

    If you are able to, implementing the FIFO may also help with this situation, as you can load more data into the buffer.

    Regards,

    Vince

  • Hello Vince,

    Thank you so much for your reply. I will check this blocking function and get back to you early next week. 

    Thanks & Regards,

    Radha