0
\$\begingroup\$

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.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ Did you consider posting cable drawing? who knows what is actually connected there... \$\endgroup\$
    – user76844
    Apr 7, 2017 at 7:50
  • 1
    \$\begingroup\$ What exactly do you mean by 'tx' and 'rx', and in which direction are you sending the data? \$\endgroup\$ Apr 7, 2017 at 8:02
  • \$\begingroup\$ When I'm talking about Tx/Rx cable I mean the cables from the PIC processor. Pic Tx is connected to FTDI Rx and PIC Rx is connected to FTDI Tx. I'm sending the data from the PIC to the FTDI ( so I can see the data in Putty ) \$\endgroup\$ Apr 7, 2017 at 8:13
  • 1
    \$\begingroup\$ Did you connect the GND? Perhaps not, so your RX line shares some potential, enough to make TX working. \$\endgroup\$ Apr 7, 2017 at 8:21
  • 1
    \$\begingroup\$ Show us your UART IRQ code. But I'm going to guess that you're not handling RX errors correctly and your PIC is therefore stuck in the RX IRQ handler. \$\endgroup\$
    – brhans
    Apr 7, 2017 at 14:45

1 Answer 1

1
\$\begingroup\$

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;
  }
}
\$\endgroup\$
1
  • \$\begingroup\$ A good chance of this being the problem, or one of many. \$\endgroup\$
    – user105652
    May 10, 2018 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.