Arm Mbed OS support forum

USBSerial issues on STM32WB55 Nucleo

Hi all.

I’ve been getting up on MbedOS 6 on my STM32WB55 development board. I am trying to get USBSerial working on the USB_USER connector but am having some issues.

The default constructor for USBSerial blocks forever, no matter if the cable is plugged in at boot or plugged in after boot.

I have tried using the non blocking parameter in the constructor, i.e :

#include "mbed.h"
#include "USBSerial.h"

USBSerial serial(false);

int main(void) 
{
wait(10.0);
serial.init();
wait(5.0);
serial.connect();

    while(1)
     {
        serial.printf("I am a virtual serial port\r\n");
        wait(1.0);
    }
}

This makes the board show up in Windows as another COM port, which is what I expected, but the printf calls from the board are not picked up in Windows. Curiously, serial.scanf(…) returns immediately in mbed.

Not sure if I am doing something wrong, or if I misunderstanding the capabilities of the board.

Any help appreciated.

Thanks.

Hello,

do you have, in your terminal program, the DTR signal on? It is necessary for the USBSerial API.

BR, Jan

Oh interesting, I had overlooked that flag.

I am running my own terminal app which is written in .net, using SerialPort for comms. Looking at the docs, DTR is predictably false by default.

Setting that to true make it work with my terminal app. Thanks for the heads up.

I’ve not had much luck sending data the other way yet.