cancel
Showing results for 
Search instead for 
Did you mean: 

Code won't run after power cycling when debugger isn't connected

SHelg.1
Associate II

The code runs perfectly fine, and as expected when I don't have a USB connected, given that I push the Reset button (B2) on my Nucleo-F746ZG.

The problem is that when I remove power from the system, and re-power it, it seems to not reset. 
I have jumnpers connected to both pairs of pins in CN4 (though removing them didnt help)
I also have the jumper at JP3 to EV5.
The power supply seems stable enough (attached a picture called Oscillioscope_power_supply.png)
I tried adding a tantalum capacitor (6.8uF, 16Vmax) to the circuit to reduce the ripples, though it didnt work.

JP4,JP5,JP6, and JP7 have jumpers attached.
After power cycling LD4 is blinking slowly with red, indicating that it is waiting for a USB connection (?)
I launched using RUN, console log is in console_log.txt, the logfile STMCubeIDE recorded is also attached as  com_controller.build.log

Parameter settings for RCC: 

SHelg1_1-1687980089884.png


I have tried adding NVIC_SystemReset(); to the hard fault handler in stmf7xx_it.c. 

Stating again at the end here, the system works perfectly once I press the Reset button, but the system is intended to be placed somewhere where the only way I have to interact with it is to turn the power off and on again (STM is to be placed inside watertight acrylic container, where power can be turned off and on using a reed relay and a magnet, the magnet is about 40cm away from the STM, and does not seem to impact the STM).

Any tips for how I can go forward?



 





1 ACCEPTED SOLUTION

Accepted Solutions
ONadr.1
Senior III

For Nucleo boards, the MCO from the debugger is used as the clock source for main MCu. Try to configure the MCu for an internal oscillator or place a crystal and auxiliary capacitors to the MCu and select the External Crystal as the clock source. The problem can also be a slow start of the clock and then the program jumps into some error routine, that also needs to be treated.

View solution in original post

3 REPLIES 3
TDK
Guru

You need to determine where the processor is at when it is "not working". It is most likely in some initialization code or stuck somewhere due to faulty logic. You can determine where the code is at be attaching a debugger after the fact and connecting to the chip without resetting it. You could also instrument the code such that it blinks an LED at certain positions in the code or otherwise outputs data which indicates where it is at.

LD4 blinking RED is expected behavior when a USB connection is not present. It does not indicate that the code is not running, rather it indicates that a USB connection hasn't been established.

If you feel a post has answered your question, please click "Accept as Solution".

The MCU stops halting the moment I attach a USB cable. But I'll try to add some blinking here and there to see if I can diagnose it without a USB attached

ONadr.1
Senior III

For Nucleo boards, the MCO from the debugger is used as the clock source for main MCu. Try to configure the MCu for an internal oscillator or place a crystal and auxiliary capacitors to the MCu and select the External Crystal as the clock source. The problem can also be a slow start of the clock and then the program jumps into some error routine, that also needs to be treated.