So you've likely coded your solution incorrectly. Either missing clocks, gpio settings, AF mux configuration, etc. It would be easier to diagnose if the salient code sections where pasted/provided.
Watch also for potential conflicts with pins the ST-LINK/V2-1 uses for the VCP
Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..