Although the FRDM-KL25Z I talked about last time is a great board, my original goal was to get a fully breadboardable ARM processor up and running. You can, of course, run wires from the open header pins to a breadboard, but ultimately the board isn't just an ARM chip you can connect on a typical prototyping setup.
That's why I decided to explore the LPC1114FN28. The NXP chip is similar to the chip on the KL25Z board — slightly less flash and RAM (32K and 4K, respectively) but otherwise the same Cortex M0 CPU, a round of peripherals, and most importantly, a bootloader. The chips cost about $3 in singles.
The device takes 3.3V and has an internal 12MHz clock that you can boost up to 48MHz if you like. The DIP package is highly amenable to a breadboard (or a prototype through hole PC board). If you provide power, you only need a TTL-level serial port to program the chip through its bootloader. The inputs are 5V tolerant or will, of course, accept 3.3V levels, so any TTL converter based on a MAX232 or many of the USB to TTL serial adapters will do the trick.
Of the 28 pins, you really need these connections (in addition to whatever I/O you need for your specific application):
- Pin 15 — The serial port transmit from the host computer (that is, the computer you'll use to program the chip)
- Pin 16 — The serial port receive line
- Pin 21 — A 3.3V supply
- Pin 22 — Ground
- Pin 23 — This pin has to pull low to reset the chip
- Pin 24 — If you pull this pin to ground through a 1K resistor and reset the chip, the chip will enter bootloader mode
In addition, if you want to connect the chip's analog section (and you should even if you don't plan to use it), you'll want to connect pin 7 to 3.3V and pin 8 to the analog ground. For experimentation, it is sufficient to connect pin 7 to pin 21 and pin 8 to pin 22.
Assuming you have a TTL serial port adapter (or, more likely, a USB adapter with TTL level outputs that are easily available), it is nothing to connect this to a breadboard directly. I wanted a slightly neater arrangement, so I used a universal PC board to make the fixed connections, added a few LEDs, and put a jumper in to select the bootloader mode and handle the reset (see Figure below). However, on a breadboard, you could just use wire to make or break the connections for reset and the bootloader.
The bootloader needs software to feed your compiled files into the chip. FlashMagic is a popular choice, but I used lpc21isp (actually, a modified copy that knows about this device type). You first generate a .bin or .hex file (for example, using the Mbed compiler I mentioned last time). Then you need to make sure the bootloader jumper is connected and reset the chip (you can take the bootloader jumper off after reset). The software should be able to download your program. Although the tool said it would reset the chip, I found that sometimes I had to reset the chip manually.
With these chips, it is possible to burn a program that will prevent the chip from starting. For example, if you don’t provide a clock, but you load a program that expects an external clock, the device will appear “bricked.” However, you can always get into bootloader mode since it doesn’t require any special configuration. That gives you a chance to rescue the part with a corrected program if you do brick one.
Like the Arduino, using a bootloader like this doesn't give you many debugging options without some external help. There are two ways to go. First, there are many LPCXpresso boards that you can get fairly inexpensively. These boards have two sections: a target board and an LPC-Link section that connects a USB connector to a programming/debug interface. You can take one of these boards and remove the bridges between the two sections. If you prefer, you can slice the boards into two, if you are careful.
The resulting LPC-Link board needs the following connections to your breadboarded LPC1114 CPU:
Link pin 2 - CPU pin 3 Link pin 3 - CPU pin 12 Link pin 8 – Ground
The board can also provide 3.3V power on pin 1 if you want to power your circuit from the board. The other pins on the Link board aren't needed for this processor.
The other method is to buy a standalone LPC-Link 2 board (for about $20). You don't have to do any surgery on this board and the interface is the same. The board is also capable of emulating several other kinds of USB debug probes if you need them for other projects.
Either way, you'll need some debugger that knows how to communicate with the chip. I used LPCXpresso. You can see in the Figure below that the Eclipse-based IDE give you breakpoints, variable watches, stack traces, and all the other things you expect in a debugger. You can also program the chip via either of the Link boards, so if you have one you don't really need the serial/USB port (unless you want to use it for your own purposes).
Assuming you already have a breadboard and a few simple items, you can start using these CPUs with very little effort. Even if you have to buy everything, you could spend as little as $20 — perhaps $40 if you buy the Link board for debugging. The result, though, is an easy to work with 32-bit development system that can create systems that are very inexpensive to deploy.
As I mentioned last time, the Mbed libraries make it easy to use the ARM peripherals without having to worry about multiplexing and set up. The program I showed last time won't work directly with this setup since it required the touch sensor on the KL25Z board, but the principle is the same. I'll wrap up next time with some example code that you could run on your new breadboard development system (no touch sensor required).