Code working when compiled with Arduino IDE doesn't when compiled with Platformio

I’m using a Grove Air530 GPS module. When I upload this code using the Arduino IDE it works correctly.
Code:

#include <SoftwareSerial.h>

SoftwareSerial ss;

void setup()

{

  ss.begin(9600, SWSERIAL_8N1, 23, 22, false, 256);

  Serial.begin(9600);

}

void loop()

{

if (ss.available()) {

while (ss.available()) {

  Serial.write((uint8_t)ss.read());

}

}

}

And I get the correct output:

$GNGGA,220005.000,0,N,0,E,1,10,2.2,24.1,M,42.3,M,78
$GNGLL,0,N,0,E,220005.000,A,A
4E
$GNGSA,A,3,13,14,17,19,30,3.3,2.2,2.5,13C
$GNGSA,A,3,10,19,27,30,46,3.3,2.2,2.5,4
3E
$GPGSV,3,1,12,05,12,203,10,09,328,12,15,218,13,62,139,18,06A
$GPGSV,3,2,12,14,34,052,26,15,73,251,19,17,33,092,20,19,26,126,24,0
68
$GPGSV,3,3,12,23,25,301,24,41,286,28,31,30,10,086,24,05F
$BDGSV,2,1,05,10,28,051,13,19,24,181,14,27,16,072,25,30,12,122,19,0
75
$BDGSV,2,2,05,46,36,064,25,043
$GNRMC,220005.000,A,0,N,0,E,3.19,276.28,070822,A,V
0E
$GNVTG,276.28,T,M,3.19,N,5.91,K,A2C
$GNZDA,220005.000,07,08,2022,00,00
40
$GPTXT,01,01,01,ANTENNA OK*35

If I upload the same code using Platformio (Adding the Arduino.h library) the serial output becomes like this:

$GNGS3,⸮b⸮⸮b⸮⸮b⸮⸮b⸮⸮bb,3.1,2.1,2.3,1⸮&H9M,3,10,19,27,30,46,<⸮,<3.⸮r⸮,2.3,⸮*
$GPG_V,3,1,1⸮,05,10,202,10,10,32?,⸮12,16,219<,13⸮b⸮⸮⸮b⸮⸮b⸮R⸮⸮
$GPGSV⸮b⸮b12,14⸮32,051,28,15,b⸮⸮⸮bb⸮⸮b⸮⸮b⸮ʂ~⸮b⸮9,28,12⸮,0%⸮
$⸮Y,3,⸮,12,>3,2⸮⸮bb⸮b⸮⸮b⸮ºb~⸮⸮bb,31,30,09,087⸮b⸮51⸮
$B⸮e⸮b⸮b⸮⸮b⸮⸮b⸮⸮~⸮⸮⸮b⸮⸮b⸮⸮b⸮⸮b⸮Šb⸮⸮Ⓔb⸮⸮b⸮⸮⸮b⸮⸮b⸮⸮b⸮⸮b⸮⸮⸮b⸮⸮b⸮r⸮⸮
$BDGSVb⸮b⸮⸮b⸮⸮,35,0⸮4⸮⸮R⸮⸮
⸮G
220350.000,A,4<50.⸮⸮⸮⸮b0⸮045.7⸮⸮50.00<281.<6,070822,⸮V
02
$GE⸮r⸮⸮b<M,r⸮⸮b0>00,K,A:2A
$GNZDA,220350.00b⸮⸮b⸮⸮b⸮⸮⸮⸮b⸮⸮b⸮⸮R⸮
$GP⸮⸮⸮⸮b⸮⸮b⸮⸮bANTENNA O{35
$GNG⸮A,220351.000,4450.8?164,N,01045.?0957,},1⸮b⸮.1,?1.8,M,42.3,M,

I’ve tried everything I could think and google gave me nothing so now I’m here.

  1. What’s the Arduino-ESP32 version shown in the Arduino IDE → Boards → Board manager → esp32?
  2. Screenshot of the Arduino IDE → Tools menu for configuration?
  3. Your platformio.ini?
  1. Arduino-ESP32 version = 1.0.6
  2. (I’m sorry the language is set to Italian but I think all the important stuff is still in English)
    image
  3. (It won’t let me put two images so I’ll paste it here)

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
lib_deps =
plerup/EspSoftwareSerial@^6.16.1

Then you must use

platform = espressif32@3.5.0

per releases if you want PlatformIO to also use 1.0.6 instead of

otherwise it will use the the latest 2.0.4 core.

You can also double check that your sketch breaks as soon as you update the ESP32 core in the Arduino IDE to 2.0.4 through the board manager.

1 Like

brilliant, thank you! It works flawlessly now

A broken software serial when using the latest Arduino core is not good regardless. If you can reproduce the fault in the Arduino-IDE on the latest 2.0.4 core, please open an issue at Issues · espressif/arduino-esp32 · GitHub. Only if the developers know about this, this can be fixed for the future, instead of downgrading.

ok I will as soon as possible