SoftwareSerial question?

I have an Arduino Uno with digital pins 2 and 3 connected together to form a Tx -> Rx loopback. The following code seems to have a problem as no characters are ever received. A scope says the characters are indeed transmitted on the Tx pin. I'd be grateful for any insight you wizards can provide.

Using Arduino 1.0.3.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(3,2); // rx, tx

void setup() {
  
  Serial.begin(115200); // serial Monitor
  mySerial.begin(9600); // loopback baud rate
  
  Serial.println("SoftwareSerial loopback test...");
}

void loop() {
  mySerial.write('X'); // send any character
  delay(100);
  if (mySerial.available())
    Serial.println(mySerial.read()); // print data from loopback
}

I thought the softwareserial routines were HALF duplex.

astrofrostbyte:
I thought the softwareserial routines were HALF duplex.

I believe that is correct and doing a simple loop back test may not work at all with software serial.

Lefty

astrofrostbyte:
I thought the softwareserial routines were HALF duplex.

Thanks. You're right they are.

astrofrostbyte:
I thought the softwareserial routines were HALF duplex.

Sounds pretty likely, but there's no mention of this restriction in the documentation for the SoftwareSerial library. Is it documented anywhere?

I also remembered this , but I can not find statement on the arduino.cc pages saying so. otherwise I would have referenced it in my previous answer.

in the library code I spot this , the cli() is used in the .write() method:

size_t SoftwareSerial::write(uint8_t b)
{
  if (_tx_delay == 0) {
    setWriteError();
    return 0;
  }
  uint8_t oldSREG = SREG;
  cli();  // turn off interrupts for a clean txmit                                    <---      !!!

  // Write the start bit
  tx_pin_write(_inverse_logic ? HIGH : LOW);
  tunedDelay(_tx_delay + XMIT_START_ADJUSTMENT);
  ....  etc ....

This behaviour is something that should be added on the arduino.cc softserial page.