Example of blinking LED on LPCXpresso54608 board (OM13092)

LPC-LINK2 Debug Probe Firmware update required with MBED firmware to enable the mbed flash disk interface (board is seen as MSD mass storage device) so drag and drop programming is possible

tested on Windows 7

Based on

https://os.mbed.com/platforms/LPCXpresso54608/

and

https://os.mbed.com/teams/NXP/wiki/Updating-LPCXpresso-firmware

you need to update your LPCXpresso (programmer/debugger) to the latest firmware to enable the mbed flash disk interface.

Note that for LPCXpresso54114 and LPCXpresso546xx boards there is a 2-step programming process (first bootloader needs to be installed, then binary for LPC546xx board).

Detailed guide as follows:

1. Go to LPCScrypt webpage and download its latest version (needs admin rights)

2. Go to DOCUMENTATION section of above link and select “LPC-Link2 Debug Probe Firmware Programming”

3. Configure the selected board to DFU Boot, then connect to the host computer via USB

  • In case of: OM13092/LPCXpresso54806
    • check jumper JP5 “DFU LINK” (needs to be installed) – to download firmware from IDE

4. Download Link2 (LPC432x) Bootloader binary (Use this Bootloader first for boards that require a 2-step update)

  • https://os.mbed.com/media/uploads/mmahadevan/lpc4322_bl_crc.bin
  • Save to directory of LPCScrypt
    • C:\nxp\LPCScrypt_2.0.0_831\probe_firmware\LPCXpressoV2
    • LPCXpressoV2 folder has been chosen because I was able to find an info that debug probe LPC432x is being programmed with LPC432x_IAP_CMSIS_DAP_V5_183.bin file (and this file is in LPCXpressoV2 folder)
      • to confirm that please go to Start -> start typing LPC -> choose “Program LPC-Link2 with CMSIS-DAP”

5. Make a copy of program_CMSIS.cmd file in C:\nxp\LPCScrypt_2.0.0_831\scripts and call it program_CMSIS_mbed_daplink.cmd

  • Open with Notepad++ program_CMSIS_mbed_daplink.cmd file
  • edit:

before
set Link2ImageWild=LPC432x_IAP_CMSIS_DAP_*.bin

after
set Link2ImageWild=lpc4322_bl_*.bin
  • or comment (by adding REM)

before
set Link2ImageWild=LPC432x_IAP_CMSIS_DAP_*.bin

after
REM set Link2ImageWild=LPC432x_IAP_CMSIS_DAP_*.bin
    set Link2ImageWild=lpc4322_bl_*.bin

6. Go to Start -> cmd

  • go to directory

cd C:\nxp\LPCScrypt_2.0.0_831\scripts
  • type command
    • program_CMSIS_mbed_daplink
    • because of changes in program_CMSIS_mbed_daplink.cmd, now file downloaded from MBED called lpc4322_bl_crc.bin is executed
    • Ctrl+C to quit

7. Disconnect the board

8. Remove the jumper JP5 “DFU LINK”

9. Connect again the board

  • In that step board should be seen as MAINTANANCE

10. Go to https://armmbed.github.io/DAPLink/ and type in the box 54608, then you will see firmware file called

  • 0251_lpc4322_lpc54608xpresso_0x10000.bin
  • Download the firmware file
  • Save wherever you want
  • Drag-and-drop the firmware file onto the mounted drive called MAINTANANCE
  • Wait for the file copy operation to complete
  • Power cycle the board. It will now enumerate and mount as DAPLINK or the name of the board

11. Ready for drag and drop programming

main.cpp

Committer:
marcinch
Date:
2018-12-06
Revision:
4:3bc63d11d829
Parent:
3:d5d12de5808c

File content as of revision 4:3bc63d11d829:

/* mbed Microcontroller Library
 * Copyright (c) 2018 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */
 
 /* info in regards to PUBLISHING CODE available here:
  * https://os.mbed.com/docs/v5.10/tools/publishing-code.html
  */

#include "mbed.h"
//#include "stats_report.h"

/*
 * Pin names available here:
 * https://os.mbed.com/platforms/LPCXpresso54608/
 *
 * API for DigitalOut class with example available here:
 * https://os.mbed.com/docs/latest/apis/digitalout.html
 */
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED_RED);

/*
 * API for Serial class with example available here:
 * https://os.mbed.com/docs/latest/apis/serial.html
 */
Serial pc(USBTX, USBRX, 115200);//(pin name Tx, pin name Rx, baud rate)

// main() runs in its own thread in the OS
int main()
{
    //SystemReport sys_state(500 /* Loop delay time in ms */);
    
    //Setting all pins to low (in this case LEDs will be ON) and wait 2 seconds before while loop starts
    led1 = led2 = led3 = 0;
    wait(2.0f);
    pc.printf("Let's get blinking LEDs demo started!\n\r");
    
    while (true) {
        // Blink LED and wait 0.5 seconds
        led1 = !led1;
        pc.printf("led1 = %d \n\r", (uint8_t)led1 );
        wait(0.5f);
        led2 = !led2;
        pc.printf("led2 = %d \n\r", led2.read() );//both methods of reading pin state give the same result
        wait(0.5f);
        led3 = !led3;
        pc.printf("led3 = %d \n\r", (uint8_t)led3 );
        wait(0.5f);
        
        // Following the main thread wait, report on the current system status
        //sys_state.report_state();
    }//end while
}