The Rx0 pin of Arduino Due does not work ?

There are my testing code and schematic of Arduino Due

    //-----------------------------------------------
    byte inByte = 0;         // incoming serial byte
    //-----------------------------------------------
    void setup()
    {
      Serial.begin(9600);
    }
    //-----------------------------------------------
    void loop()
    {
     
      //If Serial Receive
      while(Serial.available() > 0) {

        inByte = Serial.read();
        //Print the same data
        Serial.write((char*)&inByte,1);

      }
     
      delay(500);
     
    }
    //-----------------------------------------------

If I Input data form COM1 , the COM2 can display the receive data
but… if I input data from COM2, the COM1 can’t receive any data

In other words, No matter how I input any data to the Rx0 pin, always “Serial.available() == 0” ?

and… does that also means: Arauino Due is Incompatible with XBee Shield (because that use the Tx0/Rx0) ?

It is unlikely to be practical to have two serial connections attached to the same Arduino pins.

The Due has other hardware serial ports - why not connect Com2 to Serial1?

And as long as you can upload code using the USB cable you can be sure your Serial connection is working properly.

...R

Robin2: It is unlikely to be practical to have two serial connections attached to the same Arduino pins.

Exactly. Pins 0 and 1 are connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip. If you also connect them to an external TTL serial device then the two drivers will both be trying to drive the RX pin and fighting against each other. Whichever device wins will be able to send data; you won't be able to receive from the other device.

Given that you have four hardware UARTs to choose from, trying to use the same UART twice seems to be inventing a completely unnecessary problem for yourself - just connect them to different UARTs.

Also, Serial.write((char*)&inByte,1); seems like an extremely contrived way to write a byte, and this sort of pointer type conversion is not recommended.

Thanks... Because I have to use Serial *4 to communicate with other device, so that had to select "Serial0".

Does anyone use Arduino Due + Xbee Shield? I think the problem of Rx0 which made Xbee shield is fail to connect with Arduino Due ...?

strong12345: Because I have to use Serial *4 to communicate with other device, so that had to select "Serial0".

And what about Serial1 or Serial2

"Had to select" makes no sense when that is not a techincal option.

If you really have no option but to use one Serial port for two purposes you will almost certainly need some external circuitry to separate the two systems electrically, and maybe in an ideal world have some means for the Arduino to select between them. Some AND gates (such as a 74HC08) might be suitable. The Arduino could control one of the pins to disable a gate.

If you can't select between them you will need to be sure that the two systems never talk at the same time.

...R

Hi Strong12345!!!

I have the same problem... I can send but don't receive using the DUE board. Did you find any solution?

Solved!

The problem is pinout incompatibility...use another Serial Port