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
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.
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.
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
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.