cancel
Showing results for 
Search instead for 
Did you mean: 

WHAT COULD CAUSE THE CODE TO RUN ONLY AFTER RESET BUTTON IS PRESSED? STM32F401RE

BrokenICry
Associate

I am faced with an interesting problem. The code I have seems to run only after I press the reset button. If I somehow remove power, and put it back, it will not run until the reset button is pressed. HAS ANYONE ever had this problem ?

All my power rails are fine, NRST is pulled high and Boot0 is pulled Low.

I set the peripherals with CubeMX, I am using STMCubeIDE and my device is STM32F401RE.

I saw someone on Stack overflow was having the same issue while using KEIL, link below, and he solved by changing a few things in the IDE. HOW CAN I DO THE SAME with CubeIDE??

Link to Same problem from Stack overflow: https://stackoverflow.com/questions/43036256/stm32f4-program-will-only-run-after-pressing-reset-button

3 REPLIES 3

Code probably is running. Most likely in an unhelpful while(1) loop. Need to report status/function early within Reset_Handler(), and instrument Error_Handler() and HardFault_Handler() to be able to output some actionable data. Use GPIO or UART to check-point various places the code gets to as it starts.

Problem of not starting most frequently BOOT0 floating, but you seem to have addressed that.

Other would be expectation that clocks or other hardware starts as quickly as the MCU when power first applies/ramps.

If you have multiple supplies, you'd want an effective POR circuit to ensure everything is ready prior to starting.

Sorry not using CubeMX or CubeIDE here, you'll have to debug your situation to understand what is actually happening.

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

> NRST is pulled high

Maybe with unnecessary external pull-up resistor, but without a necessary capacitor? If yes, then read AN4488.

sarvesh
Associate

WhatsApp Image 2023-11-15 at 12.19.42.jpeg

 I am using stlinkv2 just check the jumper position it will solve the issue