OK now is the time to pull out your Adafruit LPC810 Mini Starter Pack
Programming your LPC810 is relatively foolproof, and these chips are extremely hard to brick since they have a ROM-based bootloader and 'safety mode' that can always be executed before any bad firmware we might have programmed into the chip. We'll use this feature to program the MCUs with the firmware we built in the previous step.

But first ... a bit of wiring is in order! You'll need to hookup a UART to USB adapter, a 3V3 voltage regulator, a couple caps, and a few wires to get everything wired up safely with the LPC810. Just follow the wiring diagram below and you should be good.

The UART cable colors on the right (four wires) match the colors of Adafruit's USB to TTL Serial Cable.

Programming the LPC810

There are two main ways to take advantage of ISP mode to program your MCU:
  • Use Flash Magic, a free GUI-based tool for Windows
  • Use lpc2isp, an open source command-line tool that can be adapted to work on most operating systems, though you may need to build it yourself and add your MCU ID.
This tutorial will focus on Flash Magic as a starting point since it's the easiest tool to use, and since many Linux users should be able to figure out lpc2isp without too much effort.

Hooking Everything Up

This tutorial will assume that you are using the PL2303-based USB to TTL Serial Cable included with the LPC810 Starter Kit.

  1. Insert the LPC810 into your breadboard as shown, along with the 3.3V voltage regulator, and two decoupling capacitors.
  2. Connect the white, green, red and black wires on the right-hand side of the diagram to the same colored cables on your USB to TTL serial adapter.
  3. Connect the ISP pin to GND (the cable shown in gray above), which will cause the chip to enter ISP mode when it comes out of reset
  4. Connect the other red and black cables on the breadboard which control the power supply to the MCU.
Note: Be sure to connect the ISP pin to GND before powering the board (with the red and black cables), since the LPC810 checks this pin as soon as it has power to device if it should enter ISP mode or not. When the ISP is at GND on boot, the chip enters ISP mode, when ISP is floating or logic high, th chip will boot normally, skipping ISP mode.

Using Flash Magic

If you haven't already done so, download and install the latest version of the free Flash Magic tool.

The tool is relatively straight forward once you have used it once or twice, but this guide will show you everything you need to know to program the LPC810 using the Flash Magic GUI.

Get Your .HEX File Ready

Flash magic uses Intel Hex files to program the MCUs.

The LPC810 CodeBase will produce a compatible .hex file from your own code, which we'll learn about later, but you can also find some sample .hex files at the bottom of this tutorial for convenience sake.

Configuring Flash Magic for the LPC810

Before you can program your LPC810, you need to supply some basic information to Flash Magic:

  • Set the device to 'LPC810M021FN8'
  • Set the COM port to whatever COM port your USB to TTL cable is using (you can find this in the Device Manager on Windows, for example)
  • Set the Baud Rate to '115200'
  • Set the Oscillator to '12'
  • Check the 'Erase blocks used by Hex File' checkbox
Once these settings are entered (see the image below for a reference), you simply need to point to your .hex file by clicking on the 'Browse...' button

Checking your Connection

You can make sure that all of your settings are correct, and that everything is connected properly and that the chip is actually in ISP mode by selecting 'ISP > Read Device Signature ...' from the top menu bar:
If everything is OK, you should see something similar to this:
If you get an error message, check your COM port and the connections to your USB to TTL cable and ensure that the ISP pin is pulled low to GND before powering or resetting your board.

Programming the Device

After selecting your .hex file in the 'Hex File' textbox, you simply need to click the Start button, and Flash Magic should start programming your device.

You may wish to check the 'Verify After Programming' checkbox before doing this, but it isn't strictly necessary:

Testing Your Firmware

At this point, your device should be programmed. To test your firmware perform the following steps:
  • Disconnect the ISP wire on your breadboard (the gray wire in the image above)
  • Reset the device ... for example, disconnect then reconnect the red power cable on your USB to TTL adapter
  • Once the board is powered up and if the ISP pin is not pulled low the chip will execute code normally

Sample Hex Files

For convenience sake, you can find some pre-compiled sample .hex files for the LPC810 in the '/tools' folder of the LPC810 code base, available on github:
  • LPC810_Blinky_P0_2.hex - This hex file will cause an LED on P0.2 to blink at a regular rate. To use this firmware, connect the anode (the larger pin on your LED) to P0.2 on the LPC810, and the cathode (the shorter pin on the LED) to a 1K resistor and to GND, as seen in the following diagram:

This guide was first published on May 24, 2013. It was last updated on May 24, 2013.

This page (Programming the LPC810 with Flash Magic) was last updated on Mar 27, 2013.

Text editor powered by tinymce.