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.
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):
// // Wait until space is available in the transmit FIFO. // while(SCI_getTxFIFOStatus(base) == SCI_FIFO_TX15) { }
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!
//***************************************************************************** // //! 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)); // // Return the availability of space. // return(((HWREGH(base + SCI_O_CTL2) & SCI_CTL2_TXRDY) == SCI_CTL2_TXRDY) ? true : false); }
Regards,
Vince