Serial Monitor showing error on loop: "uart: UART Driver already installed"


I set up a Freematics ONE+ B based on the ESP32 Dev Module.
Once I go to see the Serial Terminal, it prints this message on loop.
No clue what to do.

Well the error message is thrown in ESP-IDF

which appears when uart_driver_install() detects that p_uart_obj[uart_num] already has a driver object in it (is not NULL).

This function is called by Arduino-ESP32 in the uartBegin function (source) which is then called in the HardwareSerial::begin() method.

I suspect there is something out of control with the .begin() of Serial objects happening multiple times or there’s a memory corruption going on. Hard to say without the full code.

Also, having the file test.cpp just in the root of the project and no in src/ will not make it be compiled. Only sources in src/ are compiled (unless build_src_filter trickery is going on in the platformio.ini)

Okay, looks like I found which function gives me the error:
When using the library Freematics/libraries/FreematicsPlus at master · stanleyhuangyc/Freematics · GitHub
And calling sys.begin() in loop until it returns true, in order to then pass the sys.link as a parameter to the obd.begin(), that’s the function that gives the error.
Any clue on what should i do? I’m using the same code used in the official sketches of the library (Since it’s the official one for the Freematics One+ B), but I have no clue on why this error would pop up.

Can you post the shortest sketch that errors in PlatformIO but works in the Arduino IDE?

You do have Arduino-ESP32 2.0.5 installed in the Arduino IDE too?

My bad, I might have explained myself uncorrectly.
I first thought the error was sent by PlatformIO’s Serial Monitor Terminal, but it’s actually the function in the library itself.
Arduino IDE doesn’t even import the library correctly as far as what I see.
In the repository of the library, under firmware_v5, there are some example sketches, like simple_obd_test (that’s a pretty short code).
They are official sketches, but they give the same exact error caused by that sys.begin() being called on loop.
I don’t know how that can be possible, maybe it’s the library itself, but I find crazy that something official like that gives these kinds of errors.

It’s definitely nothing new though:

Thanks, at least I know it’s something that occurred in the past. Still no fix whatsoever though