Page 1 of 4

can USB be used to create a virtual com port?

Posted: Fri Sep 10, 2021 7:33 am
by STM32_Newbbe
Hi,

Some controllers come with onboard USB functionality.
Can this interface be used to create a com port similar to the VCP that is available through the onboard ST-Link?

Re: can USB be used to create a virtual com port?

Posted: Thu Sep 16, 2021 8:52 am
by STM32_Newbbe
If this is too dumb a question, could someone please point me in the right direction to find an answer myself?

Thanks

Re: can USB be used to create a virtual com port?

Posted: Thu Sep 16, 2021 9:15 am
by ag123
You may like to order one of those boards, like the stm32f405 feather board from Adafruit
https://learn.adafruit.com/adafruit-stm ... -ide-setup
https://learn.adafruit.com/adafruit-stm ... er-details
or one of those stm32f401 blackpills
https://www.aliexpress.com/wholesale?ca ... =stm32f401
Those have USB default on the connector. They use USB Serial (i.e. VCP)
That is normally USB CDC Serial on the selection menu in Arduino IDE
it is the same with 'blue pills' stm32f103, but for 'newbies', starting with stm32f4xx would have an easier life.
If you get a stm32f103 e.g. blue pills, u'd need in addition that st-link dongle or a usb-uart dongle in addition to program it.
There are more from others, e.g. Olimex
https://www.olimex.com/Products/ARM/ST/
https://www.olimex.com/Products/Duino/S ... e-hardware

Re: can USB be used to create a virtual com port?

Posted: Thu Sep 16, 2021 9:36 am
by STM32_Newbbe
ok, did I get this right that I "just" have to configure USB CDC in the Arduino IDE and then I can get VCP support?

that would be pretty straight forward :)

Re: can USB be used to create a virtual com port?

Posted: Thu Sep 16, 2021 12:44 pm
by fpiSTM
STM32_Newbbe wrote: Thu Sep 16, 2021 9:36 am ok, did I get this right that I "just" have to configure USB CDC in the Arduino IDE and then I can get VCP support?

that would be pretty straight forward :)
yes

Re: can USB be used to create a virtual com port?

Posted: Thu Sep 16, 2021 12:51 pm
by STM32_Newbbe
so easy

thanks to everyone who helped making stm32duino possible :)

Re: can USB be used to create a virtual com port?

Posted: Wed Nov 30, 2022 3:00 pm
by STM32_Newbbe
I have to come back to this...

default HW Serial is LPUART1 on some STM32Lxxx Nucleos

when I enable CDC Serial supersedes U(S)ART, I get Serial output from generic Serial on the USB VCP
When I try to output something over LPUART1 using SerialLP1.print(), I get no output
trying to define Hardwareserial Serial.LP1 throws an multiple defintion error

Can I not use USB Serial and LPUART1 at the same time?

Re: can USB be used to create a virtual com port?

Posted: Wed Nov 30, 2022 4:49 pm
by fpiSTM
Which one?

Re: can USB be used to create a virtual com port?

Posted: Thu Dec 01, 2022 5:46 am
by STM32_Newbbe
which board?
Nucleo-L4R5ZI

which error?
c:/sloeber/arduinoplugin/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\xXxXxXxXx\Test_L4R5\Release/arduino.ar(HardwareSerial.cpp.o):(.bss.SerialLP1+0x0): multiple definition of `SerialLP1'; .\Test_L4R5.cpp.o:(.bss.SerialLP1+0x0): first defined here

Re: can USB be used to create a virtual com port?

Posted: Thu Dec 01, 2022 5:52 am
by fpiSTM
SerialLP1 is created by default. So this is normal you get this error as it is defined twice.