Jump to ROM bootloader from application in MKL03

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

Jump to ROM bootloader from application in MKL03

797 次查看
danicampora
Contributor I

Hello,

I have a system which has several MKL03 MCUs connected by a master MPU via I2C interface. I also need to reprogram the MKL03s via I2C using the ROM bootloader. I can do this just fine when the ML03 is blank, but I'm having issues re-entering the ROM bootloader from the application. At this moment the master sends an I2C message to the MKL03 to request going into bootloader mode. The MKL03 does it by running the following:

        // jump to bootloader

        // Variables

        uint32_t runBootloaderAddress;

        void (*runBootloader)(void * arg);

        // Read the function address from the ROM API tree.

        runBootloaderAddress = **(uint32_t **)(0x1c00001c);

        runBootloader = (void (*)(void * arg))runBootloaderAddress;

        // Start the bootloader.

        runBootloader(NULL);

However it doesn't work. The application stops running, but I cannot communicate with the ROM bootloader. I'm not doing anything with the BCA but my understanding is that if the BCA is invalid, it should enable all interfaces, in the same way as it did when the flash was blank. Is this correct? What am I missing?

Any help is greatly appreciated.

Cheers,

Daniel

标签 (1)
0 项奖励
2 回复数

717 次查看
wangyilong
Contributor III

Hi,Daniel

I used the same code with KL43, and it works ok.

I think you can follow these steps:

1, confirm the pins, bootloader uses the default pins.
2, confirm the bootloader is running in some way. I check it with UART and the bootloader responses to ping.
3, confirm you used the correct IIC address

B.R.

Yilong

0 项奖励

717 次查看
danicampora
Contributor I

Hi Yilong, thanks! I got a similar advice from NXP support and I already got my problem solved by using a minimal hello world project. Apparently something else was wrong with the rest of my code, but the snippet to jump from application to bootloader works fine.

0 项奖励