Electrical – UART Tx stops working without UART Rx connected

microchipmicrocontrollerpicserialuart

So my problem is that when I have both Tx and Rx connected to an FTDI cable with ground connected as well. When I have both cables connected I can send message as expected. But as soon as I disconnect the Rx cable the transmissions stop and I have to restart the device in order to get it going again. Just reconnecting the Rx cable doesn't work.

Im using a PIC processor that I transmit from and I use Putty to monitor the data.

Summary

  • All cables connected
  • Send data in endless loop ( works fine )
  • Disconnect the Rx cable -> all transmissions stops

As far as I've understood I should not need the Rx cable to be connected at all since the uart is configured to be asynchronous. But correct me if I'm wrong.

Best Answer

It may be that the RX Interrupt goes into an infinite loop of unhandled interrupts or an overrun or frame error occurs. To protect against that, flush the receive buffer and reset the UART if this occurs. i.e. put this into the RXInterrupt code

if (PIR1bits.RC1IF)
{
  PIR1bits.RC1IF = 0;

  if ((RCSTAbits.OERR) || (RCSTAbits.FERR))
  {
    // Resets UART
    RCSTAbits.CREN = 0;
    Nop();Nop();Nop();Nop();
    RCSTAbits.CREN = 1;

    // Clears RX Buffer
    RCREG;
    RCREG;
  }
}