cancel
Showing results for 
Search instead for 
Did you mean: 

USB virtual COM port does not work when debugging

PSzab.1
Associate II

Hello,

 

I am trying to debug my vcp application (uses STM32F103CBT6), but when I start a debug session the COM port does not work. When not debugging, just uploading a new code, the cdc communication only works after a power reset. I modified my custom board: added transistors to the DP pull up resistor to be able to disconnect it from 3v3 with code, but it does work, it won't reenumerate the device.

When debugging, CDC_Control_FS() never get called.

the function looks like this: 

PSzab1_0-1716736470675.png

I tried everything i can foud on the internet, but nothing worked.

I have also read this: https://community.st.com/t5/stm32-mcus-products/usb-cdc-dont-work-in-debug/m-p/464797

The USB variables when the communication is not working:

PSzab1_1-1716737814331.png

PSzab1_2-1716737848410.png

PSzab1_3-1716737879365.png

and the registers:

PSzab1_4-1716738030697.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Muhammed Güler
Senior III

I have used USB with the following method before.
By directly connecting the dp pull up resistor to an IO,
When the device is reset, set the dp pull up resistor to 0.
I set the output to 1 just before the USB setup function.
here is part of my schematic

MuhammedGler_0-1716740443424.png

 

View solution in original post

5 REPLIES 5
Muhammed Güler
Senior III

I have used USB with the following method before.
By directly connecting the dp pull up resistor to an IO,
When the device is reset, set the dp pull up resistor to 0.
I set the output to 1 just before the USB setup function.
here is part of my schematic

MuhammedGler_0-1716740443424.png

 

Debugging and real-time operation are generally not compatible. Watch out also peripheral views, and invasive effects on related registers and FIFOs

Perhaps find other ways to diagnose what's happening with your code. Instrumentation to understand dynamic flow and interactions can be helpful to pin-point what behaviour and sequences are problematic.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you! This worked. I did not think of this.

BTW first I tried what ST uses in their schematic:

PSzab1_0-1716744111562.png

but this did not work at all.

Then I built what I thought will work:

PSzab1_1-1716744178241.png

and this is working in normal case, but not in debug case.

 

 

Hi @PSzab.1 

Would you please tell me where you found the implementation? 

 

FBL_1-1716802839404.png

I'm suspecting a mismatch with the current implementation on F103 eval board.

FBL_0-1716802816585.png

 

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.

Oookay. I won't trust this much the internet next time. I just searched for stm32 f103 schematic.