Jump to ROM bootloader from application in MKL03

cancel
Showing results for 
Search instead for 
Did you mean: 

Jump to ROM bootloader from application in MKL03

302 Views
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

Labels (1)
0 Kudos
2 Replies

222 Views
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 Kudos

222 Views
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 Kudos