Our application has two bootloaders and an actual application.
When the jump to boot is required from the application following things occur:
- The first boot configures the clock with an external oscillator and pll and jumps to the second one.
- Then second boot reconfigures the clock with an external oscillator and pll.
- After some instruction after clock configuration, a LOCKUP error occurs.
If the first bootloader does not configure the clock nothing happens (application starts normally).
So to solve this problem we tried to disable and reenable the external oscillator and the pll and this works.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SCG->SPLLCSR = SCG_SPLLCSR_SPLLEN(0); /* disable PLL */
SCG->SPLLCFG |= 1U ; /* use FIRC for PLL */
SCG->SOSCCSR = SCG_SOSCCSR_SOSCEN(0) ; /* disable OSC */
while((SCG->SOSCCSR & SCG_SOSCCSR_SOSCVLD_MASK)) /* Wait for sys OSC clk not valid */
{
}
SCG->SOSCCSR = SCG_SOSCCSR_SOSCEN(1) ; /* enable OSC */
while(!(SCG->SOSCCSR & SCG_SOSCCSR_SOSCVLD_MASK))/*;*/ /* Wait for sys OSC clk valid */
{
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
But we need to know is this correct, or some hidden problem is still there?
Could you help me with this issue?