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?
External clock initialization, but only if was already initialized by "boot1". by itself all components are able to initialize it and they're working correctly. The issue happens only when the clock is initialized by boot2 after boot1 (the jump is reset!).
Hard fault not occur immediately, but when I'm reading memory. Because of some clock instability, it's corrupted.
But:
"boot1" is able to do everything without errors.
"boot2" is able to do everything without errors if boot1 didn't initialize the clock
"appli" is able to do everything if "boot1" didn't initialize the clock.
I read the initialization of the clock of "boot1" (not written by me) and it seems ok.
Only external oscillator enables disable enable sequence was able to make everything work.
Do you have some considerations?
Hi Artem,
By the lockup do you mean the core lockup reset?
If so, have you tried using the HardFault exception handler and find the cause of the exception?
https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447
Regards,
Daniel
Hi, yes I tried. The reason is external clock initialization, but only if was already initialized by "boot1". by itself all components are able to initialize it and they're working correctly. The issue happens only when the clock is initialized by boot2 after boot1 (the jump is reset!).
Hard fault not occur immediately, but when I'm reading memory. Because of some clock instability, it's corrupted.
But:
"boot1" is able to do everything without errors.
"boot2" is able to do everything without errors if boot1 didn't initialize the clock
"appli" is able to do everything if "boot1" didn't initialize the clock.
I read the initialization of the clock of "boot1" (not written by me) and it seems ok.
Only external oscillator enables disable enable sequence was able to make everything work.
Do you have some considerations?