Skip to content

Instantly share code, notes, and snippets.

@74hc595
Last active December 20, 2015 09:49
Show Gist options
  • Save 74hc595/6111097 to your computer and use it in GitHub Desktop.
Save 74hc595/6111097 to your computer and use it in GitHub Desktop.
Instructions for setting up an ARM toolchain for the LPC1114 microcontroller on Mac OS X.

Getting Started with the LPC1114 on Mac OS X

July 30, 2013

The LPC1114FN28 is an exciting piece of hardware--a 32-bit ARM Cortex-M0 micro controller capable of 50MHz operation in a DIP-28 package. Unfortunately, getting your development environment set up on a Mac can be confusing.

You'll need the following:

  • the GCC ARM Embedded toolchain
  • lpc21isp to program the chip
  • some sample code
  • an FTDI USB-to-serial cable or equivalent. (Doesn't matter if you have a 5V or 3.3V model, the LPC1114's inputs are 5V-tolerant.)

So, let's get started.

  1. Download the GCC ARM Embedded toolchain from https://launchpad.net/gcc-arm-embedded. You want to download the prebuilt Mac binaries: choose the download with mac.tar.bz2 in the filename. (As of writing, the full link to the latest version is https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update/+download/gcc-arm-none-eabi-4_7-2013q2-20130614-mac.tar.bz2).

  2. Create a directory for your ARM toolchain binaries. I'd recommend against putting them directly in /usr. Instead, create a directory like /opt/local/arm or ~/arm, whatever you prefer.

  3. Extract the toolchain tarball into the directory you just created. It should now contain these directories:

    • arm-none-eabi/
    • bin/
    • lib/
    • share/
  4. Add the bin/ directory to your $PATH in your shell's rc file (.bashrc, .zshrc, etc.) Example:

    export PATH=$PATH:/opt/local/arm/bin

  5. Download and extract the latest version of lpc21isp. You'll want at least version 1.92, which can be found here: https://github.com/capiman/lpc21isp

  6. The Makefile needs to be modified. Remove -static from the CFLAGS, or you'll get this error during compilation:

    ld: library not found for -lcrt0.o

  7. Run make to build lpc21isp. Copy the resulting lpc21isp binary to the arm directory you added to your $PATH in step 4.

  8. Set up your hardware on a breadboard. (diagram from Brad Luyster) Breadboard diagram

    • Pin 22 (Vss) to ground
    • Pin 21 (Vdd) to +3.3V
    • Pin 23 (/RESET) to +3.3V via 4.7k pull-up resistor and to one end of a normally-open pushbutton. This is the reset button. The other end of the button should connect to ground, so pressing the button should drive pin 23 low.
    • Pin 16 (TXD) to the YELLOW wire of the FTDI cable
    • Pin 15 (RXD) to the ORANGE wire of the FTDI cable
    • BLACK wire of the FTDI cable to ground
    • Pin 24 (PIO0_1) to ground via 4.7k resistor. This places the chip in programming mode.
    • Pin 17 (PIO1_8) to the anode of an LED for testing purposes. Connect the cathode of the LED to ground via a 220 ohm resistor.
  9. Connect the FTDI cable to the circuit and to a USB port on your Mac.

  10. If you don't know the device name of your FTDI cable, discover it by running the following command:

ls -l /dev/cu.usbserial*

It should be something like /dev/cu.usbserial-xxxxxxxx, where the x's are random letters and numbers. Save it in an environment variable:

export FTDI_DEV=/dev/cu.usbserial-xxxxxxxx

  1. Power on the circuit. (remember, 3.3V!)

  2. Test communications with the LPC1114 by running the following command:

lpc21isp -detectonly $FTDI_DEV 115200 12000

If everything's successful, you'll see output ending with:

Read part ID: LPC1114FN.../102, 32 kiB ROM / 4 kiB SRAM (0x1A40902B)

  1. Now it's time to run some code. Download Brad Luyster's blinking LED project from https://github.com/Zuph/lpc1114-blink.

  2. Extract the archive, cd into it, and run make. If everything worked, you'll have a file called lpc1114_blink_led.hex in the out/ subdirectory.

  3. Power on the circuit again, and send the code to the LPC1114 using this command:

lpc21isp out/lpc1114_blink_led.hex $FTDI_DEV 115200 12000

If it worked, the output will end with:

Now launching the brand new code

(Note: the 115200 is the baud rate, and the 12000 is the chip's clock speed in kilohertz.)

  1. Remove the resistor connected to pin 24 to take the LPC1114 out of programming mode, and press the reset button. The LED on pin 17 should be blinking at a rate of 1Hz. And you're all set!

Acknowledgements/Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment