Long boot delay

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Long boot delay

Post 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 ?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Long boot delay

Post 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
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Long boot delay

Post 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;
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Long boot delay

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Long boot delay

Post by Giovanni »

Good point, that is a setting that must be consistent across the 2 applications.

Giovanni
Post Reply