Skip to main content
Explorer
November 3, 2025
Question

Cannot see output from USB

  • November 3, 2025
  • 2 replies
  • 219 views

Hello, 

 

I have an STM32L4R5 MCU on a custom PCB and I have flashed it with my firmware via USB_OTG_FS. Both CubeProgrammer and the CubeIDE have worked in flashing the MCU for me, given I have an ST-LINK connected to it as well. I have USB_DM, VBUS_Sense, and USB_DP pins set up on my MCU. I am wondering how I can see some sort of output from my MCU. From my searching, I learned the DFU mode is only used for flashing and something like USB CDC is used for communication, through a serial port or UART. I am wondering some ways (preferably efficient and quick) I can go about seeing an output from my MCU that is running my firmware. If there needs to be any more clarification as to my wiring/setup, I will gladly add that. Can USB CDC be setup via firmware, or is it solely a hardware configuration? I do not have pins like UART/LPUART TX/RX connected on my MCU, however, they are able to be jumped of course. I have been using a NUCLEO development board to test my code. When connecting my MCU to CubeProgrammer via USB, I am not able to interact with things like SWV or the debugger which I have heard are able to show some sort of log details when the firmware is running. However, I am able to access SWV and Debug via the ST-LINK connection. I am completely new to this sphere and am learning alot.

Any advice or tips will help, 

Thank you.

    This topic has been closed for replies.

    2 replies

    Graduate
    November 3, 2025

    For simple USB communication, you need to implement USB device, CDC ACM class (VCP - virtual com port).  The skeleton code may be generated by CubeMX/CubeIDE. Just search for tutorials on ST website on how to do this - there are few of them. The VCP does not have to use a physical UART - it is simply a USB communication channel which may, on the host PC side, be seen as COM port.

    Technical Moderator
    November 3, 2025

    Hi @ym21 

    Indeed as @gbm mentioned, you should implement CDC application and here is HID application on this STM32L4R5 to start with.

     

    ym21Author
    Explorer
    November 3, 2025

    @FBL @gbm 

    Thank you for the resources.
    For the github repositories, I am not exactly sure how to navigate them, could you provide some sort of insight/guidance? Do I just import the files into my project? Do I copy those files and make a new project with them? I already have firmware that I have written, I just need to integrate USB CDC.

    I have an ST-LINK connected to my PCB via SWD and that is able to be recognized as a COM Port. My USB D Cable that I have on my PCB is able to be recognized as an STM32 Bootloader in the device manager.