SoftwareSerial resetting problem with Arduino uno

I have configured a SoftwareSerial port on my Uno (Pin 2 Rx and Pin 3 Tx) and connected with the USB port of my PC through a USB to Serial converter based on PL2303. I also connected the build in USB port of the UNO with the same PC. I have opened two terminal programs in PC which are connected to both ports.

My sketch listens to both hardware and software ports and if anything received on any port it is then reflected to the other port.

Now if I send anything to Uno’s hardware port I get the correct reflection from the Uno’s SoftwareSerial port. But If I send a character to the SoftwareSerial port then the Uno seems to immediately resets (I receives “Hello” response from both ports).

I tried this experiment with various baud rates and pin numbers for the SoftwareSerial port. I also tried with an external power supply for the Uno. Still I get the same resetting issue.

SoftwareSerial softPort(2, 3);
void setup()  
{
    Serial.begin(9600);
    while (!Serial) {
    }
    softPort.begin(9600);

    softPort.write("Hello");
    Serial.write("Hello");
}

void loop() 
{
    softPort.listen();
    if (softPort.available() ) {
        Serial.write("3"); //This line never get executed
        Serial.write(softPort.read());
    }
    if (Serial.available() ){
        int value = Serial.read();
        softPort.write(value);
        Serial.write(value);
    }
    delay(10);
}

Remove the softPort.listen() call.

Can you confirm that you have only connected to Rx Tx and GND from the USB-TTL converter?

...R

Robin2: Can you confirm that you have only connected to Rx Tx and GND from the USB-TTL converter? ...R

Yes. Uno PL2303 board Rx (pin2) Tx Tx (pin 3) Rx GND Gnd - 5.0V (Left unconnected) - 3.3V (Left unconnected)

McGayan: Thanks. I will try this and let you know.

I am confused by your decision to write Replies #3 and #4

In the first you confirm my question. In the second you say you will try it. They can hardly both be correct.

...R

Robin2: I am confused by your decision to write Replies #3 and #4

In the first you confirm my question. In the second you say you will try it. They can hardly both be correct.

...R

Oooh. #4 is a mistake. I reconfirm my reply #3. Really sorry about it.

SurferTim: Remove the softPort.listen() call.

Thanks. I will try this and let you know.

SurferTim: Remove the softPort.listen() call.

I did that. But still I get the same result.

I solved this problem. The cause was that my SoftwareSerial.cpp file was changed somehow. Once I saved the latest version everything was fine. Most probably I might have changed it Inadvertently. Thanks all for your valuable time and effort to answer this issue. Really sorry for the inconvenience.