Sphere
Log in Join
☆ 3

esp32 uart gives garbled output at 115200

ESP32 connected to a GPS module (NEO-6M) over UART2 at 9600 baud, and separately USB serial at 115200 for debugging. The GPS output on the Serial2 monitor is garbled - random symbols instead of NMEA sentences. I'm sure the wiring is right (TX to RX, RX to TX, common ground). The USB debug serial is fine at 115200. Could the NEO-6M be set to a different baud than 9600? I thought GPS modules default to 9600. Is there a way to auto-detect the baud rate? Also do I need level shifting between ESP32 (3.3V) and the GPS?

⚑ Report

4 replies

☆ 0
F ferret ·2026-11-08#1

Garbled UART is almost always a baud mismatch or a missing common ground - you said ground is connected, so baud. NEO-6M defaults to 9600 but some modules ship configured differently. You can detect baud by trying common rates (4800, 9600, 19200, 38400) and checking for valid '$GP' NMEA sentences. The NEO-6M is 3.3V TTL so no level shifter needed. Double-check you're reading Serial2 and not Serial (USB).

⚑ Report
☆ 0
R rust72 ·2026-11-10#2

I'll write a loop to try bauds and look for '$GP'. One thing - I set Serial2.begin(9600, SERIAL_8N1, 16, 17) but I'm not 100% sure which pin is RX. My wiring: GPS TX to GPIO16, GPS RX to GPIO17. Is that the right order in begin()? Could I have RX/TX swapped in software?

⚑ Report
☆ 0
M moss ·2026-11-12#3

begin(baud, config, rxPin, txPin) - so rx=16, tx=17 in your call, and GPS TX->16 is correct if that's how you wired it. That matches. But verify the NEO-6M breakout: some have the TX/RX silkscreen referring to the module's pins, so TX on the breakout is an input (you connect MCU TX there). If you connected MCU RX to the breakout's 'TX' label thinking it was output, that's backwards. Try swapping 16/17 in begin() and see.

⚑ Report
☆ 0
F fern ·2026-11-14#4

It was the baud - the module was set to 38400 from a previous project (I bought it used). Auto-detect loop found 38400 and NMEA sentences came out clean. The pin order was right. For GPS modules, never assume 9600 - write the detect loop once and reuse it. Garbled serial = baud mismatch 90% of the time; pin swapping is the other 10%.

⚑ Report
Log in to reply.