See below a quick tutorial to connect and use Serial1 (RX19 pin and TX18 pin) of Arduino Mega to Raspberry.
This way you will be able to use Serial1 for debugging in parallel of using Serial0 (standard USB to USB connection) for sending or receiving data without disturbing this process.
I hope that will help you guys and avoid to spend weeks trying to figure it out as I did.
1) Buy a USB to TTL serial cable, 5 VDC power and 3,3 VDC serial voltage as Arduino / Raspberry USB serial voltage is 3,3 VDC
2) Match Arduino 18TX1 pin 5VDC voltage to 3,3 RX USB adaptor voltage.
Use and wire a voltage divider to your Arduino 18TX pin to drop the voltage from 5VDC to 3,3 VDC (Vout).
R2 987 ohms and R1 549 ohms used.
Vout = 5*987 / (987 + 549) = 3,2 VDC
Voltage treshold on arduino mega is 3.0 VDC => OK TX of USB to TTL serial cable can trigger 19RX1 with 3,3 VDC.
connect Vcc of voltage divider to 18TX1
Connect cable power (Red) of "USB to TTL serial cable" to Arduino 5VDC.
Connect cable ground (Black) of "USB to TTL serial cable" to Arduino ground common of the voltage divider ground.
Connect RX (white) cable of "USB to TTL serial cable" to Vout of voltage divider which is connected to 18TX1 pin via the voltage divider.
Connect TX (green) cable of "USB to TTL serial cable" to 19RX1 pin.
3) Coding on Arduino and Raspberry.
Arduino Serial0 port is already called ACM0 for Arduino Mega
For Serial1 USB port check on raspberry CMD by typing => "ls /dev/tty*" then check which extra USB port has been connected.
Serial.println("Hello Serial 0");
Serial1.println("Hello Serial 1");
Serial = serial.Serial('/dev/ttyACM0', 115200, timeout=1)
Serial1 = serial.Serial('/dev/ttyUSB0', 115200, timeout=1)
if Serial1.in_waiting > 0:
MessageSerial1 = Serial1.readline()
if Serial.in_waiting > 0:
MessageSerial = Serial.readline()