can USB be used to create a virtual com port?

Post here first, or if you can't find a relevant section!
STM32_Newbbe
Posts: 50
Joined: Thu Nov 05, 2020 10:26 am

can USB be used to create a virtual com port?

Post 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?
STM32_Newbbe
Posts: 50
Joined: Thu Nov 05, 2020 10:26 am

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

Post 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
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

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

Post 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
STM32_Newbbe
Posts: 50
Joined: Thu Nov 05, 2020 10:26 am

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

Post 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 :)
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

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

Post 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
STM32_Newbbe
Posts: 50
Joined: Thu Nov 05, 2020 10:26 am

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

Post by STM32_Newbbe »

so easy

thanks to everyone who helped making stm32duino possible :)
STM32_Newbbe
Posts: 50
Joined: Thu Nov 05, 2020 10:26 am

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

Post 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?
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

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

Post by fpiSTM »

Which one?
STM32_Newbbe
Posts: 50
Joined: Thu Nov 05, 2020 10:26 am

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

Post 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
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

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

Post by fpiSTM »

SerialLP1 is created by default. So this is normal you get this error as it is defined twice.
Post Reply

Return to “General discussion”