Using the mbed LPC11U24 with LPCXpresso

03 Feb 2012

Hi, I love the mbed hardware, but closed-source online compilation seems totally weird and crazy to me. Maybe it's useful for beginners... So anyway, I'm trying to get something working with LPCXpresso. Here's what I've done so far:

1. Download & install LPCXpresso.

2. Import the CMSISv2p00LPC11Uxx library project, and the LPCXpresso11U14_systick example project (it's supposed to flash an LED).

3. Change LED_PORT and LED_BIT to:

    #define LED_PORT 1		// Port for led
    #define LED_BIT 18		// Bit on port for led

which as far as I can tell is LED0 (or LED1 or whatever) on the mbed.

4. Right click the example project->Properties->C/C++ Build->Settings->Build Steps-> (Lost yet?) ->Post-build steps->Command. Remove the '#' which prevents the .bin file from being built.

5. Build the project. You get a bin file, which is nice.

6. Copy the file to the mbed using 'cp' and reset. Sadly it doesn't flash the LED and now I am stuck. I also tried using lpc-flash from OpenPCD.org which is necessary for the LPC13xx on linux due to something about FAT (and it also calculates the checksum, although the compile output says that is already done). Still didn't work.

Here's the obj-copy output nayway:

make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size LPCXpresso11U14_systick.axf;  arm-none-eabi-objcopy -O binary LPCXpresso11U14_systick.axf LPCXpresso11U14_systick.bin ; checksum -p LPC11U14_201 -d LPCXpresso11U14_systick.bin;
   text	   data	    bss	    dec	    hex	filename
   3192	      4	    156	   3352	    d18	LPCXpresso11U14_systick.axf
Created checksum 0x9edffef in LPCXpresso11U14_systick.bin at offset 0x1c 

Has anyone got this to work? I'd rather not use any closed source stuff on this...

03 Feb 2012

I take that back; it works! I just got the LED number wrong.

For future reference, the LEDs on the LPC11U24 mbed are on port 1, bits 9-12, like this:

LPC_GPIO->SET[1] = 0x00000100; // LED 0
LPC_GPIO->SET[1] = 0x00000200; // LED 1
LPC_GPIO->SET[1] = 0x00000400; // LED 2
LPC_GPIO->SET[1] = 0x00000800; // LED 3

Also, you don't need to use lpc-flash on linux. In fact you can automatically deploy the code by adding this text to the end of the post-build step I mentioned in the previous comment:

cp ${BuildArtifactFileBaseName}.bin /media/MBED/code.bin

Then all you do is press build (CTRL-B) and then press the mbed reset button!