stm32stm32f7

Read data from USB Virtual COM in STM32 Nucleo-F767ZI [Ubuntu]


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?


Solution

  • I have found a way to use the USB port for communication. This is done using STM32CubeIDE

    1. Launch STMCubeIDE software.
    2. Select the USB_OTG_FS and set as device only mode.
    3. Then in middleware tab select the Class for FS IP as Communication device class(virtual com port).
    4. Set the clock frequency for USB as 48MHz.
    5. Generate the project.
    6. Read the usbd_cdc_if.c file
    7. Include the usbd_cdc_if.h in the main and send some data using CDC_Transmit_FS
    8. 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)
    9. Test using serial terminal (like Serial Monitor of Arduino IDE).