Got some LPC810 chips

Posted at 2014-12-08.

There was a sale on LPC810 8DIP chips at Jeelabs / Digital Smarties and I naturally ordered a pack.

LPC810 chip on breadboard with USB UART module
LPC810 chip on breadboard with USB UART module

The letter arrived a week later and contained the six LPC chips plus a surprise hopjes. :)

I poked around a while trying to find clear instructions and pinout that isn't tied into a specific cable. Finally, at João Vilaça's lpc810 pages there was a usable one plus a very nice pin table.

I poked some wires at a nearby breadboard, took the serial dongle from my hackbag and put it together. I had loaded the tools earlier and cloned the embello git repo.

$ make upload 
arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -I../minimal -Os -ggdb -fno-rtti -fno-exceptions   -c -o main.o main.cpp
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -I../minimal -Os -ggdb   -c -o gcc_startup_lpc8xx.o gcc_startup_lpc8xx.c
arm-none-eabi-gcc -o firmware.elf -mcpu=cortex-m0plus -mthumb -I../minimal -Os -ggdb -Wl,--script=../minimal/LPC810.ld -nostartfiles main.o gcc_startup_lpc8xx.o
arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
lpc21isp -control -bin firmware.bin /dev/ttyUSB* 115200 0
lpc21isp version 1.97
File firmware.bin:
        loaded...
        image size : 396
Image size : 396
Synchronizing (ESC to abort). OK
Read bootcode version: 4
13
Read part ID: LPC810M021FN8, 4 kiB FLASH / 1 kiB SRAM (0x00008100)
Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.
Erasing sector 0 first, to invalidate checksum. OK 
Sector 0: ..|.
Download Finished... taking 0 seconds
Now launching the brand new code

Lpc21isp seems to work. The result doesn't look like much since I used a 3.3 V line instead of the series LED trick.

$ flushmagic.py
PartID: 33024
BootPromVersion: 4.13
UID: 402956302-2921038850-1373116713-4110424323

Flushmagic also seems to recognize the chip.

Here's some beginnings of a blinky code that should pulse pin 4 (GPIO0_2).

/*
 * Blinky for LPC810. For educational use and testing.
 * Built for includes and makefile from https://github.com/jeelabs/embello/
 */

#include "LPC8xx.h"

void spinwait(void);

/**
 * Simple main
 */
int main(void){
    // Set switch matrix.
    // For some reason, bit 3 is pin 2?
    LPC_SWM->PINENABLE0 |= 1 << 3;

    // Set DDR
    LPC_GPIO_PORT->DIR0 = (1 << 2);

    while (1)
    {
        LPC_GPIO_PORT->SET0 = (1 << 2);
        spinwait();
        LPC_GPIO_PORT->CLR0 = (1 << 2);
        spinwait();
    }
}

/**
 * Waste some time here.
 */
void spinwait(void) {
    // Loop on volatile var should not get optimized away
    volatile unsigned int i = 80000;

    while(i--);
}