cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot see output from USB

ym21
Associate II

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.

3 REPLIES 3
gbm
Principal

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.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
FBL
ST Employee

Hi @ym21 

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

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


ym21
Associate II

@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.