Working with two RS232 shields, one RS232 Port not receiving data

Hi There,

I am currently working on a project involving reading data from two different RS232 ports and eventually sending them over a wireless network.

I am using the Pyserial library in a python script to send strings of characters to the RS232 ports from the USB ports on my laptop. At this stage the exact same string of data is being sent to both ports.

I currently have one RS232 port working and receiving data, although the other port does not seem to recognize that data is being sent through the port and thus the (Serial.avaliable() > 0) is always returning false.

In terms of troubleshooting I have tried to test each port in isolation (hence why a large portion of the code is commented out in the file attached) and I still get the same result. I am not sure why this might happen as it seems as though I am feeding them the exact same commands just with a different name for the serial port.

Here is a shortened version of my code;

#include <SoftwareSerial.h>
SoftwareSerial PortOne(2,3); //232_TX,232_RX
SoftwareSerial PortTwo(4,5); //232_TX,232_RX
char PortOneData[18];
char inByte;
int count = 0;
char PortTwoData[5];
int endbyte = 0;
void setup() {

  • // put your setup code here, to run once:*
  • // Open serial communications and wait for port to open:*
  • Serial.begin(9600);*
  • while (!Serial) {;} // wait for serial port to connect. *
  • // set the data rate for the SoftwareSerial port*
  • PortTwo.begin(9600);*
  • Serial.println(“RS232 - Port Two connected”);*
  • PortOne.begin(9600);*
  • Serial.println(“RS232 - Port One connected”);*
    void loop() {
    _ /*PortOne.listen();_
  • while(PortOne.available()>0){*
  • while( !=’#’){;}*
  • for (int i =0;i<=18;i++){*
  • inByte =;*
    PortOneData = inByte;}}*/
    * PortTwo.listen(); *
    * while(PortTwo.available()>0){// this check is alway returning false at the present.*
    * while( == ’ '){;}*
    * PortTwo.write(;*
    * Serial.println();}}*
    Any suggestions or help would be greatly appreciated.
    Thank you in advance!

    test.ino (1.68 KB)

In terms of troubleshooting I have tried to test each port in isolation

I wonder if you are expecting too much from SoftwareSerial. You should probably be using a Mega which has 3 spare HardwareSerial ports.

And have a look at the examples in Serial Input Basics - simple reliable ways to receive data.