cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F072 can't work if doesn't connect the USB

Simon.Lee
Associate II

Hi advanced

I have a question to ask everyone. I use STM32F072 and use VCP to communicate with the GUI on the PC side.

But it is very strange. If STM32F072 is not connected to USB, it will not work. It seems to be stuck and did not continue to execute the relevant instructions.

But I hope it can work independently without connecting to USB. Don't know if anyone has similar experience?

The establishment of VCP is the initialization generated by STM32cubeMX.

0693W00000HppUbQAJ.png0693W00000HppUDQAZ.png

5 REPLIES 5

And Module_RST() is called?

Try to single-step through the program in debugger and find out where does it "stuck".

JW

Then you'll need to walk the source to understand what it is blocking on. If it is trying to establish a USB connection, and can't, it is perhaps not unreasonable for boiler-plate code to stop or wait for expectations to be met.

You show code unrelated to where it is actually stuck, look at that.

Aren't PA11/PA12 involved in the USB connection? How do these relate to the Winbond W25Q256 in your design?

What board? Where is USB/VCP coming from?

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

Hi JW:

I had tried a single step to run the code, and I found it will jump into the HardFault_Handler. 

I also try to find information on the Internet. Normally, it suggests adding the heap size. But it still does not solve my problem.

I'm don't have much experience with this application.

Would you please provide me some suggestions or point out where I did wrong?

Much thanks.

0693W00000Hq1QqQAJ.png 

Simon

Hi Tesla:

Sorry for causing your misunderstanding. I forgot to remove the related comment.

In practice, it is directly connected to the PC. Did not through the other IC to connect.

I had tried to single-step to track the code, I found it will jump into the HardFault_Handler(). 

I'm also trying to add the heap size, which I reference from the web side suggestion, but it still not working.

Would you please give me some suggestions or point out where I make some mistakes?

Much thanks,

Simon

Debug HardFault as usually - from the stacked PC value, in disasm (preferrably mixed with C source) walk back until you find the instruction which caused the problem, track it back to the respective C line.

Or do it the other way - single-step in the program until it goes into the hardfault.

JW