LPC810 board

by Krzysztof Foltman

This is my first successful attempt to do something with a 32-bit microprocessor in a circuit of my own making, instead of relying on commercially-available development boards. After some prior unsuccessful tries using STM32F051 and TQFP64 to DIP breakout boards, I decided to start over with something easier. Something that would not require SMD soldering skills, a custom board or any special tools. With all those requirements, I picked the only 32-bit microprocessor that is easily available in a hobbyist-friendly package: the NXP LPC810.

The microcontroller

This chip is an ARM Cortex M0+ core. The basic specs are rather modest:

  • up to 30 MHz clock (built in, no crystal or external oscillator required)
  • only 4KB of flash,
  • 1 KB of SRAM,
  • 6 pins of I/O.

It’s available in an 8-pin DIP package, which every electronics hobbyist should be familiar with – the same package is shared by many popular chips, operational amplifiers, headphone amplifiers, switching-mode power supply controllers and many others. It can even be used with a breadboard. Can’t get any easier!

The datasheet and the user manual, as well as some application notes and errata sheets are available at: See here

Programming the chip

For programming I used a simple USB-to-TTL-serial dongle – no special hardware is required to flash the device. Well… not all that special. The programming mode is activated by holding the PIO0_1 pin down during reset. In order to keep the ability to use that pin for other purposes during normal operation, I used a 2N3904 transistor to pull it down on the RTS signal from the serial dongle. So, depending on the state of the RTS line, pulsing DTR low would either run my program or enable program upload mode. The RTS and DTR can be controlled from the PC in software, so all the required modes – normal operation, normal reset and reset to programming mode – can be triggered. As an alternative, LPC810 also supports the Serial Wire Debug mode, which I haven’t tried yet with this particular chip.

The programming protocol is well documented and there is an existing example of using LPC810 with open tools, including a short programmer program and the linker script: See here

I/O expansion

The limited amount of I/O may be insufficient for any complex designs. Out of 8 pins, two pins are used for power, and three more have to be sacrificed for programming interface and the reset. So, in the end, only 3 GPIO pins are left. Even with the unusual ability to freely reassign some functions to any of the pins, there’s not much that can be done using so few pins.

One of the solutions involves adding a port expander, which I did. I decided to use Microchip’s MCP32008, an 8-bit expander using an I2C bus. This way, 2 data pins are used to provide up to 8 pins of general-purpose I/O, and the direction can be set for individual pins. If that’s not sufficient, more expanders can share the same bus. It is also possible to use MCP32016 – a 16-bit expander – for even more I/O on a single bus address. There are few more alternatives from other manufacturers, too: NXP’s PCF8574 is another popular choice.

In order to build the test device, I used one of the 5x5cm This Is Not Rocket Science matrix protoboards, which provide just enough space to fit the LPC810 and the MCP32008. It requires a bit of careful planning to fit all the components, but no special skills are required.

The hardest part of adding an I2C port expander was the electrical interface: open drain outputs with appropriate pull-ups for the bus. For clock it is possible to use the built in pull-up, but for data I had to add an external resistor. The software – both initialization part and the actual I2C transactions – is not particularly complicated. The documentation contains very detailed, step-by-step instructions to get each peripheral working, and related registers are often cross-references in the right places. This is very different from my experiences with STM32 series chips, where critical information is scattered between the reference manual, data sheet and possibly application notes and other documents. In STM32’s defense, those chips are also much more complex and powerful than LPC810, so a comparable level of detail would make the reference manual run into many more thousands of pages.

Verdict

Overall, using both the LPC810 and the port expander is Not Rocket Science at all. Soldering is easy because of the DIP package, and it’s possible to use a socket to further reduce any thermal risks. The programming interface is a simple serial port + 2 control pins. Both chips are easy to get and inexpensive and documentation (link above) is clear, detailed and helpful.

This is as stress-free as it gets for building the first circuit based on an ARM Cortex M chip.

However, due to small memory, lack of DMA or analog inputs and very little I/O, the chip is of limited use.  It would probably do decent enough job for things like controlling relays or a character LCD from USB, at least when combined with a USB-to-serial dongle – but if I only needed that, in most cases a better choice would be an 8-bit AVR chip in an 8-pin package, like ATtiny85.
However, if I had to use a 32-bit microcontroller for such a task, I would probably pick this one.