Computing stuff tied to the physical world

Meet the LPC824

The LPC824 microcontroller by NXP is a very interesting chip. Like the rest of the LPC8xx family, it’s an ARM Cortex M0+ 32-bit processor with a great set of peripherals:

Screen Shot 2015 06 01 at 18 47 30

Some basic specs: 32 KB flash memory and 8 KB RAM, 12 MHz clock (up to 30 MHz via built-in PLL), deep power-down mode < 1 µA, 16 to 29 I/O pins, depending on package.

Loads of modern peripherals built into the hardware – check ’em out:

  • 12-bit ADC, can acquire over 1 million samples per second
  • digital interfaces: 3x serial (USART), 4x I2C, 2x SPI
  • SCT (state-configurable time), can generate up to 6 PWM’s
  • timers: 4x 32-bit, low-power self wake-up, windowed watchdog
  • up to 8 pin interrupts, with optional pattern matching
  • 18-channel DMA with 9 trigger inputs
  • and a few more, such as a CRC engine and an analog comparator w/ ladder

As with all LPC8xx members, flash memory can be changed via a ROM-based serial boot loader. There’s also SWD and JTAG support (including trace buffers and boundary scan).

The grey areas in the above diagram (which was copied from the datasheet) can act as DMA source or destination. This means that the processor doesn’t need to be involved in various streaming transfers, such as high-speed ADC sampling, or SPI transactions.

Last but not least, there’s the “Switch Matrix” in front of everything, so that most of these functions can be assigned to any pin. The main exception is analog: the ADC can only connect to a specific set of pins (those which support the required analog input mode).

This is an pretty advanced device. Simple things are simple, but making use of all the advanced hardware will be quite a task. The UM10800 User Manual (PDF) is 485 pages.

When compared to the ATmega168 and 328, which are the processors that started the Arduino revolution, the LPC824 is more advanced and more capable in just about every respect. This is not really surprising, given the fact that the LPC824 is much more recent.

One really welcome improvement is the 8 KB RAM, which is not only four times the size of the ATmega328, but also gets used up much less in C/C++ programs, because read-only strings and tables can stay in flash memory. On ATmega’s / ATtiny’s, all data has to live in RAM, but you can use special calls to access bytes or words in flash or EEPROM memory.

Note that the LPC8xx series has no EEPROM, but this can be emulated fairly easily with flash memory, due to the LPC8xx’s ability to alter flash memory areas programmatically.

As with all ARM chips, there are features which are generic across the entire range of ARM Cortex products, even across the different vendors, and there are features which are very vendor-specific. In the above diagram, the ARM core, AHB bus, and AHB to APB bridge sections are essentially identical for any ARM Cortex chip. And although USARTs, I2C, SPI, DMA, ADC, timers tend to be very similar for products from the same vendor, they also end up being very dissimilar between different vendors. So for example, NXP’s various LPC products will all look similar with respect to the above built-in peripherals, wheras STM’s or TI’s ARM chips will have their own incompatible peripheral designs.

There’s clearly a need for some conventions and C/C++ “header glue” if we want to re-use our code from one chip to the next later on, when technologies (or requirements) change. But let’s not forget that all the ARM µC’s share a huge common core and instruction set.

Sooo… once again: welcome to the incredible 32-bit ARM µC world!