Receiving garbage on serial communication with nodemcu


I have 2 boards, a nodemcu and an arduino mega that I want to exchange packets of data between them. For this I'm using Serial3 on Arduino Mega and Serial on NodeMCU (GPIO13 and GPIO15).

I initialize Serial3 with 9600 baud and then do the same for Serial on the nodemcu. After that I try to send a byte (0x55) every 5 seconds (it's easier to debug a single byte instead of a frame) to the mega but it only receives garbage. Constant garbage, but still garbage. It always received 0x38 0x35 0xD and 0xA in one send.

I have checked my connections and I can see on an oscilloscope that 0x55 is getting to the nodemcu, well, it seems to be 0x55, but even so, I can see that only 1 byte gets to the mega and not four.

Is there a problem with nodemcu's (ESP8266) serial communication? It might be a programming problem.

Has anyone succeeded in exchanging frames between an ESP8266 and an arduino?

PS: I also tried using the SPI for communication, setting the arduino to slave, but still no luck. It received the wrong byte, maybe it's due to the format settings.

How are the two devices connected ? Have they got a common GND connection ?

How about posting your code.

0x38 0x35 0xD and 0xA

These are the characters 8 (0x38), 5 (0x35) followed by carriage return and linefeed.

You say you are sending 0x55 but that is decimal 85 so I'm going to go out on a limb and say that you aren't sending the character 0x55 at all. You are sending the number 0x55 using println which adds the CR/LF