The current version of the GPS Logger Shield was designed quite some time ago now. Remember when the Arduino UNO was pretty much the only game in town? Well, as a result, it has some design features that are somewhat specific to the UNO and the boards of that era.
One of the more critical features is the switch that changes between "Soft. Serial" and "Direct". In order to better understand what it takes to use hardware serial, let's look at that switch in more detail.
Soft Serial
When the switch is in this position, the GPS TX/RX pins are routed like this:
- GPS TX -> D8
- GPS RX -> D7
As well as the TX and RX pins on the auxiliary header row.
As long as your board can support software serial on those pins, then you're good to go.
Direct Connect
When the switch is in this position, the GPS TX/RX pins are routed like this:
- GPS TX -> D1
- GPX RX -> D0
While these two pins generally end up being where a board's hardware serial port shows up, the pins end up being backwards. The original idea with "Direct" was to allow direct connection between your host PC and the GPS unit. That meant routing the GPS's TX/RX to the USB-to-serial bridge's RX/TX, not the MCU's (ATmega 328, etc.) RX/TX.
Hardware Serial
OK, so how can you connect the GPS shield to a board's hardware serial pins? Well, it takes a bit of bodging, but can be done as follows. This is the same trick as described previously for the Leonardo, but here is provided in a more general way.
The trick is to set the switch to the "Soft. Serial" position. Then, add jumper wires from the auxiliary header row's TX/RX to pins 1/0 as follows:
- GPS TX -> D0
- GPS RX -> D1
Note how that ends up being the opposite of the "Direct" routing from above.
Metro M0/M4 Example
The Metro M0 and M4 are good examples of boards where this trick can be used. Both the M0 and M4 MCU's have native USB support. That means there are dedicated pins that the host PC's USB can be directly connected to. No need for a USB-to-serial bridge solution, like the UNO uses. As a result, the hardware serial port provided on D0/D1 is completely separate.
Below we show the GPS Shield on top of a Metro M4 Express. The switch is set to "Soft.Serial" and the green/white wires are connected as described above.
And then we can run the Hardware Serial Parsing example from the GPS Library. Here is what the serial monitor output looks like:
Page last edited March 08, 2024
Text editor powered by tinymce.