Monitoring two serial instances within serial monitor

Hello all, I am unsure if this is a stupid question or the way I am going about this problem is done but here is what I have done. I am establishing communication via serial with a GNSS card, the tx line is to send a command and the rx line is to read what the command outputs are from the GNSS card. However, when I attempt to see what the return is when using serial.println() it is sending the output back into the GNSS card causing it to be confused and freak out. My idea to solve this problem was to create a second serial instance that was designated purely to read data to the serial monitor so that I am not transmitting the output back to the GNSS receiver.

My two main questions are:

  1. Is there a more viable solution to see what the return data is on my rx line rather than creating a second serial instance.
  2. How do I specify with serial instance the serial monitor is observing (is it possible to monitor both)

Your problem seems to be that you use the RX/TX pins of an Uno/Mega/Nano/ProMni. Those pins are also used for the communication with the PC.

For the Mega, move your GNSS to one of the other available serial ports and adjust your code.
For the other three above, you can use SoftwareSerial to create a software serial port on different pins. Connect the GNSS to those pins and adjust the code.
There are other boards that have a serial port that is independent of the communication with the PV (Leonardo, Micro, most newer Arduinos).

To monitor the GNSS directly, you can connect it through a serial-to-usb adapter to the PC; that will give you another port on the PC.

2 Likes

How you can establish a second serial connection using hardware-serial or software-serial depends on what microcontroller you use.

Some of them have a second (third) serial hardware-interface some have only a single serial hardware-interface

the microcontrollers with only a single serial hardware UART can use software-serial. What the maxium baudrate is again depends on your type of microcontroller

So posting your exact type of microcontroller and post a link to the datasheet of your GNSS (whatever this abbreviation means)

That or any of the other processors that gives you an additional serial port. Software serial works but cannot send and receive at the same time like a hardware serial port can. Software serial also has problems at several baud rates must have control to receive/send characters. If my memory is working properly the Mega has a 32 byte receive buffer so you can miss a few when it is sending data.

I did mention some of the other boards :slight_smile:

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