KBOOT ROM never executes application, bootloops

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KBOOT ROM never executes application, bootloops

Jump to solution
883 Views
xxxajk
Contributor III

As the title says, just reenters ROM after timeout.

MKE16F512VLH16

K1.5.1 ROM

BCA:

0x3c0: 6b 63 66 67 ff ff ff ff ff ff ff ff ff ff ff ff
0x3d0: ff ff e8 03 ff ff ff ff ff ff ff ff ff ff ff ff
0x3e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0x3f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Flash configuration field:

0x400: ff ff ff ff ff ff ff ff ff ff ff ff de fb ff ff

                                            ^^

                                           ||

                                      boot from rom

If I disable ROM and only enable with BOOT0 pin, the application runs as expected.

Two quesions to help resolve the issue:

Is there something the ROM configs that is causing a fault in my start up code? I can post my start up code if required.

Does Zeroing RAM at start up of app cause the fault?

1 Solution
621 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Andrew

Actually, your application is executing after timeout, the problem is that the WDOG interrupt is happening and you get into the ROM bootloader again.

There is a Errata in this chip about the WDOG, please check the following link: https://www.nxp.com/docs/en/errata/Kinetis_E_0N79P.pdf 


So, when you boot from the ROM bootloader and then jump to the application, you need a delay before you continuing your program execution. I added a little delay in the Reset Handler, so now my application can run without problems.

void ResetISR(void) {
     unsigned int i=100;
         while(i--){}
    // Disable interrupts
    __asm volatile ("cpsid i");
#if defined (__USE_CMSIS)
// If __USE_CMSIS defined, then call CMSIS SystemInit code
    SystemInit();
...

Inside the SystemInit you will find the WDOG disable.

Hope this could help you,

Best Regards

Jorge Alcala

View solution in original post

3 Replies
621 Views
xxxajk
Contributor III

Flash configuration field:

0x400: ff ff ff ff ff ff ff ff ff ff ff ff de fb ff ff

                                               ^^

                                              ||

                                         boot from rom

Was off-by one. Anyway....

0 Kudos
622 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Andrew

Actually, your application is executing after timeout, the problem is that the WDOG interrupt is happening and you get into the ROM bootloader again.

There is a Errata in this chip about the WDOG, please check the following link: https://www.nxp.com/docs/en/errata/Kinetis_E_0N79P.pdf 


So, when you boot from the ROM bootloader and then jump to the application, you need a delay before you continuing your program execution. I added a little delay in the Reset Handler, so now my application can run without problems.

void ResetISR(void) {
     unsigned int i=100;
         while(i--){}
    // Disable interrupts
    __asm volatile ("cpsid i");
#if defined (__USE_CMSIS)
// If __USE_CMSIS defined, then call CMSIS SystemInit code
    SystemInit();
...

Inside the SystemInit you will find the WDOG disable.

Hope this could help you,

Best Regards

Jorge Alcala

621 Views
xxxajk
Contributor III

Thanks so much!

I'll have the MCU do other set up during this time, if possible, instead of the simple loop.

Also FWIW I'm not using any tools from NXP/Freescale or anyone else, but I now get the gist of what needs to be done.

0 Kudos