pont-uart.ino
The GD32 has three UARTs and the core exposes them as Serial/Serial2/Serial3. This bidirectional bridge configures a module (AT commands) or debugs a GPS without desoldering anything.
Hardware required
A GD32F103C8T6 development board (Cortex-M3 at 108 MHz, Blue Pill pin-to-pin compatible), powered at 3.3 V/5 V, with an ST-Link or serial adapter. 1 3.3 V USB-serial adapter (for the first port) + 1 TTL module at 9600 baud.
Wiring
Adapter on PA9/PA10 (cross TX/RX, common grounds, 3.3 V only). Module on PA2/PA3. The board itself gets USB power via ST-Link or external 3.3 V.
How it works
Two FIFO buffers on the core; the whiles ensure everything drains each pass. The 115200/9600 asymmetric rate is the real-world case (fast console, slow module). With Arduino: install the « STM32F1 » core (Roger Clark, board manager) and pick the « GD32F103C » board; the user LED is PC13 (active LOW). In C: GD32F10x firmware library + ST-Link.
Going further
Filter lines (keep only $GPRMC), or turn the bridge into a serial protocol translator.
pont-uart.ino
// Pont Serial (USB-Serie sur PA9/PA10) <-> Serial2 (PA2/PA3).
// Utile pour brancher un module GPS/GSM/Bluetooth 3,3 V.
void setup() {
Serial.begin(115200); // PA9 TX / PA10 RX : adaptateur USB-UART
Serial2.begin(9600); // PA2 TX / PA3 RX : le module
Serial.println("Pont actif : tapez, ca rebondit");
}
void loop() {
while (Serial.available()) // PC -> module
Serial2.write(Serial.read());
while (Serial2.available()) // module -> PC
Serial.write(Serial2.read());
}