Troubleshooting Two GPS Units on one Mega board

Hi all,

I am working on a university project and am having trouble getting my Arduino Mega to work with two VPN1513 GPS units. The units are plugged in to Serial ports 1 and 2. I have checked and they each work independently, outputting appropriate latitude and longitude. However, when I made a program attempting to use both GPS units on the same board, one of the units does not read properly. What I mean is that one unit will output proper GPS coordinates but the other spits out zeros most of the time or occasionally a number in the thousands. If I change the order that the GPS's are encoded and read, then the other GPS will work but the first one will not. I would like to be able to use both GPS units to provide a heading for the vehicle.

The code is attached below
Thanks for your help!

dualGPSplus_ino.ino (3.29 KB)

What is your GPS Module ? Are they use SPI Sorry, looked your code. How do you connect them?

One is connected into the Serial 1 port and the other into the Serial 2 port. The RX from each GPS is connected into the TX from each board and vice versa. For power I used the 5V output.

Thanks for the help.

Could the problem be here:

while (Serial1.available()) {
unsigned char cc1 = Serial3.read(); //read from gps
unsigned char cc2 = Serial1.read(); //read from gps2

You check to see that data is available on Serial 1, and then read Serial 1 and Serial 3 - but there is no check that data is available on Serial 3.