Messages in Serial3 don't have the right data

I have an Arduino Mega writing to a serial port, which is then read by another system. I'm finding that when I output to Serial through the USB-B programming port, the other system can read it fine, but when I output to Serial3 through pins 14 and 15, the messages come out garbled.

Here's a minimum reproducible example:

void setup() {
Serial.begin(9600);
Serial3.begin(9600);
}

void loop() {
Serial.print("Test");
Serial3.print("Test");
delay(3000);
}

And some examples of outputs and interpretations:

Output                Serial Read             Serial3 Read
----------------------------------------------------------------
Test                  Test                    \DC1$00
Hello World           Hello World             $DAt$BA\STX$00
000                   000                     $F6\ACK$00
001                   001                     $D6\ACK$00
002                   002                     $B6\ACK$00
012                   002                     $D6$B6\ACK$00

I've validated that multiple different systems have the same problem and that they work with other output systems, so I'm confident the problem is on the Arduino end. My theory is that I missed something in setting up Serial3 and it's not outputting data properly, but I don't know what issue that might be. Any ideas?

You didn't explain what device is receiving the data from Serial3. That's kind of important, since the problem could be there.

Have you tried a simple loopback test sketch with the serial pins cross connected?

Has it crossed your mind that a problem with Serial3 would be experienced by hundreds if not thousands of users?

The device receiving the data is a PC running DEWESoft Serial Communication Control Center. The messages are transmitted from Serial3, through a DB9, through a DB9 to USB, to the PC.

I haven't tried that. Would I need to take apart a USB-B cable to connect Serial to Serial3?

It certainly has occurred to me, as I indicated by saying, "My theory is that I missed something in setting up Serial3 and it's not outputting data properly, but I don't know what issue that might be." I'm not sure where I implied that the problem lies with the Arduino system itself and not my use of it.

This:

The loopback test just connects jumper wires directly from Serial TX/RX to Serial3 RX/TX.

The problem is probably in your cabling/wiring so please post a diagram of that, also a link to specs or information about DEWESoft Serial Communication Control Center

You might have the baud rate set wrong on the PC.

Does the DEWESoft Serial Communication Control Center have an RS232 serial interface by any chance ?

Ah I see, I just meant that the problem isn't with the setup of the PC system but with the setup of the Arduino system. Since the very next sentence was about how I think it's my mistake, I think some benefit of the doubt would be warranted, at very least.

Arduino pin out:
Programming port: To DEWESoft
0-1: Empty
2-13: Relays
14: Serial3 TX, to DEWEsoft
15: Serial3 RX, to DEWEsoft
16-48: Relays
49: Empty
50-51: Relays
52: Coaxial 0V-5V output

The purpose of the system is to control some relays connected to devices and power supplies, hence their inclusion, but the issue occurs in as simple of a system as:
Programming port: To DEWESoft
14: TX, to DEWEsoft
15: RX, to DEWEsoft
All else: Empty

DEWESoft documentation: https://d36j349d8rqm96.cloudfront.net/6/82/Dewesoft-Serial-Com-Plugin-Manual-EN.pdf
@UKHeliBob yes, the DEWESoft system can interface with RS232 serial messages.

Whatever, interpretation of the words doesn't matter. I can't really utilize your lists. I need a wiring diagram.

Did you check the PC baud rate?

What do you need shown in the diagram that's not shown in the pin out?

The baud rates do match.

But the Mega can't, at least not without some extra hardware

Good to know. In that case, what format does the Mega send serial messages in?

The actual connections. Details of the components, such as pinouts and labels. All the things that make up a standard electronics diagram.

It is not so much the format as the signal levels. The Mega Serial ports outputs TTL (5V) level signals

1 Like

That's a good example. We have no way of knowing how the Arduino is connected to the PC. Not generally how, specifically how.

@csulliva Probably, you need hardware setup similar to Fig-1.

rs232xyzMega
Figure-1:

This seems like the right issue. I'll order a RS-232 to TLL converter and see if that helps. Thanks for the help!

Saved by a diagram! The irony :slight_smile:

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