cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F415ZG user bootloader does not start without debugger

hkamba
Associate II
Posted on March 14, 2014 at 10:16

Hi everyone,

I have develpped a bootloader firmware for the STM32F415ZG microprocessor board. I developed it with Keil uVision 4.23 IDE and used Keil ULINK2 debugger.

When I have the ULINK2 connected to the board SW port I can start a debugg session then press the ''Run'' button in the IDE to start running the code. The bootloader firmware does exactly what I want it too.

However when I remove the ULINK2 and restart the board it seems the application is not starting. The application seems to be starting only when I use the ULINK2 and the IDE ''Run'' button.

Any idea why this is happening and how to resolve it will be very much appreciated.

#stm32-debbug-application-keil
4 REPLIES 4
Posted on March 14, 2014 at 12:15

Debuggers are invasive, they set up a number of features and settings within the processor in order to function. Absent a debugger it is suggested you provide some diagnostics via a serial port or GPIO(s)

Most probably reason for failure would be that peripheral clocks are not being enabled in your code that the debugger was setting up, basically assumptions about initial conditions. Or there are some timing dependencies that get skewed by the debugger breaking in, or it's simply crashing or stuck in a loop somewhere.

Would suggest you use an effective Hard Fault handler that can output diagnostic information. That you add some stand-alone code at several check-point locations, including the ResetHander (in assembler) to indicate via a GPIO/LED, or USART, the arrival a key points of your code. You need to ascertaining if any of you code (or code paths) are functioning, and just how far it gets. Then use bisection to focus on the specific code causing problems.

If it's not executing any of your code (and you can control the first instructions that get executed), then you need to examine the flash image, and what's being written to memory. And for basic things like the state of the BOOTx pins, and NRST
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
Posted on March 14, 2014 at 12:30

Hi

''However when I remove the ULINK2 and restart the board it seems the application is not starting. The application seems to be starting only when I use the ULINK2 and the IDE ''Run'' button.''

Really basic question :

Is the application located in RAM?

Nickname306_O
Senior
Posted on March 17, 2014 at 17:14

Hi Kamba ,

Make sure that your code is correctly linked in Flash.

Best Regards,

Nouha

hkamba
Associate II
Posted on April 25, 2014 at 11:53

Problem solved.

I wrongly assumed that there was an external crystal (LSE) on the board to be used for the RTC. 

When I had the ULINK on it was defaulting to the internal crystal (LSI) in the RTC intialisation and was running the rest of the code. Without the debugger the processor kept resetting itself as I was waiting for the LSE to be ready (with a while loop) and had the independent watchdog enabled prior to initialising the RTC. Hence the code was running but the MCU kept resetting itself because of the IWDG.

Many thanks for your help.