2021-12-26 11:24 PM
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.
2021-12-27 05:58 AM
And Module_RST() is called?
Try to single-step through the program in debugger and find out where does it "stuck".
JW
2021-12-27 08:41 AM
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?
2021-12-28 07:38 PM
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.
Simon
2021-12-28 07:46 PM
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
2021-12-29 03:41 AM
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