I’m trying to use an ESP32 as a Wi-Fi bridge for PX4 to send MAVLink telemetry data to QGroundControl. The ESP32 is configured as a TCP server, connected to the flight controller via UART (currently using GPIO 4 for RX and GPIO 5 for TX), and acting as a transparent bridge. Here’s the setup:
- ESP32 connects successfully to the Wi-Fi access point.
- QGroundControl detects the ESP32 and establishes a connection, but the connection frequently drops with “remote host closed connection” errors.
- MAVLink packets (detected as
0xFE
or0xFD
) are being forwarded between the UART and TCP, but I’m experiencing over 60% packet loss in QGroundControl.
Debugging Steps I’ve Taken:
- Pin Reconfiguration:
- Tried alternative pins (e.g., GPIO 16/17) for UART RX/TX.
- Wi-Fi Stability:
- Conducted continuous
ping
tests with 0% packet loss but observed higher-than-expected latency (~100ms).
- MAVLink Stream Rates:
- Reduced rates to minimize data load (e.g., 5 Hz for position, 10 Hz for attitude).
- TCP Connection Debugging:
- Verified that the ESP32 accepts connections and forwards data, but disconnections persist.
- Direct Flight Controller Test:
- Verified MAVLink data output using a USB-to-serial adapter, confirming telemetry is sent.
Observations:
- MAVLink heartbeats are detected, but data transmission isn’t stable.
- QGroundControl often displays “Waiting for connection” even though the ESP32 is responding.
Question:
What could be causing the high packet loss and frequent TCP disconnections? Should I optimize the ESP32’s buffer sizes, change UART pins, or investigate a potential Wi-Fi bottleneck? Any advice or alternative configurations for reliable MAVLink bridging would be greatly appreciated!