cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB-CDC to create a virtual comport

Ratul99
Associate

Hello Everyone

So I'm using a custom made STM32 board having STM32F103C8T6 MCU and after debugging the board using ST Link V2 when I try view the output through USB on my pc using the virtual COM Port and it is not working. As well as I have tried to view the output on the debugger console but it is showing temporary breakpoint for HAL_Init() . If their is any other way to view the output I would love to try and also the drivers I have install from STM32 website are for Win 7,8 versions and when I am connecting my board to my PC and opened the device manager to check the COM Port, in their under Universal Serial BUS Controller it is showing as a Unknown Device with a yellow caution sign. Do i need to have the latest drivers to view the output on Serial Wire mode?? and where can I find the latest driver for Win 11. I have attached the Pin configuration of my board and the code I am using below such that it can help you to understand the problem I am going through. Please guide me through the issue such that I can solve this problem. Also if possible please guide me through how to view the output such as simple Hello World print using the UART or any other possible way to see the output.Pin Config.pngCode1.pngcode2.pngcode3.png

Thank you for your support.

Best Regards

Ratul

 

1 REPLY 1

This got confused with your other thread about using the UART:

https://community.st.com/t5/stm32-mcus-products/unable-to-view-output-from-stm32-board-via-serial-port/td-p/790510

 

USB is much more complex that a UART - so you really should complete getting the UART working first.

This also makes it a much stronger recommendation that you start on a genuine ST Dev Board - rather than unknown custom hardware.

 

Some points from the other thread:

Please re-post the code using the </> button.

Tell us what debugging you've done.

Does your project

  1. Successfully build - no errors; no warnings ?
  2. Successfully download to your board ?

Have you done Basic USB connectivity tests:

  • Are you sure it's a good USB cable - does it work with other devices?
  • Are you sure it's a data cable - not just a charging cable?
  • Does the PC see anything at all when you plug in? Does it give any beeps, error messages, etc?
  • Are you sure all connections are good?
  • It looks like you're intending for your STM32 to be powered from USB - is it actually getting power?

 

On implementing USB within an STM32:

Application Note AN4879Introduction to USB hardware and PCB guidelines using STM32 MCUs:

https://www.st.com/resource/en/application_note/an4879-introduction-to-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf

 

Also AN2586Getting started with STM32F10xxx hardware development:

https://www.st.com/resource/en/application_note/an2586-getting-started-with-stm32f10xxx-hardware-development-stmicroelectronics.pdf

ST Wiki - Introduction to USB with STM32

MOOC - STM32 USB Training

 via: https://community.st.com/t5/stm32-mcus/how-to-use-stmicroelectronics-classic-usb-device-middleware-with/ta-p/599274