GPS firmware is easy to get almost right. The parser handles the sentences from the module on your desk, the tracker reports a position, and the demo works. Then the device spends a week in a truck. It loses the fix in a tunnel, comes back with a jump in position, crosses midnight UTC, and the cases nobody tested turn into support tickets.
None of that happens on a CI bench. The bench is indoors, so a real module never gets a fix, and even outdoors you can't make it drive at 90 km/h or lose the sky for 40 seconds on demand.
So the BenchPod becomes the GPS module. It prints NMEA sentences on a real wire into the DUT's UART, and your test decides what they say.
A GPS module is just a UART
To the firmware, most GPS modules are a UART that prints text. Once a second, at 9600 baud, the module sends a burst of NMEA 0183 sentences: RMC (position, speed, date), GGA (fix quality, satellites, altitude), GSA, GSV, VTG and GLL. The firmware parses them, checks the checksums and decides whether it has a fix.
The pod does the same with gps_nmea, a UART sensor from the public sensor library: one LA channel wired to the DUT's RX, the sentences a common module sends out of the box, the same baud and the same one-second rhythm. It sends them from a second UART, so the DUT's console keeps working on the first one. Your test can talk to the firmware and feed it GPS data at the same time.
The examples below use a tracker firmware with a simple text console. Swap in your own commands and log lines:
import time
from embeddedci.benchpod import BenchPod, INTERNAL
with BenchPod("192.168.1.213", la_voltage=3.3) as bp:
gps = bp.sensors.start("gps_nmea", pins={"tx": 9}, values={
"lat_deg": 50.8466, "lon_deg": 4.3528, "alt_m": 56, "sats": 9, "hdop": 0.9})
with bp.open_uart(rx=5, tx=6) as console:
bp.power_on(INTERNAL)
console.expect("GPS fix=1", timeout=10)
console.write("pos\n")
console.expect("lat=50.846", timeout=2)pins={"tx": 9} is the channel the DUT's RX is on (here LA9), and values is the starting fix. From then on the pod prints a fresh fix every second until the test stops it. gps.params lists every value you can set, with its unit and range.
A fix that moves
A fixed position tests the parser. A tracker needs to see movement. Give the receiver a speed and a course, and the pod moves the position between fixes, like a vehicle driving in a straight line:
gps.set(speed_kmh=90, course_deg=45) # northeast on the highway
time.sleep(10)
console.write("trip\n")
console.expect(r"distance_m=2[45]\d", timeout=2) # 90 km/h for 10 s = 250 mThat one assertion checks the parser, the distance math and how the firmware handles a position that changes every second. Change the course and you have a turn. Move the position in one step with gps.set(lat_deg=..., lon_deg=...) and you have the jump a receiver can make after a cold start, which a good tracker should filter out instead of logging a 300 km trip.
Geofences, both ways
Geofence logic is the classic case of code that ships with half its branches untested. With an emulated receiver, crossing the fence takes two lines:
gps.set(lat_deg=50.8466, lon_deg=4.3528, speed_kmh=0) # inside the depot
console.expect("ZONE inside=depot", timeout=3)
gps.set(lat_deg=50.9000) # 6 km north
console.expect("EVT geofence exit=depot", timeout=3)Go back the other way and assert the enter event. Park right on the boundary and check that the hysteresis keeps it from toggling. It's all deterministic, so it runs on every commit.
Losing the sky
fix=0 turns the receiver into one that has lost its lock. The sentences keep coming, like they do from a real module, but with empty position fields (RMC status V, GGA quality 0). That's exactly what the firmware sees in a tunnel:
gps.set(fix=0, sats=0) # into the tunnel
console.expect("EVT gps_lost", timeout=5)
time.sleep(40)
gps.set(fix=1, sats=7) # back out
console.expect("EVT gps_restored", timeout=5)Does the firmware keep the last good position or report zeros? Does it pause the trip counter, or count the gap as a jump? Does its "no fix" timeout fire on time? Each of those is now one test. A weak fix is one line too: sats=3, hdop=8.5 is a fix the firmware probably shouldn't trust for a geofence decision.
A whole drive as a file
Calling set() from the test works for single events. A longer trip reads better as a stimulus: values over time in a small YAML file, with faults at chosen moments. The library ships one, gps_drive: parked, north to 50 km/h, a turn east, 90 km/h, a tunnel with sentences dropped on the way in, then a stop:
bp.sensors.load_stimulus("gps_drive")
bp.sensors.start_stimulus()
console.expect("EVT gps_lost", timeout=70)
console.expect("EVT gps_restored", timeout=20)Write your own route the same way, or copy that one with bp.sensors.library().text("gps_drive") and change the numbers.
Time is part of the fix
Plenty of devices set their clock from GPS, so the UTC in RMC is an input worth testing on its own. utc_start sets the time of the first fix (seconds since 1970), and the clock runs from there:
gps = bp.sensors.start("gps_nmea", pins={"tx": 9}, values={
"lat_deg": 50.8466, "lon_deg": 4.3528, "utc_start": 1798761595}) # 2026-12-31 23:59:55 UTC
time.sleep(8)
console.write("clock\n")
console.expect("date=2027-01-01", timeout=2)Midnight, month ends, leap years and year ends are all one value away. Those are the bugs that otherwise show up once a year, in the field.
Not every module sends the same thing
Some modules are set up to send only RMC and GGA. Some run at 5 or 10 Hz, some at 115200 baud. The receiver takes all of that, so you can check that the firmware doesn't depend on a sentence its production module never sends:
gps = bp.sensors.start("gps_nmea", pins={"tx": 9}, baud=115200,
values={"rate_hz": 10, "sentences": 1 | 4}) # RMC + GGAIf a combination can't fit on the wire (ten full fixes a second at 9600 baud, say), gps.status()["bus"]["overruns"] counts the fixes that went out late.
Bad modules and bad wires are faults: gps.fault("drop", value=0.2) drops one fix in five, gps.fault("garbage", duration_s=1) sends noise for a second, and gps.fault("baud_error", value=3) runs the UART 3% off its baud rate. Does the parser resync, and does it reject a sentence with a bad checksum?
Add an accelerometer
A tracker rarely relies on GPS alone. It sleeps until an accelerometer reports movement, flags a crash from a spike in g, or notices it's upside down. The pod can emulate the I2C sensor too, at the same time, on two other channels:
bp.enable_pullup(1, 2)
imu = bp.sensors.start("mpu6050", pins={"sda": 1, "scl": 2}, values={"accel_z_g": 1.0}) # lying still
imu.set(accel_x_g=0.3) # the truck starts moving
console.expect("EVT motion", timeout=2)
gps.set(speed_kmh=30, course_deg=180) # and the fix follows
imu.set(accel_x_g=-4.0) # hard braking
console.expect("EVT harsh_brake", timeout=2)Now one test tells the whole story: the device wakes on motion, picks up a moving fix, flags a hard brake and keeps the trip consistent. Doing that for real means driving a vehicle, and you can't rerun the drive on every commit.
If your tracker uses a module that speaks something other than NMEA, or an accelerometer that isn't in the library, write its definition yourself: a sensor is a YAML file with its params, its registers or messages, and the formulas between them. The format reference has the details.
What it does and doesn't cover
The pod emulates the module's serial output, not the satellite signals. That covers your firmware's parsing, state machines, timing and logic over real wires, which is where most GPS bugs live. It doesn't test the antenna, the RF front end or the module's own acquisition; for that you need an RF simulator, at a very different price.
The emulated sensors need firmware 3.10.3 or later and SDK 2.13.10 or later. The same calls are in the MCP server (sensor_start, sensor_set, sensor_fault, sensor_status), so an agent can drive a tracker through a scenario too, and the web app's Sensors tab plays gps_nmea by hand. The full reference is in the pytest framework docs.