Professor Zhou Ligong's new book, "Programming for AMetal Frameworks and Interfaces (Part 1)," provides a comprehensive introduction to the AMetal framework. By studying this book, readers will gain insights into advanced software design principles and development approaches for interface programming. It encourages focusing on your core domain, transforming your programming mindset, and achieving mutual growth between companies and individuals.
This book is officially authorized by Professor Zhou Ligong. Starting now, the Zhiyuan Electronic Public Number will serialize the content of the book, and we are pleased to share it with you.
The first chapter introduces the AM824-Core Development Kit, specifically covering sections 1.1 LPC824 Microcontroller and 1.2 LPC84x Microcontroller.
This chapter guides:
With the rapid development of Internet of Things (IoT) technology, microcontroller units (MCUs) have become increasingly powerful, blurring the lines between MCUs and microprocessors. These devices are gradually evolving into embedded processors. The AMetal framework simplifies development by completely abstracting the underlying complexity, allowing developers to focus only on the basic functions of the MCU.
1.1 LPC824 Microcontroller
> > > 1.1.1 Features
System:
- ARM Cortex-M0+ embedded processor with built-in nested interrupt vector controller (NVIC), system tick timer, and a maximum operating frequency of 30 MHz;
- Supports Serial Wire Debug (SWD) mode and JTAG Boundary Scan (BSDL) mode.
On-chip memory:
- Up to 32KB Flash and 8KB SRAM, supporting 64-byte page write and erase operations.
Digital peripherals:
- Up to 32 general-purpose I/O pins with configurable pull-up/pull-down resistors, programmable open-drain mode, input inverter, and noise filter. GPIO direction control supports independent bit set, clear, and toggle;
- 4 pins with 20mA output drive capability and 2 open-drain pins with 20mA sink drive capability;
- GPIO interrupt generation with 8 GPIO inputs supporting Boolean pattern matching;
- Switch matrix for flexible configuration of each I/O pin function;
- CRC engine with DMA support for 18 channels and 9 trigger inputs.
Timers:
- State-configurable timer (SCTimer/PWM) for timing and PWM applications, including capture and match;
- Quad Channel Multi Rate Timer (MRT) for generating repeatable interrupts at up to 4 programmable fixed rates;
- Self-wake timer (WKT) using internal low-power oscillator or external clock;
- Window Watchdog Timer (WWDT).
Analog peripherals:
- 12-bit ADC with up to 12 input channels, multiple internal/external triggers, and a sampling rate of up to 1.2 Msamples/s. Supports two independent conversion sequences;
- Comparator with 4 input pins and external/internal reference voltage.
Serial interfaces:
- 3 USART interfaces with switch matrix-assigned pin functions and shared fractional baud rate generator;
- 2 SPI controllers with switch matrix-assigned pin functions;
- 4 I2C bus interfaces. Supports high-speed mode plus, with data rates up to 1 Mbps in true open-drain mode and 400 kbps in standard digital I2C mode.
Clock generation:
- 12MHz internal RC oscillator with ±1.5% accuracy for use as a system clock;
- Crystal oscillator with an operating frequency range of 1–25 MHz;
- Programmable watchdog oscillator with a frequency range of 9.4kHz–2.3MHz;
- 10 kHz low power oscillator for WKT;
- PLL allows CPU to reach maximum frequency without a high-frequency crystal, using system oscillator, external clock, or internal RC oscillator;
- Clock output with divider to reflect all internal clock sources.
Power control:
- Integrated PMU (Power Management Unit) for minimal power consumption;
- Energy-saving modes: Sleep, Deep Sleep, Power Down, and Deep Power Down;
- Deep Sleep and Power Down modes can be awakened via USART, SPI, and I2C peripherals;
- Deep Power Down mode can self-wake via timer control;
- Power-on reset (POR), brownout detection (BOD).
Single power supply (1.8V – 3.6V), operating temperature range: -40°C to +105°C.
> > > 1.1.2 Overview
The LPC824 series microcontrollers, shown in Figure 1.1, feature a rich set of on-chip peripherals, including switch matrix, state-configurable timers, multi-rate timers, window watchdog timers, and DMA control. Analog peripherals include a 12-bit high-speed ADC and an analog comparator, while serial interfaces include three UARTs, two SPIs, and four I2Cs. A 12MHz RC oscillator is integrated within the chip and can serve as the system clock source.
Figure 1.1: LPC824 Functional Block Diagram
The LPC824 series MCUs are known for their ultra-low power consumption, with industry-leading performance of 90μA/MHz. They support four low-power modes, enabling users to choose the most suitable mode based on application needs. In the lowest power mode, they consume less than 1μA.
Although these concepts may seem unfamiliar to beginners, don’t worry—just like how you use a computer without understanding its internal workings, you can program and use these MCUs effectively without getting bogged down by the details.
The LPC812/824 belongs to the LPC800 series. The LPC824 is an enhanced version of the LPC812, offering more peripheral resources and better adaptability to various applications. Due to consistent register configurations across the same peripherals, software design remains fully compatible, significantly reducing platform construction difficulty and allowing reasonable selection based on specific needs. For more details, see Table 1.1.
Table 1.1: LPC800 Series MCU Selection Table
The LPC824 series MCUs come in two packages: TSSOP20 and HVQFN33, with pinouts as shown in Figure 1.2.
Figure 1.2: Schematic diagram of the package
The pin descriptions and main functions of the LPC824 series MCU are shown in Table 1.2.
Table 1.2: Pin Descriptions for the LPC824 Series
1.2 LPC84x Microcontroller
> > > 1.2.1 Features
System:
- ARM Cortex-M0+ processor with a maximum frequency of 30 MHz, supporting single-cycle multiplication and fast single-cycle I/O;
- Integrated nested interrupt vector controller (NVIC);
- System tick timer;
- AHB bus matrix;
- Supports SWD and JTAG modes;
- Micro Tracking Buffer (MTB).
Memory:
- Up to 64KB on-chip Flash, with 64-byte page write/erase capabilities;
- FAIM memory allows custom behavior during power-up;
- Code Read Protection (CRP);
- Up to 16KB SRAM, including two 8KB contiguous SRAM blocks, one of which can be used by MTB;
- Supports bit-band operations for atomic single-bit operations.
ROM API Support:
- Bootloader;
- IAP (In-Application Programming);
- ISP (In-System Programming) via USART, SPI, or I2C;
- Integer division API interface.
Digital Peripherals:
- Up to 32 general-purpose I/O pins with configurable pull-up/pull-down, open-drain mode, input inverter, and noise filter. GPIO direction control supports independent bit set, clear, and flip;
- 4 pins with 20mA output drive capability;
- 2 open-drain pins with 20mA sink drive capability;
- GPIO interrupt generation with 8 GPIO inputs supporting Boolean pattern matching;
- Switch matrix for flexible I/O configuration;
- CRC engine;
- DMA with 25 channels and 13 trigger inputs;
- Capacitive Touch Screen interface.
Timers:
- State-configurable timer (SCTimer/PWM) for timing and PWM, with 8 match/capture, 8 events, and 8 states;
- General-purpose timer with 4 matched outputs, 3 input captures, support for PWM, external counting, and DMA;
- Quad Channel Multi Rate Timer (MRT) for repeatable interrupts at up to 4 programmable fixed rates;
- Self-wake timer (WKT) using internal low-power oscillator or external clock;
- Window Watchdog Timer (WWDT).
Analog Peripherals:
- 12-bit ADC with up to 12 input channels, multiple internal/external triggers, and a sampling rate of up to 1.2 Msamples/s. Supports two independent conversion sequences;
- Comparator with 4 input pins and external/internal reference voltage;
- Two 10-bit DACs.
Serial Interfaces:
- 5 USART interfaces with switch matrix-assigned pin functions and shared fractional baud rate generator;
- 2 SPI controllers with switch matrix-assigned pin functions;
- 4 I2C bus interfaces. Supports high-speed mode plus, with data rates up to 1 Mbps in true open-drain mode and 400 kbps in standard digital I2C mode.
Clock Generation:
- Free running oscillator (FRO) with ±1% accuracy, providing 18MHz, 24MHz, or 30MHz clock, or divided to 9MHz, 12MHz, or 15MHz as system clock;
- Low power startup using FAIM memory at 3MHz;
- Crystal oscillator with 1–25 MHz operating frequency;
- Low power oscillator for watchdog clock;
- Programmable watchdog oscillator with 9.4kHz–2.3MHz frequency range;
- PLL allows CPU to generate maximum frequency without high-frequency crystal, using system oscillator, external clock, or internal RC oscillator;
- Clock output with divider reflecting all internal clock sources.
Power Control:
- Operational power consumption as low as 90μA/MHz;
- Integrated PMU (Power Management Unit) for minimal power consumption;
- Energy-saving modes: Sleep, Deep Sleep, Power Down, and Deep Power Down;
- Deep Sleep and Power Down modes can be awakened via USART, SPI, and I2C;
- Deep Power Down mode can self-wake via timer control;
- Power-on reset (POR), brownout detection (BOD).
Single power supply (1.8V – 3.6V), operating temperature range: -40°C to +105°C;
Available in LQFP64, LQFP48, HVQFN48, and HVQFN33 packages.
> > > 1.2.2 Overview
The LPC84x family of microcontrollers, shown in Figure 1.3, features a rich set of on-chip peripherals, including switch matrix, state-configurable timers, multi-rate timers, window watchdog timers, and DMA control. Analog peripherals include a 12-bit high-speed ADC and two 10-bit DACs, with five UARTs, two SPIs, and four I2Cs. A free-running oscillator is integrated inside the chip, serving as the system clock source.
Figure 1.3: LPC84x Functional Block Diagram
The LPC84x series MCUs are also known for their ultra-low power consumption, with a power efficiency of 90μA/MHz. They support four low-power modes, allowing users to select the most appropriate mode based on their application requirements, with less than 1μA in the lowest power mode.
Despite the technical complexity, these concepts should not intimidate beginners. Just like using a computer without needing to understand its inner workings, you can effectively develop and use these MCUs without being overwhelmed by the details.
The LPC84x series comes in four different packages, making it easy to choose based on specific requirements. For more information, refer to Table 1.3.
Table 1.3: LPC84x Series MCU Selection Table
The pin descriptions and main functions of the LPC84x series are shown in Table 1.4.
Table 1.4: Pin Description
PCAP film,capacitive touch foil,multi touch film
Guangdong ZhiPing Touch Technology Co., Ltd. , https://www.zhipingtouch.com