cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 startup/boot problem

glory_man
Associate II
Posted on September 07, 2016 at 10:36

My software project has 2 parts:

- bootloader located at 0x08000000;

- application located at 0x08008000.

After reset bootloader is started and check CAN network - if there is activity it can reload application. Also I use NVIC_SystemReset() function to switch from bootloader to applicatyion, and from application to bootloder.

In Application, if I want to load new program used function:

void EnterProgramMode( void )

{

  __disable_irq();

  *(uint32_t*)CheckAddress = 0xAAAAAAAA;

  __asm volatile (''nop'');

  NVIC_SystemReset();

}

In bootloder, if I want start application:

void StartApplication(void)

{

  __disable_irq();

  *(unsigned long*)CheckAddress = 0;

  __asm volatile (''nop'');

  NVIC_SystemReset();

}

So after system reset bootloder can check CheckAddress value and decide what it need to do: run application (if it has 0xAAAAAAAA) or load program (if 0).

But I have a problem in bootloder.

While debugging if I set breakpoint at any line of StartApplication-function - all fine. After  CPU resets and stopes at breakpoint in Reset_Handler function. But if I remove (or diable) breakpoint in StartApplication-function - reset occured but program goes to 0x1FFF0000 area. It seems like after startup ''Boot from system memory'' mode were selected.

But Boot1-pin connected to GND, Boot0-pin pulled-down over 10k resistor, XP6 jumper removed (see attached picture). I tried to check Boot0-pin with oscilloscope and it is 0 every time.

0690X00000605JmQAI.png

If I stop programm execution while in system memory and check SYSCFG_MEMRMP it contains 0, i.e. 00: Main Flash memory mapped at 0x0000 0000.

I don't understand why this is happening. 

Can anybody help me?  Perhaps someone faced with such behavior.
1 REPLY 1
Posted on September 07, 2016 at 15:16

I'm not keen on bonding pins to the supplies, would use pull up/down resistors.

I'd check that the boot0 and BOOT0 nets actually connect.

I'd check the code in ResetHandler on forwards.

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