I'm having some troubles with USART flow control on the Atxmega256. I'm communicating with a modem which uses RTS/CTS for flow control. Once the modem sets CTS to low, I want to stop sending data until it goes high again. I'm currently using interrupt driven USART routines and can't seem to find a good way to halt the sending. If i just stop sending when CTS goes low, the data allready in the send buffers will still be sent and therefore lost.
I've tried the follow to disable/enable sending:
if(false == clearToSend()) {
USART_TxdInterruptLevel_Set(data->usart, USART_TXCINTLVL_OFF_gc);
while(false == clearToSend()) {}
USART_TxdInterruptLevel_Set(data->usart, USART_TXCINTLVL_LO_gc);
}
Unfortunately that seems to disable the sending permanently. Any ideas?
Best regards Fredrik