SoftwareSerial issue with custom board (STM32L082)

Hello all,

We created our own PCB with a STM32L082KZ MCU. And added this as a board to platformIO with arduino framework by using STM32L073(Nucleo) files as a template.
Now we have a wierd issue with SoftwareSerial. On a PC with ststm32 platform 6.0.0 SoftwareSerial works but on a pc with the latest version 6.1.0 it doesn’t.

  • I have made the variant files for both versions because they slightly changed in the 6.1.0 version.
  • I updated the ststm32 platform to 6.1.0 on the pc where it worked (6.0.0 version) this also broke it on this PC. So I did a roll back with an backup I had and than it worked again.
  • I tried to use the SoftwareSerial.h and .cpp file of 6.0.0 in the 6.1.0 version but that didn’t solve it either.
  • I also tested HardwareSerial on the same pin’s but that seems to work on both version.

Does anybody have a solution or an idea where the problem may lay?


And what is that “weird issue” exactly?

I do not recieve any data from a GNSS module that is connected to my MCU when using SoftwareSerial.
This only happens in the 6.1.0 version of ststm32 platform.
On a pc with 6.0.0 version of ststm32 platform I do get data.

If you use a custom board definition (and Arduino variant?) there might by problems in there, too. Do you have the complete project so that it’s reproducible?

Sorry I am new with platformIO.

I made all these files locally and copy paste them in the folders:
This are the files in the JENG_STM32L082KZ folder:
Do you mean that I share these files somewhere so you can reproduce the error?

yes correctly.

Here are the files:
STM32L082KZ Files

And what PlatformIO project are you using for testing? (platformio.ini and code)


platform = ststm32
board = JENG_STM32L082KZ
framework = arduino
monitor_speed = 9600
upload_protocol = stlink

Testing Code:

#include <Arduino.h>
#include <SoftwareSerial.h>

void initGPIO();

// Testing GNSS, GNSSerial(RX,TX)
SoftwareSerial GNSSSerial(PB7, PB6);
int incomingByte = 0;
// end GNSS

void setup()
  // initialize pin.

  //Testing GNSS
  //End GNSS setup

  Serial.println("Finished Setup");

void loop()
  Serial.println("Start Loop");
  // put your main code here, to run repeatedly:
  if(GNSSSerial.available() > 0){
    incomingByte =;

    // say what you got:
    Serial.print("I received: ");
    Serial.println(incomingByte, DEC);

void initGPIO()
  // LED PIN
  pinMode(PA12, OUTPUT); //Red Status led

  // Pins that are not used for now should be set as OUTPUT.

  //Pins connected with NB-IoT
  pinMode(PA2, OUTPUT);       //TX LPUART1 To NB-IoT
  pinMode(PA3, OUTPUT);       //RX LPUART1 To NB-IoT
  pinMode(PA4, OUTPUT);       //Interrupt pin From NB-IoT
  pinMode(PA5, OUTPUT);       //Input STATUS pin From NB-IoT
  pinMode(PA7, OUTPUT);       //Connected to PWTKEY pin From NB-IoT. puls High puts NB-IoT on.
  pinMode(PB0, OUTPUT);       //Connected to RTC_EINT pin From NB-IoT. puls High wakes NB-IoT from sleep.


  //Pins connected with GNSS
  pinMode(PB3, OUTPUT);       //Connected to V_BCKP switch of the GNSS. High is off, LOW is on.
  digitalWrite(PB3, LOW);    //HIGH is OFF, LOW is ON
  pinMode(PB5, OUTPUT);       //Connected to V_on switch of the GNSS. High is off, LOW is on.
  digitalWrite(PB5, LOW);    //HIGH is OFF, LOW is ON
  //pinMode(PB6, OUTPUT);       //TX USUART1 To GNSS 
  //pinMode(PB7, OUTPUT);       //RX USUART1 To GNSS
  pinMode(PA15, INPUT);      //Interrupt pin From GNSS. (3D_FIX)

  //Pins connected with Motion Sensor
  pinMode(PA11, OUTPUT);      //Interrupt pin From Motion Sense. (IN_OUT)  
  pinMode(PA9, OUTPUT);       //SCL I2C1 To Motion Sensor
  pinMode(PA10, OUTPUT);      //SDA I2C1 To Motion Sensor

  pinMode(PA0, OUTPUT);       //USART4_TX
  pinMode(PA1, OUTPUT);       //USART4_RX
  pinMode(PA6, OUTPUT);       
  pinMode(PB1, OUTPUT);
  pinMode(PA8, OUTPUT);
  pinMode(PB4, OUTPUT);

On my PCB is also a module connected with I2C. I tried to scan for the adres with the code below. But the there was no I2C device found.
When I scan in STM32Cube IDE for I2C devices I find the module on adress 0x19.

#include <Arduino.h>
#include <Wire.h>
void setup()


  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");

void loop()
  byte error, address;
  int nDevices;


  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    error = Wire.endTransmission();

    if (error == 0)
      Serial.print("I2C device found at address 0x");
      if (address<16) 
      Serial.println("  !");

    else if (error==4) 
      Serial.print("Unknow error at address 0x");
      if (address<16) 
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");

  Serial.println("Waiting 5 second and start the next scan.");
  delay(5000);           // wait 5 seconds for next scan


Maybe this is connected to why SoftwareSerial does not work for me. Maybe I missed some files that I have to change or some settings.