Programming NXP LPC54114 without on-board Link2

02 Oct 2018

Dear all,

First, i hope i am in the correct section of the forum, and i apologize if that's not the case.

For a project, i am developing using MBED for a NXP LPC54114 MCU. I am able to download MBED-based binaries on the LPCXpresso 54114 evaluation board (after updating the firmware of the on-board Link2 probe based on the LPC43xx).

However, my code will finally be deployed on a custom board that includes the LPC54114 but not the LPC43xx. So, i have tried downloading some code on the target without using the Link2 probe, but i didn't succeed.

More specifically, I am trying to download a simple "blinky LED" example following these steps:

1. I reset my board while holding switch ISP0 to boot in "USB Mass Storage" mode.

2. Doing that, the "CRP_DISABLD" volume is automatically mounted on my system, and contains a "firmware.bin" file.

3. I delete the old firmware.bin and copy the new binary generated by MBED CLI on the volume (after renaming it to "firmware.bin" as well).

4. I unplug/safely disconnect/reset the board (i tried all three ways) and restart it.

However, the downloading clearly fails as the board restarts in "USB Mass Storage" mode again.

Notice that, following exactly the same method, i am able to download a similar blink LED example compiled within the original "LPCXpresso IDE" library, without using MBED.

So, the problem is definitely related to the compilation performed by MBED CLI. However, i don't know what i should change in my compilation options (mbed_app.json, targets.json, etc.) to make it work. Do you have any suggestion?

Thanks in advance.

Daniele

03 Oct 2018

Nevermind, i solved the problem myself.

For future memory, the reason is the following. When downloading code using ISP mode, the bootloader checks the validity of the loaded image by computing the checksum of the first 7 vector table entries, and comparing it with the 8-th entry, as specified in the User Manual: https://www.nxp.com/docs/en/user-guide/UM10914.pdf

However, MBED's linker scripts leaves the 8-th entry fixed at all zeros, as you can see in the startup file: https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC54114/device/TARGET_LPC54114_M4/TOOLCHAIN_GCC_ARM/startup_LPC54114_cm4.S

When code is downloaded through the on-board debugger, the latter adds the checksum, so that's why MBED code was working in that case.

Currently, i solved the problem using the "checksum" binary utility, provided by NXP within the MCUXpresso suite, which can add the required checksum to a pre-compiled ".bin" file, as explained in this guide: https://community.nxp.com/thread/389046

Specifically, the command i used is the following: checksum -p LPC54114 -d firmware.bin;

After doing that, ISP mode works perfectly.

I am surprised that the checksum is not directly added during MBED compilation (through the linker script). Anyway, i'm glad the problem was solved.