I’m trying to use the USBSerial class on a nucleo F446re board using platformio.
I tried with the example on the HandBook manual, the simplest possible:
// clang-format off
#include <mbed.h>
#include <USBSerial.h>
// clang-format on
// Virtual serial port over USB
int main(void) {
USBSerial serial;
while (1) {
serial.printf("I am a virtual serial port\r\n");
ThisThread::sleep_for(1000);
}
}
There are two problems here: the first is that when I compile if USBSerial is included before mbed it does not compile…
The second is that this example is giving a fatal error (function mbed_die) as soon as it constructs the USBSerial object.