A quick tutorial on using the Explore Cortex M3 (LPC1768) with mbed. Right now, the USB bootloader(mass storage) option does not work with mbed. However if you have a USB to Serial converter, you can definitely program it. This tutorial also applies for other bare metal LPC1768 boards.

Why USB boot-loader does not work?

The mbed online compiler does not allow specifing offest addresses for RAM and ROM which are required in order to make the boot-loader work. If you've figured out a way let us know.

Connecting the Hardware

You need a USB to Serial(UART) convertor in order to get this working. The neat thing about the NXP controllers is, they come with a UART boot-loader form the factory. Even though we put a USB boot-loader on top it, the serial boot-loader is still there for you.

We use the additional DTR and RTS signals to RESET and BOOT-LOAD the board respectively. If your converter does not have these lines, "hold down the ISP switch, RESET the board(press and release reset switch) and then release the ISP switch ". Do this action when programming the board from flash magic which I will describe below.

Serial Programming LPC.png

Converting mbed bin file to hex

We need a hex file in order to flash it using Flash magic. Use this bin2hex utility to convert the file to hex. Copy the bin2hex.exe to some folder, copy the bin file from mbed to the same folder. Enter the command below:

BIN2HEX <input_binary_filename> <output_hex_filename>
e.g bin2hex.exe led.bin led.hex

Transfer the file with the settings below and you've be done. Serial flash.jpg

I did the test with a 16x2, character display, with the following code

// Hello World! for the TextLCD
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(P1_25, P1_26, P1_27, P1_28, P1_29, P1_30); // rs, e, d4-d7
int main() {
    lcd.printf("Explore LPC1768\n on mbed");

and the results. . . the result

It would really be nice if we were able to define offset with the mbed compiler. We will work on it and see if there is anything else we can do about it.