I have written a program to stream data through USB port CN13, using this video. I am not able to see the data on the USB Virtual COM Port. When I connect the ST-LINK and Virtual COM port, there is only one USB Device, ST-LINK, getting recognized when trying dmesg | grep usb
. I have seen many basic examples on YouTube which shows the Virtual COM USB Port detection happens without installing any drivers. STM32 MOOCs uses Windows but I have Ubuntu 20.04 installed. I have tried some of the stack overflow solutions. Could anyone guide me as to how to overcome this issue?
Asked
Active
Viewed 3,693 times
1

Sourabh Misal
- 23
- 1
- 7
-
The virtual serial connection should appear as `/dev/ttyACM0` (or similar). Is such a device present? In order to see the serial output, you need to use a terminal program. What kind of program do you use and can it connect to the `/dev/tty...` device? – Codo Jan 09 '21 at 22:11
-
Yes, I get /dev/ttyACM0 , which corresponds to ST-LINK, when checked via dmesg...but not to Virtual COM Port... – Sourabh Misal Jan 09 '21 at 22:18
-
What do you mean by "but not to Virtual COM Port"? /dev/ttyACM0 is virtual serial port (or COM port in Windows terms). And again: what terminal program do you use or plan to use? – Codo Jan 09 '21 at 22:21
-
There are two USB ports in Nucleo-144 F767ZI board, one is for flashing the program which is detected as ST-LINK and other is for communication, which is CN13 pin , which is supposed to be detected as Virtual COM Port in my ubuntu. I am using the default terminal to see the USB devices and to read the data serially, I am planning to use the application CoolTerm – Sourabh Misal Jan 09 '21 at 22:39
-
I am writing a simple program to send hello world string when I switch on the stm32 and try to read data from the USB port... I followed the example link mentioned above, but I am not able to see the data stream... – Sourabh Misal Jan 09 '21 at 22:48
-
Now I understand. You have written custom code for creating a "virtual COM port" in addition to the port provided by the ST-Link. I guess the problem is in your code. So add it to your question. – Codo Jan 09 '21 at 23:32
1 Answers
1
I have found a way to use the USB port for communication. This is done using STM32CubeIDE
- Launch STMCubeIDE software.
- Select the USB_OTG_FS and set as device only mode.
- Then in middleware tab select the Class for FS IP as Communication device class(virtual com port).
- Set the clock frequency for USB as 48MHz.
- Generate the project.
- Read the usbd_cdc_if.c file
- Include the usbd_cdc_if.h in the main and send some data using
CDC_Transmit_FS
- In Ubuntu, open a terminal and search for two ACM ports using
ls /dev/tty
, ACM0 and ACM1/ACM2 (which are STLINK-V3 and Virtual ComPort) - Test using serial terminal (like Serial Monitor of Arduino IDE).

Sourabh Misal
- 23
- 1
- 7