Communication problems due-uno

Hi everybody,
I have a problem. I would like my UNO and DUE card to communicate.
Here is my code :

//DUE
void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}
void loop() {
   if (Serial.available() > 0)
  {
    Serial1.write(Serial.read());
    Serial.write(Serial.read());//to check if the due understands what I write
  }
  if (Serial1.available() > 0)
  {
    char s = Serial1.read();
    Serial.print(s);
  }
}

//UNO
void setup() {
  Serial.begin(115200);
}
void loop() {
  if (Serial.available() > 0)
  {
    char s = Serial.read();
    if (s != 10)
    {
      Serial.write(s);
    }
  }
}

The UNO understands what I write and transmits it right to the DUE. However, the DUE doesn't understand what I write. For example, if I type hello in the serial monitor it will write ?????? and the DUE transmits ???? (yes, not the same amount of ?) to the UNO.
My connections are right so I don't know what's wrong.
Can anyone help me ?

Did you remember level translators?
The Due is not 5V-tolerant, IIRC.

I did a circuit to change the voltage between the uno and the due. Is that why it doesn't work?
Because, if the circuit is the reason why. I don't understand why the uno transmits the message right to the due but the due doesn't transmit nor understand the message he must send.

Post a complete wiring diagram of that setup!

In the original post you described the error the other way around, which would make sense. As the Due sends with a 3.3V level the UNO will recognize that as a valid signal. The UNO sends with a 5V signal which might be caught for a while by the protection diodes but sooner or later will fry the corresponding pin on the Due but won't be recognized as a valid signal most probably.

image1
Here is the first wiring diagram
Sorry if my explanations were not clear. The problem is the transmision from the DUE to the UNO.
The transmision UNO-DUE is ok. If I t type something in the serial monitor of the UNO, it will send it correctly to the DUE.
But the transmission DUE-UNO doesn't work. If I t type something in the serial monitor of the DUE, it sends questions marks to the UNO.
My goal is to transmit informations form the DUE to the UNO and then the UNO sends back an answer to the DUE.

Here is the second wiring diagram
image2

You use the only hardware serial of the UNO to communicate with the DUE, so you must no use it for the serial monitor.

Did you check if your level conversion does work? I would say this circuit (Due TX -> UNO RX) cannot work. You don't have a voltage higher than GND in the DS path of the MOSFETs.

Yes, otherwise there wouldn't be any results.

5V to 3.3 V
https://forum.arduino.cc/t/connecting-arduino-uno-to-esp8266/432804

Wrong, you produce a floating pin which might end in any random input on that pin.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.