cancel
Showing results for 
Search instead for 
Did you mean: 

What diagnostics can be run on PC and STM32 to debug failing USB virtual COM port?

KHarb.1
Senior II

I have an STM32G4 board that is to function as a virtual COM port via USB.  This is my first attempt at implementing USB. Within CubeIDE, I enabled the USB feature and configured a middleware device for the virtual COM port. I’m not seeing the PC react in any way when I connect the board. I’m not sure where to begin to debug and I don't see any examples for the STM32G, so I'm also not sure if I've completed all the needed steps for it show up as a PC device.

Can I observe connection progress with the PC via the USB registers? 

If I had an electrical failure on the USB connection, what diagnostics could I run in software from the PC?

17 REPLIES 17
bm2
Associate III

yes, but I have only one time use it and than I by me the USB protocol analyser

I've been using Cube and not MX. I didn't even know MX had an example library. Thanks!

CubeMX is the standalone product. It's integrated as a plugin into CubeIDE. Whenever you create an ioc or configure peripherals using the embedded GUI, you're actually using CubeMX.

 

From CubeIDE, examples are availabe via File/Import/STM32 example (or similar). You will need to install the firmware package for the particular family the example targets.

- If a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.
bm2
Associate III

Sorry KHarb.1,

I will go back to one of the first questions. Which board did you have? For the STM32G473 exists only one ST evualation board: Discovery kit with STM32G473 . And this board have only one USB connector, that is the ST-Link USB connector. You need a board with a USB connector to the target STM32G473.

Can you post the link to your evualation board please?

The ST-Link have also a USB VCOM connection, but this is wired via U(S)ART to the target itself.

Have a nice night, Bernd

I have a custom board with a USBC port attached to the appropriate pins. Since its a custom board, I'm looking for ways to diagnose potential electrical failures, since there's a possibility I've done something wrong in routing, pull ups, pull downs...etc.

Pavel A.
Evangelist III

If you doubt the electric level - get a real physical USB analyzer or even a scope.


@KHarb.1 wrote:

 there's a possibility I've done something wrong in routing, pull ups, pull downs...etc.


Then you might want to post the schematic here.

- If a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.
bm2
Associate III

OK, than you dosn't found an excample for this MCU. You must configure it via CubeMX and than use it. You can post the IOC file from CubeMX and your shematic. When you not will that all can read it here, than send it per PM to me and I can show if the USB correct configured. normaly it is verry simple.

The best way for you ist first check the enumeration of the USB device. It is started and it is finished. The device have the state connect. After this you can check the next steps for using of USB devices.

How can you find it? Simple way is under MSWindow, loog into the device manager. If the device allredy available or not. Or you can also use a PC tool for the view of connected devices.

The best way ist, to use a protocol analyser and you see what for packages are trensmit and recive. And so you can on which step is the communication broken.

You can also analyse the status information in the USB device stack, see usbd_def.h device and EP states, or you make a hardware trace and show which functions are called during the enumeration.

For the signal level is it not so easy to use a scope. You need for this a scope which can decode the USB frames and you can lock for the levels. My MSO58 have it, but it is not so easy to find a problem in the software. With this I can find out problems in the hardware. Normaly the USB lines are direct connected over a simple protection IC (over/under voltage, EMC/EMV) to the MCU pins. You need only one resistor for the coding of the USB speed. Some devices need the information of the VBUS connection, but I dosn't know did you need it or not.