Page 1 of 1

Long boot delay

Posted: Fri Apr 28, 2017 12:53 pm
by Tabulous
Hi
in my application i've got a bootloader and application code, this is on F4 device.

Bootloader lives in the first 48K, the application above that.
Everything works ok, at reset the bootloader jumps to the application and the application runs fine.
Both bootloader and application code are using chibios.

One issue i do have through is when the bootloader jumps to the application there is a long delay in the application starting, long as in 5-6 seconds.

I believe this is happening in the application startup code i.e. stm32_clock_init() or maybe hal/sysinit().

Trying to debug it is difficult as once the jump is done you dont have any debug info for the application and thus cant step through.


Just wondering what thoughts are on this problem ?

Re: Long boot delay

Posted: Fri Apr 28, 2017 1:11 pm
by Giovanni
I would make sure to reset PLLs and dividers to their post-reset state before jumping, the clock initialization code is not designed to switch things from a state to another, just from reset to final settings.

I think you should:
1) Switch to IRC.
2) Shut down PLLs.

Giovanni

Re: Long boot delay

Posted: Fri Apr 28, 2017 3:46 pm
by Tabulous
mmm i was kind of thinking that, but i already switch the clock back to HSI

Code: Select all

                 /* Enable HSI clock */
                 RCC->CR |= RCC_CR_HSION;

                 /* Wait for HSI is ready */
                 while (!(RCC->CR & RCC_CR_HSIRDY));

                 /* Select HSI clock as main clock */
                 RCC->CFGR &= ~( RCC_CFGR_SW );
                 RCC->CFGR |= RCC_CFGR_SW_HSI;

                 /* Disable PLL clock */
                 RCC->CR &= ~RCC_CR_PLLON;

Re: Long boot delay

Posted: Fri Apr 28, 2017 4:39 pm
by Tabulous
Just for others, the issue was down to RTC clock source.

Bootloader it was LSI
Application it was LSE

Thus the it loop for a look period in hal_lld_backup_domain_init

Code: Select all

  while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
    ;                                       /* Waits until LSE is stable.   */


Just change the bootloader to LSE and all is good.

Re: Long boot delay

Posted: Fri Apr 28, 2017 7:46 pm
by Giovanni
Good point, that is a setting that must be consistent across the 2 applications.

Giovanni