STM32 Nucelo L432KC to GPS Output Not Displaying Data

I am trying to hook up my STM32 Nucleo L432KC([NUCLEO-L432KC | Mbed] to my GPS GP-808G ([GPS Mouse - GP-808G Hookup Guide - SparkFun Learn].
This example has something for Arduino which I tested on my Arduino device successfully. I have tried doing this on PlatformIO with my Nucleo board, and I did get output for a second but thats it. I tried many configurations for hours and hours, but I cannot get it to receive a reliable output flow of data. I tried the TinyGPS++ Library but at this point I just want to receive basic output only and that is not working. I have wired up the RX to pin DO and TX to D1 in my nucleo board. Here is the code I am trying to run:

#include <Arduino.h>

#define ss Serial2  // Use hardware Serial2 (PA10 RX, PA9 TX)

void setup() {
    Serial.begin(115200);  
    ss.begin(9600);        

    Serial.println("✅ Serial2 GPS Debugging Test - Waiting for data...");
}

void loop() {
    if (ss.available()) {
        char c = ss.read();
        Serial.write(c);  // Print GPS data to Serial Monitor
    }
}

here is my INI file:

[env:nucleo_l432kc]
platform = ststm32
board = nucleo_l432kc
framework = arduino
upload_protocol = stlink
monitor_port = COM2
monitor_flags = --raw
monitor_speed = 115200
lib_deps = 
    Wire
    mikalhart/TinyGPSPlus@^1.1.0
build_flags = 
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_HWSERIAL2

I have images of my schematic and devices below:



Any help would be appreciated!

1 Like

No. That’s the same serial object. You’re making the same mistake as in

You can see that you cannot independently use Serial and Serial2 becauase Serial is a macro for exactly Serial2. Just hover your mouse over the code.

Just change your platformio.ini to

[env:nucleo_l432kc]
platform = ststm32
board = nucleo_l432kc
framework = arduino
monitor_speed = 115200
build_flags = 
  -D ENABLE_HWSERIAL1
  -D PIN_SERIAL1_TX=PA9
  -D PIN_SERIAL1_RX=PA10

and your code to

#include <Arduino.h>

#define ss Serial1  // Use hardware Serial1 (PA10 RX, PA9 TX)

void setup() {
    Serial.begin(115200);  
    ss.begin(9600);        
    Serial.println("✅ Serial1 GPS Debugging Test - Waiting for data...");
}

void loop() {
    while (ss.available()) {
        char c = ss.read();
        Serial.write(c);  // Print GPS data to Serial Monitor
    }
}

Do you really have connected the wires as you showed in your hand sketch?
Serial connection via RX/TX have to be connected via RX → TX and TX → RX
https://learn.sparkfun.com/tutorials/serial-communication/wiring-and-hardware