Serial2 is noisy [ESP32 - Arduino]

MartinRE
Posts: 2
Joined: Tue Jul 28, 2020 5:04 am

Serial2 is noisy [ESP32 - Arduino]

Postby MartinRE » Tue Jul 28, 2020 5:24 am

Hello everyone,

I am trying to use the Serial2 for UART communication with a Raspberry3.

But I can't communicate anything, once I connect a wire to pin 16, Serial2.available() is trigger and send me noise. Even when the wire is not even connected to anything, or I just need to touch with my finger the pin and I get noise.

Of course, I get noise even if I correctly connect the wire to the Raspberry3.

I really tried anything to get rid of the noise, but I couldn't find a solution.

So I ultimately posted my issue here.

Here is my minimal code :

Code: Select all

#include <Arduino.h>

#define RXD2 16
#define TXD2 17

void setup() {
  Serial.begin(9600);
  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
  Serial.println("Serial Txd is on pin: "+String(TX));
  Serial.println("Serial Rxd is on pin: "+String(RX));
}

void loop() {
  while (Serial2.available()) {
    Serial.print(char(Serial2.read()));
  }
}
I tried also this solution : https://quadmeup.com/arduino-esp32-and- ... ial-ports/
Same result, I just get noise, even if the pin is not connected.

I attached a picture of how I connect the wires.
raspesp3.jpg
Here is how I connect the wires
raspesp3.jpg (188.57 KiB) Viewed 4580 times
Do someone knows what I am doing wrong ?

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: Serial2 is noisy [ESP32 - Arduino]

Postby idahowalker » Tue Jul 28, 2020 12:03 pm

Are the RPI and ESP32 sharing the same ground?

Have you done a loopback test on the RPi to insure the RPi can send receive serial?

MartinRE
Posts: 2
Joined: Tue Jul 28, 2020 5:04 am

Re: Serial2 is noisy [ESP32 - Arduino]

Postby MartinRE » Tue Jul 28, 2020 12:33 pm

idahowalker wrote:
Tue Jul 28, 2020 12:03 pm
Are the RPI and ESP32 sharing the same ground?

Have you done a loopback test on the RPi to insure the RPi can send receive serial?
Thank you a lot, it was indeed because RPI and ESP32 didn't sharing the same ground. I am a beginner in microcontroller, and I am not really used to the ground proprieties yet.

I just had to plug the ESP32 to the RPI and the noise is gone.

Thank you, it works perfectly now.

Who is online

Users browsing this forum: No registered users and 69 guests