AnsweredAssumed Answered

Stuck in __pe_initialize_hardware after booting with custom bootloader

Question asked by Mikhail Burakov on Nov 25, 2013
Latest reply on Nov 26, 2013 by Mikhail Burakov

Hello community!

 

I prepared a custom bootloader prototype for my project, and it works fine. But i've stumbled upon a problem in initialization code of a flashed MQX system. It appears i can't get out of the following waiting loop in __pe_initialize_hardware function (generated cpu.c in bsp code):

  /* Switch to PEE Mode */
  /* MCG_C1: CLKS=0,FRDIV=3,IREFS=0,IRCLKEN=0,IREFSTEN=0 */
  MCG_C1 = (MCG_C1_CLKS(0x00) | MCG_C1_FRDIV(0x03));                                  
  while((MCG_S & 0x0CU) != 0x0CU) {    /* Wait until output of the PLL is selected */
  }

 

It seems to be waiting infinitely. But when i break the code execution (or make there a breakpoint, it does not matter), MCG_S appears to be in a required state. After this I hit continue and everything works as expected. Can someone shed a light on this behavior and maybe point me to some documentation, or give advice on any additional actions i must perform in my bootloader to avoid this situation?

Outcomes