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.

TMS320F280025: Half-duplex RS485 transceiver with SCI

Part Number: TMS320F280025
Other Parts Discussed in Thread: C2000WARE

Dear Champs,

I am asking this for our customer.

If they need to confirm the TX buffer has been empty and then enable RX on a half-duplex RS485 transceiver.

How does the user do if they use the SCI module?

Wayne Huang

  • Hi Wayne,

    Thanks for your question! A direct way to check the TX buffer status in C2000Ware driverlib is using "SCI_getTxFIFOStatus()". See the below code snippet that does the opposite (waits until there is at least one byte available, meaning nearly full):

    Fullscreen
    1
    2
    3
    4
    5
    6
    //
    // Wait until space is available in the transmit FIFO.
    //
    while(SCI_getTxFIFOStatus(base) == SCI_FIFO_TX15)
    {
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    You could instead use >= SCI_FIFO_TX0 to effectively wait "while the FIFO is not empty".

    Regards,

    Vince

  • Dear Vince,

    If FIFO is not used, does that any register/bit/interrupt that can be used to check empty on the SCI module?

    Wayne

  • Hi Wayne,

    See the below function that checks if the transmit buffer has space for non-FIFO from C2000Ware. You can also find these functions and more in the "sci.h" and "sci.c" files in C2000Ware, which gives the other available functions/functionality on the SCI software!

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //*****************************************************************************
    //
    //! Determines if there is any space in the transmit buffer when the FIFO
    //! enhancement is not enabled.
    //!
    //! \param base is the base address of the SCI port.
    //!
    //! This function returns a flag indicating whether or not there is space
    //! available in the transmit buffer when not using the FIFO enhancement.
    //!
    //! \return Returns \b true if there is space available in the transmit buffer
    //! or \b false if there is no space available in the transmit buffer.
    //
    //*****************************************************************************
    static inline bool
    SCI_isSpaceAvailableNonFIFO(uint32_t base)
    {
    //
    // Check the arguments.
    //
    ASSERT(SCI_isBaseValid(base));
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards,

    Vince