KBOOT ROM never executes application, bootloops

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

KBOOT ROM never executes application, bootloops

跳至解决方案
1,243 次查看
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 解答
981 次查看
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

在原帖中查看解决方案

3 回复数
981 次查看
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 项奖励
回复
982 次查看
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

981 次查看
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 项奖励
回复