I have an application that requires CTS/RTS flow control in order to send bulk data at relatively high UART speeds. Since the C2000 does not have flow control built into the peripheral, I have implemented it by checking the status of an input line before sending a byte. Since the device also seems to buffer a few bytes with or without the FIFO turned on, I have also used logic to make sure that the FIFO buffer is empty. It still seems that very occasionally, I am overrunning the receive buffer by about 2 bytes out of every few million. I have posted the code I am using below in case anybody sees any errors.
As I am writing this, I am also considering the possibility of disabling the SCI peripheral clock whenever the flow control from the module is asserted. I do not want to lose any buffered bytes, however. Is this a good or bad idea? Any other suggestions?
Here is my current code:
void Scib_xmit(int a)
{
while(GpioDataRegs.GPADAT.bit.GPIO10 == 1 || ScibRegs.SCICTL2.bit.TXRDY == 0 || ScibRegs.SCIFFTX.bit.TXFFST != 0)
{
}
ScibRegs.SCITXBUF = a;
}