Using rs232 with handshake issue
- /RaspberryPi
- Corporate
- Posts: 2449
- Joined: Wed Jun 05, 2019 1:29 am
Using rs232 with handshake issue
I've written some c++ code to test RS232. It appears to work fine in no handshake mode when connected to putty terminal. So I added handshaking XON/XOFF or CTS it appears to work. However if I change putty to NONE for the handshake or the wrong handshake it still reads the correct signals. I thought this couldn't be right so I used gtkterm to read my signals. This works fine with no handshake, but is the opposite of putty because nothing is shown as coming through with handshakes. I set my code with
// Set handshake switch (this->port.handshake) { case NO_FLOW_CONTROL: // No handshake serialConfig.c_cflag &= ~CRTSCTS; // Disable hardware flow control serialConfig.c_iflag &= ~(IXON | IXOFF | IXANY); // Disable software flow control break; case FLOW_CONTROL: // CTS/RTS hardware flow control serialConfig.c_cflag |= CRTSCTS; // Enable hardware flow control serialConfig.c_iflag &= ~(IXON | IXOFF | IXANY); // Disable software flow control break; case FLOW_CONTROL_XONXOFF: // XON/XOFF software flow control serialConfig.c_cflag &= ~CRTSCTS; // Disable hardware flow control serialConfig.c_iflag |= (IXON | IXOFF | IXANY); // Enable software flow control break; default: std::cerr submitted by /u/knobby_67
Source: https://www.reddit.com/r/raspberry_pi/c ... ake_issue/
/RaspberryPi