Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
Agenda
– General Introduction
– Introduction to the ARM7 architecture
– NXP LPC2000 ARM Implementation and Tools
– Lunch break
– Verification of Setup, Introduction to Tools
– MAM, PLL, GP I/O
– PWM, ADC
– Serial Interfaces, SPI, I2C, UART
– USB Interface
11/15/08
15.11.08
CONFIDENTIAL 2
Subject/Department, Author, MMMM dd, yyyy
Keil Software
an ARM Company
Compiler
– For Philips LPC900
– For Philips LPC2000
Debugger
– Simulator
– JTAG Debugger
Evaluation Boards
– For NXP LPC900
– For NXP LPC2000
11/15/08
15.11.08 http://www.embeddedartists.com
CONFIDENTIAL 3
Subject/Department, Author, MMMM dd, yyyy
ETU NXP lab
Training Class and Consulting Services
Turnkey software&hardware development
Modern equipment
Various cores & architectures
Customer support
Operating systems porting
– Linux
– eCOS
– freeRTOS
11/15/08
15.11.08 Web site coming soon ://
CONFIDENTIAL 4
Subject/Department, Author, MMMM dd, yyyy
Insider’s Guide Book:
How to start with LPC2000 family:
Published by Dodeca
Current Price:
– 230 Rub.
With CD-ROM
Includes USB block description and
programming manual.
11/15/08
15.11.08 http://www.book.dodeca.ru/books/.php
CONFIDENTIAL 5
Subject/Department, Author, MMMM dd, yyyy
Микроконтроллеры ARM7. Семейство LPC2000.
Руководство пользователя.
Published by Dodeca
Current Price:
– 420 Rub.
Contains CD-ROM
Full technical description of LPC2000
family
11/15/08
15.11.08 http://www.book.dodeca.ru/books/33044.php
CONFIDENTIAL 6
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 7
Subject/Department, Author, MMMM dd, yyyy
ARM Holdings plc. (1)
CONFIDENTIAL 8
Subject/Department, Author, MMMM dd, yyyy
ARM Holdings plc. (2)
11/15/08
15.11.08
CONFIDENTIAL 9
Subject/Department, Author, MMMM dd, yyyy
NXP is a leader in ARM
11/15/08
15.11.08
CONFIDENTIAL 10
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 11
Subject/Department, Author, MMMM dd, yyyy
Bus Width
Address Bus
ARM7TDMI is a 32-bit architecture
– Data pathes and ARM instructions Address Register Incr.
Data Bus
11/15/08
15.11.08
CONFIDENTIAL 12
Subject/Department, Author, MMMM dd, yyyy
Thumb Mode
11/15/08
15.11.08
CONFIDENTIAL 13
Subject/Department, Author, MMMM dd, yyyy
Thumb Code Size Comparison
Code size Benchmark
V850 V850
145.8
68K
68K
227.8
80C51 80C51
223
C167
C167
183.5
ARM ARM
121.1
AVR AVR
212
Z80 Z80 184.7
Mitsu16
Mitsu16
147.5
ST20
ST20
127.3
M-CORE
M-CORE
123.9
68HC12
68HC12
150.2
MIPS32
MIPS32
146.5
MSP430
MSP430
207.4
X86
X86
125.1
H8S
H8S
149.2
Thumb
Thumb
100
SH
SH
129.3
CONFIDENTIAL 14
Subject/Department, Author, MMMM dd, yyyy
CMX-CANopen Code Size Comparison
(tested 7-Feb-05, with highest optimization level, all sizes in bytes)
Code: 11025
Code: 8512 Const: 526 Code: 10654
CONFIDENTIAL 15
Subject/Department, Author, MMMM dd, yyyy
Data Types and Alignment
Definitions:
– Word = 32 bits (four bytes) = UNSIGNED32
– Halfword = 16 bits (two bytes) = UNSIGNED16
– Byte = 8 bits = UNSIGNED8
1 2 3 4 1 2 3 4
Byte Byte Byte Byte Byte Byte Byte Byte
Word Word
Halfword Halfword
Word Word
11/15/08
15.11.08
CONFIDENTIAL 16
Subject/Department, Author, MMMM dd, yyyy
Processor Modes
11/15/08
15.11.08
CONFIDENTIAL 17
Subject/Department, Author, MMMM dd, yyyy
Registers (1)
An ARM core has 37 registers (32-bit)
General purpose registers
– 1 program counter
– 30 general purpose registers
Status registers
– 1 current program status register
– 5 saved program status registers
These registers are not all accessible at the same time. The processor state and
operating mode determine which registers are available to the programmer.
11/15/08
15.11.08
CONFIDENTIAL 18
Subject/Department, Author, MMMM dd, yyyy
Registers (2)
11/15/08
15.11.08
CONFIDENTIAL 19
Subject/Department, Author, MMMM dd, yyyy
User and System Register Banking
r0
r1
r2
r3
Used by
r4
Banked registers Software
r5 Interrupt
r6 FIQ IRQ Supervisor Abort Undefined
r7
r8 r8_fiq
r9 r9_fiq
r10 r10_fiq
r11 r11_fiq
r12 r12_fiq
r13 (SP) r13_fiq (SP) r13_irq (SP) r13_svc (SP) r13_abt (SP) r13_und (SP)
r14 (LR) r14_fiq (LR) r14_irq (LR) r14_svc (LR) r14_abt (LR) r14_und (LR)
r15 (PC)
CPSR
SPSR_fiq SPSR_irq SPSR_svc SPSR_abt SPSR_und
11/15/08
15.11.08
CONFIDENTIAL 20
Subject/Department, Author, MMMM dd, yyyy
Registers in Thumb Mode
The Thumb state register set is a subset of the ARM state set. The
programmer has direct access to:
– eight general registers r0 - r7
– the program counter PC
– a Stack pointer SP
– a Link register LR
– the current program status register CPSR
In Thumb state, the high registers (r8 - r12) are not part of the standard
register set. The assembly language programmer has limited access to
them, but can use them for fast temporary storage
11/15/08
15.11.08
CONFIDENTIAL 21
Subject/Department, Author, MMMM dd, yyyy
Thumb vs. ARM
r0 r0
r1 r1
r2 r2
Thumb state r3 r3
Low registers r4 r4
r5 r5
r6 r6
r7 r7
r8
Thumb ARM
r9
CPSR CPSR
11/15/08
15.11.08 SPSR SPSR
CONFIDENTIAL 22
Subject/Department, Author, MMMM dd, yyyy
Program Status Register (1)
31 30 29 28 27 24 23 16 15 8 7 6 5 4 0
N Z C V Q J I F T mode
CONFIDENTIAL 23
Subject/Department, Author, MMMM dd, yyyy
Program Status Register (2)
31 30 29 28 27 24 23 16 15 8 7 6 5 4 0
N Z C V Q J I F T mode
11/15/08
15.11.08
CONFIDENTIAL 24
Subject/Department, Author, MMMM dd, yyyy
Exception / Interrupt Handling
CPSR SPSR_<mode>
– sets appropriate CPSR bits
• interrupt disable bits
• mode field bits 8 7 6 5 4 0
mode
CPSR: I F T
• if running in Thumb mode, enter ARM mode*
CONFIDENTIAL 25
Subject/Department, Author, MMMM dd, yyyy
Exception Vectors
Vector Table
.
.
.
0x1C FIQ
0x18 IRQ Each entry is a
branch instruction
0x14 (Reserved) with ‘always’
condition
0x10 Data Abort
0x0C Prefetch Abort
0x08 Software Interrupt
0x04 Undefined Instruction
0x00 Reset
11/15/08
15.11.08
CONFIDENTIAL 26
Subject/Department, Author, MMMM dd, yyyy
Leaving Exception
To leave an exception, the exception handler must
– copy SPSR back into CPSR
SPSR_<mode> CPSR
Control bits
PC - offset
r14_<mode> (LR) r15 (PC)
11/15/08
15.11.08
CONFIDENTIAL 27
Subject/Department, Author, MMMM dd, yyyy
Multiple Exceptions
Exception priorities
– When multiple exceptions arise at the same time, a fixed priority sytem
determines the order in which they are handled
11/15/08
15.11.08
CONFIDENTIAL 28
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 29
Subject/Department, Author, MMMM dd, yyyy
Instruction Set
11/15/08
15.11.08
CONFIDENTIAL 30
Subject/Department, Author, MMMM dd, yyyy
Conditional Execution
Mnemonic Description
EQ Equal
NE Not equal
CS / HS Carry Set / Unsigned higher or same
CC / LO Carry Clear / Unsigned lower
MI Negative
PL Positive or zero
VS Overflow
VC No overflow
HI Unsigned higher
LS Unsigned lower or same
GE Signed greater than or equal
CONFIDENTIAL 31
Subject/Department, Author, MMMM dd, yyyy
Advantages of conditional executions
CONFIDENTIAL 32
Subject/Department, Author, MMMM dd, yyyy
ARM “C” and assembly code comparison:
“C” code:
if ((c==1) && (z==0)) R1=R2+(R3*8);
Assembly code:
HIADDS R1, R2, R3, LSL,#3
11/15/08
15.11.08
CONFIDENTIAL 33
Subject/Department, Author, MMMM dd, yyyy
Addressing Modes
11/15/08
15.11.08
CONFIDENTIAL 34
Subject/Department, Author, MMMM dd, yyyy
Thumb Instruction Subset
ARM code can be combined with Thumb code for maximum flexibility
11/15/08
15.11.08
CONFIDENTIAL 35
Subject/Department, Author, MMMM dd, yyyy
Thumb Instructions
11/15/08
15.11.08
CONFIDENTIAL 36
Subject/Department, Author, MMMM dd, yyyy
Thumb Instruction Set (1)
Instruction Types
– Branch
• Unconditional ± 2KBytes
• Conditional ± 256Bytes
• Branch with Link ± 4MBytes (2 Instructions!)
• Branch and exchange change to ARM state if Rm[0] = 0
– Data Processing
• Subset of ARM data processing instructions
• Not conditionally executed (but some update flags)
11/15/08
15.11.08
CONFIDENTIAL 37
Subject/Department, Author, MMMM dd, yyyy
Thumb Instruction Set (2)
Instruction Types
– Load and Store
• Register plus 5-bit immediate addressing
• Register plus Register addressing
11/15/08
15.11.08
CONFIDENTIAL 38
Subject/Department, Author, MMMM dd, yyyy
Translation of Thumb Instruction
Major op-code
Minor op-code
denoting format 3 Destination and Immediate
denoting ADD
move/compare/add/sub/ source register value
instruction
with immediate value
31
1110 00 1 0100 1 0 Rd 0 Rd 0000 8-bit immediate 0
CONFIDENTIAL 39
Subject/Department, Author, MMMM dd, yyyy
Program Counter (r15)
11/15/08
15.11.08
CONFIDENTIAL 40
Subject/Department, Author, MMMM dd, yyyy
ARM and Thumb Interworking
Switch between ARM mode and Thumb mode using BX instruction
– In ARM state: BX<condition> Rn
– In Thumb state: BX Rn
31 1 0
Rn
n: 0-15
ARM / Thumb
BX selection
0: ARM state
31 1 0 1: Thumb state
Destination
address 0
11/15/08
15.11.08
CONFIDENTIAL 41
Subject/Department, Author, MMMM dd, yyyy
So what is better:
Thumb or ARM Mode?
11/15/08
15.11.08
CONFIDENTIAL 42
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 43
Subject/Department, Author, MMMM dd, yyyy
ARM7TDMI-S
11/15/08
15.11.08
CONFIDENTIAL 44
Subject/Department, Author, MMMM dd, yyyy
Instruction Pipeline
11/15/08
15.11.08
CONFIDENTIAL 45
Subject/Department, Author, MMMM dd, yyyy
3-Stage Instruction Pipeline
ARM Thumb
CONFIDENTIAL 46
Subject/Department, Author, MMMM dd, yyyy
Optimal Pipelining
– In this example it takes 6 clock cycles to execute 6 instructions
– All operations are on registers (single cycle instructions)
– Clock cycles per instruction (CPI) = 1
CONFIDENTIAL 47
Subject/Department, Author, MMMM dd, yyyy
LDR Pipeline Example
– In this example it takes 6 clock cycles to execute 4 instructions
– Clock cycles per instruction (CPI) = 1.5
1 2 3 4 5 6 7 8
Cycle
11/15/08
15.11.08
CONFIDENTIAL 48
Subject/Department, Author, MMMM dd, yyyy
Branch Pipeline Example
– Branches break the pipeline
– Example in ARM state
1 2 3 4 5 6 7
11/15/08
15.11.08 Cycle
CONFIDENTIAL 49
Subject/Department, Author, MMMM dd, yyyy
Example ARM Bus System
ROM
8 bit wide RAM
32 bit wide
11/15/08
15.11.08
CONFIDENTIAL 50
Subject/Department, Author, MMMM dd, yyyy
AMBA
11/15/08
15.11.08
CONFIDENTIAL 51
Subject/Department, Author, MMMM dd, yyyy
AHB and APB / VPB
CONFIDENTIAL 52
Subject/Department, Author, MMMM dd, yyyy
Example AMBA System
ARM core
Keypad
UART
High-
bandwidth APB
Memory AHB APB Timer
Bridge
Interface
Display
RTC
High-bandwidth DMA
on-chip RAM Bus Master
I/O
11/15/08
15.11.08
CONFIDENTIAL 53
Subject/Department, Author, MMMM dd, yyyy
Default Usage of Bit Addressable Registers
Benefit
– Unused bits are never written to
Drawback
– No atomic bit clear and set at the same time
11/15/08
15.11.08
CONFIDENTIAL 54
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 55
Subject/Department, Author, MMMM dd, yyyy
The different cores
ARM922T, BlueStreak 266MHz, 16-bit color LCD controller, Industrial, LCD display, hi-end
MMU, touch screen
ARM926EJ-S, LPC3000 208MHz, VFP co-processor, Low power hi-end applications,
Ultra low power options calculation
11/15/08
15.11.08
CONFIDENTIAL 56
Subject/Department, Author, MMMM dd, yyyy
NXP LPC Continuum
LPC1000 LPC2000 LPC2900 LPC3000
EJ- S
NXP’s Cortex M3 based
92 6
LPC1000 range will be M
introduced 2H 2008 AR
Performance, speed, processing power
E -S
M 968 >200 MHz
AR 32KB D-cache, 32KB I-Cache
Up to 256KB RAM
I-S
ARM7TDM 80-100 MHz Vector Floating Point
t ex- M 3
ARM Cor 768 KB Flash Java co-processor
60-72 MHz 80KB RAM MMU
0 to 1MB Flash TCM 3V/1.8V
60-72 MHz
100 KB RAM CAN Low Power 0.9V mode
0-256 KB Flash
LCD controller LIN LCD controller
58 KB RAM
LCD interface PMU Ethernet 10/100
Low power
Ethernet ADCs USB Host/OTG
Ethernet
USB Dev/Host/OTG PWM I2S
USB Device
CAN CAN
I2S I2S
ADC / DAC
11/15/08
15.11.08 PWM
CONFIDENTIAL 57
Subject/Department, Author, MMMM dd, yyyy
NXP Embedded Flash Process Roadmap
Mature product line
low-cost, 3-5V OTP
5V Flash family
Foundry Embedded
LPC900 Family Flash
3V Flash (in development)
ICN8 / ICF / ASMC NXP C90NV /
LPC2000 Family
TSMC eFlash
ARM7S-TDMI-STM TSMC10/12
1.8V Flash
ICN8 / SSMC
LPC3000 Family
ARM926EJTM CMOS65LP
CMOS90LP TSMC10/12
TSMC10/12
CONFIDENTIAL 58
Subject/Department, Author, MMMM dd, yyyy
ARM7-based 32-bit Microcontrollers (1)
Shared system architecture
– 32-bit ARM cores
– E-ICE RTM™ to support real-time debugging
– ETM™ to perform real-time tracing of the code being executed
– Vectored Interrupt Controller (ARM Prime Cell®)
11/15/08
15.11.08
CONFIDENTIAL 59
Subject/Department, Author, MMMM dd, yyyy
ARM7-based 32-bit Microcontrollers (2)
0.18 µm process technology
– Dual supply voltages for lowest power and easy interfacing
• Core (incl. Flash Memory): 1.8V I/Os: 3.3V
– Single supply voltage on LPC213x and LPC214x
– Advanced power management on LPC23xx/LPC24xx and LPC288x (on 0,14
µm)
– Embedded Flash
• In-application programmable
• 2 transistor cell (0.78µm²), also easy implementation of on-chip E²PROM
– improved reliability; further enhanced by error correction
CONFIDENTIAL 60
Subject/Department, Author, MMMM dd, yyyy
ARM7-based 32-bit Microcontrollers (3)
– Timers
• General purpose, watchdog, Capture / Compare, PWM, RTC ...
CONFIDENTIAL 61
Subject/Department, Author, MMMM dd, yyyy
Portfolio
11/15/08
15.11.08
CONFIDENTIAL 62
Subject/Department, Author, MMMM dd, yyyy
First Generation LPC2000 Family (1)
– 2 UARTs (16C550)
– I²C (400kb/s)
11/15/08
15.11.08
CONFIDENTIAL 63
Subject/Department, Author, MMMM dd, yyyy
First Generation LPC2000 Family (2)
Part Pins Flash RAM Ext. I/O A/D SPI CAN
11/15/08
15.11.08
LPC2294 144 256K 16K x 112 8 channels 10-bit 2 4
CONFIDENTIAL 64
Subject/Department, Author, MMMM dd, yyyy
Second Generation LPC2000 Family (1)
LPC210x, LPC213x, LPC214x
11/15/08
15.11.08
CONFIDENTIAL 65
Subject/Department, Author, MMMM dd, yyyy
Second Generation LPC2000 Family (2)
Part Pins Flash RAM I/O A/D DAC USB
11/15/08
15.11.08
CONFIDENTIAL 66
Subject/Department, Author, MMMM dd, yyyy
Third generation LPC2000 family
11/15/08
15.11.08
CONFIDENTIAL 67
Subject/Department, Author, MMMM dd, yyyy
Third generation LPC2000 family
LPC2458 180 512K 98K 160 Ext. Bus 16bit, DAM 1 Host, OTG
LPC2468 208 512K 98K 160 Ext. Bus 32bit, DMA 1 Host, OTG
LPC2478 208 512K 96K 45 LCD Controller, 32bit ext, CAN 1 Host, OTG
11/15/08
15.11.08
CONFIDENTIAL 68
Subject/Department, Author, MMMM dd, yyyy
Third generation LPC2000 family
11/15/08
15.11.08
CONFIDENTIAL 69
Subject/Department, Author, MMMM dd, yyyy
LPC247x Color LCD Controller
http://www.standardics.nxp.com/products/lpc2000/lpc24xx/
11/15/08
15.11.08
CONFIDENTIAL 70
Subject/Department, Author, MMMM dd, yyyy
LCD controller performance
The LCD controller is connected to the AHB1 bus, so it processes Frame data
independently of the Ethernet (AHB2 bus) and Flash (Local bus)
Example bandwidth calculations
– For 320 x 240 display: 76,800 pixels per frame ((x-bits x 76,800)/8 = # bytes/frame)
– 4-bits per pixel: 38.4 Kbytes per frame
– 8-bits per pixel: 76.8 Kbytes per frame
– 12-bits per pixel: 115.2 Kbytes per frame
– 16-bits per pixel: 153.6 Kbytes per frame
LCD refresh rate is 70 Hz = 14.3 ms per frame.
For 16-bits/pixel - 153.6 Kbytes/ 14.28 ms = 10.76 Mbytes/sec
– An AHB1 transfer requires 2 clocks to transfer 4 bytes (one 32-bit word)
– For a 60 MHz clock => 120 MBytes per second.
So 16-bits/pixel requires:
– 10.76 MBytes/sec divided by 120 MBytes/sec =
– ONLY 9% of the AHB1 bandwidth
11/15/08
15.11.08
CONFIDENTIAL 71
Subject/Department, Author, MMMM dd, yyyy
LPC2104/5/6 Blocks 48 pins
SRAM FLASH
128k
TRST
16/32/64k
TMS
TDO
TCK
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 32x
PWM1 - 6
MAT0.0-2
MAT1.0-3
CAP0.0-2
CAP1.0-3
RX 0,1..
TX 0,1..
Inputs
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MOSI
MISO
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 72
Subject/Department, Author, MMMM dd, yyyy
LPC2114/24 Blocks 64 pins
SRAM FLASH
128/256k
TRST
16k
TMS
TDO
TCK
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 46x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP0.0-3
CAP1.0-3
4 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MOSI
MISO
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 73
Subject/Department, Author, MMMM dd, yyyy
LPC2119/29 Blocks 64 pins
SRAM FLASH
128/256k
TRST
16k
TMS
TCK
TDO
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 32x 2x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP0.0-3
CAP1.0-3
4 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MISO
MOSI
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 74
Subject/Department, Author, MMMM dd, yyyy
LPC2210 Blocks 144 pins
SRAM FLASH
TRST
16k
TMS
TCK
TDO
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 76x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP0.0-3
CAP1.0-3
8 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MISO
MOSI
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 75
Subject/Department, Author, MMMM dd, yyyy
LPC2212/14 Blocks 144 pins
SRAM FLASH
128/256k
TRST
16k
TMS
TCK
TDO
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 112x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP0.0-3
CAP1.0-3
8 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MISO
MOSI
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 76
Subject/Department, Author, MMMM dd, yyyy
LPC2290 Blocks 144 pins
SRAM FLASH
TRST
16k
TMS
TCK
TDO
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 76x 2x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP0.0-3
CAP1.0-3
8 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MISO
MOSI
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 77
Subject/Department, Author, MMMM dd, yyyy
LPC2292/94 Blocks 144 pins
-40 to +125°C
SRAM FLASH
256k
TRST
16k
TMS
TDO
TCK
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 112x 2/4x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP0.0-3
CAP1.0-3
8 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MOSI
MISO
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 78
Subject/Department, Author, MMMM dd, yyyy
LPC2138 Block Diagram Package: LQFP64/HVQFN64
RST
Vdd
32KB 512 KB
TRST
Vss
TMS
TDO
TCK
X1
X2
TDI
SRAM FLASH
System
Test/Debug Trace PLL
Functions
SRAM Memory
ARM 7TDMI-S BrownOutDetect
Controller Accelerator System Clock
PowerOnReset
Local Bus and AHB
2x I2C SPI Port SSP Port UART0 UART1 ADC0/1 DAC GPIO Timer0 Timer1 PWM
MAT0.0-2
PWM1 - 6
MAT1.0-3
CAP1.0-3
CAP0.0-2
1-10-bit
2 pins
2x8 pins
8 pins
SSEL
SSEL
MOSI
MOSI
SDA
MISO
MISO
SCK
SCL
GPIO
SCK
11/15/08
15.11.08
CONFIDENTIAL 79
Subject/Department, Author, MMMM dd, yyyy
LPC2142/44/46/48 Block Diagram 64-pin LQFP
RST
Vdd
16-32KB 64-512 KB
TRST
Vss
TMS
TDO
TCK
X1
X2
TDI
SRAM FLASH
System Clock PLL1 System
Test/Debug ETM
PLL2 Functions
USB Clock
SRAM Memory
ARM 7TDMI-S BrownOutDetect
Controller Accelerator VIC PowerOnReset
Local Bus AMBA AHB Bus
D+
AHB to 8 KB SRAM USB 2.0 Full D-
32 kHz shared w/ DMA
Real Time Watchdog VPB Speed Device Up_LED OR
(LPC2148 only) Connect
Vbat
Clock Timer Bridge w/ DMA Vbus
I2C 0/1 SPI Port SSP Port UART0/1 ADC 0/1 DAC Fast I/O Timer0/1 PWM
PWM1 - 6
Tx/RX 0,1
MAT x 8
CAP x 8
1-10-bit
6+8 pins
pins (6)
Modem
GPIO
46 max
SSEL
SSEL
MISO
MOSI
MISO
MOSI
SDA
SCK
SCL
SCK
11/15/08
15.11.08
CONFIDENTIAL 80
Subject/Department, Author, MMMM dd, yyyy
LPC2220 Blocks 144 pins
SRAM FLASH
TRST
64k
TMS
TDO
TCK
TDI
Vectored
SRAM Internal Flash External Static Memory Interrupt
Controller Controller E-ICE ETM Controller (ESMC) Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1
X2 PLL AHB to VPB
75MHz
Real Time Watchdog Bridge
Clock Timer
DAC ADC
GPIO CAN I2C SPI UART0 UART1 Timer0 Timer1 PWM
10-bits 10-bits 76x 2x
PWM1 - 6
MAT0.0-3
MAT1.0-3
CAP1.0-3
CAP0.0-3
8 Inputs
RX 0,1..
TX 0,1..
AOUT
AVDD
AVSS
VssA
2 pins
8 pins
SSEL
SCK
MOSI
MISO
GPIO
V3A
Vref
SDA
SCL
11/15/08
15.11.08
CONFIDENTIAL 81
Subject/Department, Author, MMMM dd, yyyy
LPC2101/2/3 Blocks 48 pins
2/4/8Kb 8/16/32Kb
FLASH
SRAM
Fast GPIO
Bootloader,
TRST
RealMonitor
TMS
TCK
TDO
TDI
Vectored
SRAM Internal Flash Fast Interrupt
Controller Controller GPIO E-ICE ETM Controller
Local Bus
AHB Bus
ARM 7TDMI-S
ARM Local Bus AHB Bus
RST System
Functions
X1 AHB to VPB
X2 PLL 70MHz Bridge
Real Time Watchdog
Vbatt
Clock Timer
RTCX1
RTC
RTCX2
Osc
VLSI Peripheral Bus (VPB)
3 x MAT0
4 x MAT3
4 x MAT1
3 x MAT2
3 x CAP0
4 x CAP1
3 x CAP2
8 Inputs
GPIO
2 pins
8 pins
AVDD
AVSS
SSEL
SSEL
MOSI
MISO
MISO
MOSI
SDA
SCL
SCK
SCK
11/15/08
15.11.08
CONFIDENTIAL 82
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 83
Subject/Department, Author, MMMM dd, yyyy
LPC2000 Development Tools
Available from traditional 8-bit tool providers as well as established 32-bit providers
Evaluation
Boards
Compilers,
LPC2000 RTOS
IDEs
Emulators
11/15/08
15.11.08
CONFIDENTIAL 84
Subject/Department, Author, MMMM dd, yyyy
IAR KS214x Плата разработки
ЖК интерфейс
RS232 порт для UART
Кнопки для внешних прерываний
SD card интерфейс для USB и SPI
Цена € 125.00
11/15/08
15.11.08
CONFIDENTIAL 85
Subject/Department, Author, MMMM dd, yyyy
Keil MCB2103 для LPC2103 и
LPC2103
Цена: $149 ($299 с ULINK)
11/15/08
15.11.08
http://www.keil.com/mcb2103/
CONFIDENTIAL 86
Subject/Department, Author, MMMM dd, yyyy
Keil MCB2130 для LPC213x серии
http://www.keil.com/mcb2130/
11/15/08
15.11.08
CONFIDENTIAL 87
Subject/Department, Author, MMMM dd, yyyy
Keil MCB2140 плата разработки
LPC2148 микроконтроллер
2x 9-pin D-type RS-232
8 LED статуса
Динамик на выходе ЦАП
Потенциометр на входе АЦП
SD Card интерфейс
Драйвера USB для Windows
Цена € 125.00
11/15/08
15.11.08
CONFIDENTIAL 88
Subject/Department, Author, MMMM dd, yyyy
Ashling ASK-2000 для LPC210x, LPC211x,
LPC212x, LPC22xx
11/15/08
15.11.08 LPC213x/4x QuickStart Board 10M Ethernet LPC2138 QuickStart Board
http://www.embeddedartists.com/ CONFIDENTIAL 90
Subject/Department, Author, MMMM dd, yyyy
JTAG интерфейс
11/15/08
15.11.08
CONFIDENTIAL 91
Subject/Department, Author, MMMM dd, yyyy
Интегрированные среды разработки
CONFIDENTIAL 92
Subject/Department, Author, MMMM dd, yyyy
Компиляторы
ARM Compiler
http://www.arm.com/devtools/soft_dev_tools?OpenDocum
.
GHS Compiler
http://www.ghs.com/products/arm_development.html
IAR Compiler
http://www.iar.com/Products/?name=EWARM
GNU GCC
11/15/08
15.11.08
CONFIDENTIAL 93
Subject/Department, Author, MMMM dd, yyyy
Поддержка ОСРВ
Embedded Linux
Nucleus from
Accelerated Technology
a Mentor company
ChronOS™
from InterNiche
11/15/08
15.11.08
CONFIDENTIAL 94
Subject/Department, Author, MMMM dd, yyyy
Application notes available on the web
http://standardics.nxp.com/support
11/15/08
15.11.08
CONFIDENTIAL 95
Subject/Department, Author, MMMM dd, yyyy
Sample software availables on the web
http://www.standardics.nxp.com/support/documents/
?type=software
11/15/08
15.11.08
CONFIDENTIAL 96
Subject/Department, Author, MMMM dd, yyyy
40 New
Members last
week
MEMBERS
3645
11/15/08
15.11.08
CONFIDENTIAL 97
Subject/Department, Author, MMMM dd, yyyy
Russian language tech.support
(from February 2008)
AR
M.
su
pp
or
t. NX
P@
gm
ail
.c om
11/15/08
15.11.08
CONFIDENTIAL 98
Subject/Department, Author, MMMM dd, yyyy
www.standardics.nxp.com
http://ru.nxp.com
www.electronix.ru
www.keil.com
www.embeddedartists.com
11/15/08
15.11.08
CONFIDENTIAL 99
Subject/Department, Author, MMMM dd, yyyy
1. ARM - The Company
2. Architecture
3. Instruction Set
4. ARM7TDMI-S
5. NXP Implementation
6. Tools
7. ARM9 / LPC3000
11/15/08
15.11.08
CONFIDENTIAL 100
Subject/Department, Author, MMMM dd, yyyy
ARM Core Applications
11/15/08
15.11.08
CONFIDENTIAL 101
Subject/Department, Author, MMMM dd, yyyy
Pipeline-Changes for ARM9TDMI
ARM7TDMI
Fetch Decode Execute
ARM decode
Thumb→ARM Reg. Reg.
Instruction Fetch Shift ALU
decompress read write
Reg. select
CPI:
∼1.9
ARM9TDMI
Fetch Decode Execute Memory Writeback
ARM or Thumb
instruction decode Memory Reg.
Instruction Fetch Shift + ALU
Reg. Reg. access write
decode read
CPI:
∼1.5
11/15/08
15.11.08
CONFIDENTIAL 102
Subject/Department, Author, MMMM dd, yyyy
ARM Technology Roadmap
H Cortex-A8 2000+ MIPS Uni-Proc
CONFIDENTIAL 103
Subject/Department, Author, MMMM dd, yyyy
LPC3000 Overview
LPC3000 Overview
90nm Process
200 MHz Core
1.2V core operation
0.9V ultra low-power mode
3.3V I/O
32KB I- & D- caches
64KB SRAM
Standard E-ICE
JTAG Interface
6KB Emb. Trace
320-pin TFBGA package
11/15/08
15.11.08
CONFIDENTIAL 104
Subject/Department, Author, MMMM dd, yyyy
Data and Instruction Caches
11/15/08
15.11.08
CONFIDENTIAL 105
Subject/Department, Author, MMMM dd, yyyy
HighComputational
PerformancePower
Bus Matrix
Simultaneous accesses allowed, for example:
11/15/08
15.11.08
CONFIDENTIAL 106
Subject/Department, Author, MMMM dd, yyyy
US B
VFP9 ETB ETM9
Bus Matrix
transceiver
High Performance Bus
interface
D-TCM I-TCM
0 kB
D-cache
ARM
9EJS
0 kB
I-cache
Matrix
32 kB 32 kB DMA Ctrl US B-OTG
D-side I-side PL080 AHB
MMU
controller controller Master
M M
Data Instr
0 1 GX175
Master Layer 0 1 2 3 32 bit, S DRAM
104 MHz Ctrl 32 bit wide
AHB external
Port 2
S lave port 0 memory
Port 3
S lave port 1 Port 4
S lave port 2 Port 0
S lave port 3
SRAM ROM
64 kB 16 kB
AHB slaves AHB- APB slaves
S lave port 5 2-APB
NAND MLC SPI SD
Ctrl NAND Ctrl x2 Card
AHB slaves
S lave port 6
DMA USB SDRAM ETB
regs config confg regs
CONFIDENTIAL 107
Subject/Department, Author, MMMM dd, yyyy
MMU and Cache Interaction
Portfolio 32-bit microcontrollers, >100MHz
MMU RAM LCD Touch USB Ethernet DMA VFP 0.9V Ultra
screen Low Power
LPC3180 X 64KB Host/OTG X X X
LPC3180/01 X 64KB Host/OTG X X X
LPC3190 X 64KB Host/OTG X X X
LPC3220 X 128KB Host/OTG X X X
LPC3230 X 256KB X Host/OTG X X X
LPC3240 X 256KB Host/OTG X X X X
LPC3250 X 256KB X Host/OTG X X X X
released
roadmap for 2008
11/15/08
15.11.08
CONFIDENTIAL 108
Subject/Department, Author, MMMM dd, yyyy
Phytec LPC3000 Development board
• LPC3180 on board
• VFP coprocessor
• NAND Flash 32Mb
• SDRAM 32Mb
• 32 Kb EEPROM
• USB OTG
• 208MHz
•Price: $250
11/15/08
15.11.08
11/15/08
15.11.08
CONFIDENTIAL 110
Subject/Department, Author, MMMM dd, yyyy
NXP LPC2000 Family
11/15/08
15.11.08
CONFIDENTIAL 112
Subject/Department, Author, MMMM dd, yyyy
Memory Map
4.0 GB 0xFFFF FFFF Memory blocks not
AHB Peripherals
0xF000 0000 drawn to scale!
3.75 GB
VPB Peripherals 0xEFFF FFFF
3.5 GB 0xE000 0000
0xC000 0000
3.0 GB Reserved for External Memory
7FFF 32KB
**: m Flash
3 256KB
CONFIDENTIAL 113
Subject/Department, Author, MMMM dd, yyyy
Flash Memory
LPC213X
Organization 512k
12K Boot Block 0x07 FFFF
0x07 CFFF
scale
Sector 26 4K
n ot to …
c
G raphi Sector 22 4k
Sector 21 32K
…
LPC2100, 256k Sector 15 32k
256k 0x03 FFFF
8K Boot Block 0x03 FFFF Sector 14 32K
Sector 16 8K …
LPC2100, 128k
… Sector 11 32k
8K Boot Block 0x01 FFFF Sector 10 8k 128k 0x01 FFFF
Sector 10 32K
Sector 14 8K Sector 9 64K
Sector 9 32K
Sector 13 8K Sector 8 64K 64k 0x00 FFFF
Sector 12 8K Sector 8 32K
Sector 7 8K 32k
… … 0x00 7FFF
Sector 7 4K
Sector 2 8k Sector 2 8k ...
Sector 1 8K Sector 1 8K Sector 1 4K
Sector 0 8K Sector 0 8K Sector 0 4K
0x0 0x0 0x0
11/15/08
15.11.08
CONFIDENTIAL 114
Subject/Department, Author, MMMM dd, yyyy
Flash Memory IAP Programming
11/15/08
15.11.08
CONFIDENTIAL 115
Subject/Department, Author, MMMM dd, yyyy
SRAM: 8, 16, 32 or 64 KB
0x4000FFFF
Hands-On
Hands-On
11/15/08
15.11.08
CONFIDENTIAL 117
Subject/Department, Author, MMMM dd, yyyy
System Control
11/15/08
15.11.08
CONFIDENTIAL 118
Subject/Department, Author, MMMM dd, yyyy
Power Control (1)
...
11/15/08
15.11.08
CONFIDENTIAL 120
Subject/Department, Author, MMMM dd, yyyy
Power Control (3)
PCONP 16
11/15/08
15.11.08 PCCAN4 Enable CAN Controller 4
CAN peripheral
typically below 2mA
CONFIDENTIAL 121
Subject/Department, Author, MMMM dd, yyyy
Boot Block
The uppermost Flash sector contains the Boot Loader
– controls physical interface for programming and erasing the Flash
– supports ISP mode for initial programming of customer code
– supports In-Application Programming in a running system under the control of customer
software
– buffers an entire Flash line (512 bytes) at once to keep programming time to a minimum
11/15/08
15.11.08
CONFIDENTIAL 122
Subject/Department, Author, MMMM dd, yyyy
Exception Vectors
Vector Table
.
.
.
0x1C FIQ
0x18 IRQ
Valid user program key:
0x14 (Reserved) Must contain a value that
Data Abort ensures that the checksum of
0x10
all vectors is zero
0x0C Prefetch Abort
0x08 Software Interrupt
0x04 Undefined Instruction
11/15/08 0x00
15.11.08 Reset
CONFIDENTIAL 123
Subject/Department, Author, MMMM dd, yyyy
Memory Mapping Control (1)
11/15/08
15.11.08
CONFIDENTIAL 124
Subject/Department, Author, MMMM dd, yyyy
Memory Mapping Control (2)
• Boot Loader
– Always executed after reset. Exception Vectors re-mapped from Boot Block
• User RAM
– Exception Vectors are re-mapped from RAM
0x4000 0000
Boot Loader
CONFIDENTIAL 125
Subject/Department, Author, MMMM dd, yyyy
Memory Mapping Control (3)
Re-mapping of Boot Block
– mapped from top of Flash to top of on-chip memory space
2.0 GB
Boot Loader
CONFIDENTIAL 126
Subject/Department, Author, MMMM dd, yyyy
Memory Mapping Overview
4.0 GB
AHB Peripherals 0xFFFF FFFF
VPB Peripherals
2.0 GB
Boot Block (re-mapped from On-Chip Flash) 0x7FFF FFFF
Exception Vector
re-mapping Reserved for On-Chip Memory
CONFIDENTIAL 127
Subject/Department, Author, MMMM dd, yyyy
Memory Mapping Control Register
11/15/08
15.11.08
CONFIDENTIAL 128
Subject/Department, Author, MMMM dd, yyyy
Phase Locked Loop (LPC21xx/22xx)
11/15/08
15.11.08
CONFIDENTIAL 129
Subject/Department, Author, MMMM dd, yyyy
Memory Addressing
System Control Block
Memory Accelerator Module (MAM)
General Purpose I/O
Pin Connect Block / External Memory Controller
• Integrated Peripherals
Timer 0 / Timer 1, PWM, RTC, Watchdog, ADC
• Vectored Interrupt Controller
• Serial Communication Interfaces
UART 0 / UART 1, I²C, SPI, CAN
11/15/08
15.11.08
CONFIDENTIAL 130
Subject/Department, Author, MMMM dd, yyyy
On-chip Memory with 0-wait States
ARM7TDMI-S is a 1-clock core
– CPI of ~1.9, but many instructions execute in 1 cycle
– CPU requires one instruction per clock cycle
11/15/08
15.11.08
CONFIDENTIAL 131
Subject/Department, Author, MMMM dd, yyyy
On-chip RAM and FLASH
11/15/08
15.11.08
CONFIDENTIAL 132
Subject/Department, Author, MMMM dd, yyyy
Memory Accelerator Module
Address Bus
ARM7
Bus Interface
Core
Flash Memory Flash Memory
Bank 1 Bank 2
Data Buffer
Selection
CONFIDENTIAL 133
Subject/Department, Author, MMMM dd, yyyy
Power Consumption and MAM
Enabling the MAM for low-clock applications does not bring a performance gain
11/15/08
15.11.08
CONFIDENTIAL 134
Subject/Department, Author, MMMM dd, yyyy
Memory Addressing
System Control Block
Memory Accelerator Module (MAM)
General Purpose I/O Hands-On
Pin Connect Block / External Memory Controller
• Integrated Peripherals
Timer 0 / Timer 1, PWM, RTC, Watchdog, ADC
• Vectored Interrupt Controller
• Serial Communication Interfaces
UART 0 / UART 1, I²C, SPI, USB, CAN
11/15/08
15.11.08
CONFIDENTIAL 135
Subject/Department, Author, MMMM dd, yyyy
General Purpose I/O (1)
11/15/08
15.11.08
CONFIDENTIAL 136
Subject/Department, Author, MMMM dd, yyyy
General Purpose I/O (2)
11/15/08
15.11.08
CONFIDENTIAL 137
Subject/Department, Author, MMMM dd, yyyy
General Purpose I/O (3)
Register
IOPIN The current state of the port pins is read from this register
IOSET Writing "1" sets pins high, writing "0" has no effect
IOCLR Writing "1" sets pins low and clears corresponding bits in IOSET
11/15/08
15.11.08
CONFIDENTIAL 138
Subject/Department, Author, MMMM dd, yyyy
Conventional GPIO
Implementation Drawbacks
Toggling speed of the GPIO is limited due to the 3-stage pipeline, AHB bridge
and the APB bus
11/15/08
15.11.08
CONFIDENTIAL 139
Subject/Department, Author, MMMM dd, yyyy
Understanding the slow port behavior
11/15/08
15.11.08
When cpu_clken_I is low indicates core is stalled
CONFIDENTIAL 140
Subject/Department, Author, MMMM dd, yyyy
Block diagram of new port configuration
11/15/08
15.11.08
CONFIDENTIAL 141
Subject/Department, Author, MMMM dd, yyyy 10
Improving Speed
GPIO registers are now interfaced directly to the ARM7 Local bus
Ports can now toggle every 2 clocks giving a clock period of cclk/4= 15Mhz
11/15/08
15.11.08
CONFIDENTIAL 142
Subject/Department, Author, MMMM dd, yyyy 9
Results of change (speed of writes)
Port output
CONFIDENTIAL 143
Subject/Department, Author, MMMM dd, yyyy 6
Fast GPIO
Special features
– GPIO registers accessed via ARM local bus in addition to conventional peripheral bus access
– Mask registers allow treating sets of port pins as a group, leaving other bits unchanged
– Local bus GPIO registers are now byte addressable
– Entire port value can be written in one instruction using the IOPIN register
11/15/08
15.11.08
CONFIDENTIAL 144
Subject/Department, Author, MMMM dd, yyyy
Mask Register- Advantages
Provides the capability to the user to separate the GPIO pins into groups
11/15/08
15.11.08
CONFIDENTIAL 145
Subject/Department, Author, MMMM dd, yyyy
Pin Connect Block (1)
PINSEL0/1/2
GPIO
UART
PIN
Timer/Counter
reserved
11/15/08
15.11.08
CONFIDENTIAL 146
Subject/Department, Author, MMMM dd, yyyy
Pin Connect Block (2)
11/15/08
15.11.08
CONFIDENTIAL 147
Subject/Department, Author, MMMM dd, yyyy
Pin Connect Block (3)
Example:
11/15/08
15.11.08
CONFIDENTIAL 148
Subject/Department, Author, MMMM dd, yyyy
Pulse Width Modulator
11/15/08
15.11.08
CONFIDENTIAL 149
Subject/Department, Author, MMMM dd, yyyy
Single-Edge Controlled PWM
PWM outputs all go high at the beginning of each cycle and go low on a Match
PWMx
PWMy
PWMz
11/15/08
15.11.08
CONFIDENTIAL 150
Subject/Department, Author, MMMM dd, yyyy
Double-Edge Controlled PWM
Double edge controlled PWM outputs can have either edge occur at any
position within a cycle
PWM4
PWM5 (single-edge)
11/15/08
15.11.08
CONFIDENTIAL 151
Subject/Department, Author, MMMM dd, yyyy
PWM Diagram and Registers
Match Register 0
= R EN Enable
Interrupt S Q PWM2
= R EN Enable
32-bit Pre-Scaler
S Q PWM6
Enable
= R EN
PCLK
11/15/08
15.11.08
CONFIDENTIAL 152
Subject/Department, Author, MMMM dd, yyyy
Real Time Clock (1)
11/15/08
15.11.08
CONFIDENTIAL 153
Subject/Department, Author, MMMM dd, yyyy
Real Time Clock (2)
PCLK
Clock Divider
(prescaler)
Time Alarm
Comparators
Counters Registers
Clock
11/15/08
15.11.08
CONFIDENTIAL 154
Subject/Department, Author, MMMM dd, yyyy
(Mis-)Using the RTC clock for a regular timer
Changing the value for the prescaler and clock divider could produce faster
interrupts
– NOTE: Renders other RTC values inusable
11/15/08
15.11.08
CONFIDENTIAL 155
Subject/Department, Author, MMMM dd, yyyy
Watchdog Timer (1)
Once activated, the Watchdog will reset the entire chip if it is not fed regularly
Feed is accomplished by a specific sequence of data writes
Watchdog flag allows software to tell that a watchdog reset has occurred
Selectable overflow time (µs ... minutes)
Debug Mode generates an interrupt instead of a reset
Secure: watchdog cannot be turned off once it is enabled
Watchdog Timer value can be read in one cycle
11/15/08
15.11.08
CONFIDENTIAL 156
Subject/Department, Author, MMMM dd, yyyy
Watchdog Timer (2)
Watchdog Timer
WDFEED Constant
UNDERFLOW
Current Timer Count
(WDTC)
11/15/08
15.11.08 Sticky bits! RESET
(cleared by WDT underflow or
ext. reset) INTERRUPT
CONFIDENTIAL 157
Subject/Department, Author, MMMM dd, yyyy
Hands-On Index Hands-On
0. Tools Setup / New project
1. MAM / PLL
2. GPIO
3. PWM
4. SPI
5. ADC / UART
6. USB
11/15/08
15.11.08
CONFIDENTIAL 158
Subject/Department, Author, MMMM dd, yyyy
Start Keil uVision3
Hands-On
Menu Selection:
Project /
New Project
Select
HANDS_ON_2
Select readme.txt
11/15/08
15.11.08
CONFIDENTIAL 159
Subject/Department, Author, MMMM dd, yyyy
MAM and PLL setup Hands-On
Explanation of MAM Register values
–“Partially Enable”:
Open project 01_MAM_PLL.
Code fetches only
Run it and notify LEDs blinking –“Fully enable”:
speed: Code and data fetches
–MAM Timing
Number of clock cycles used for one
flash memory access
11/15/08
15.11.08
CONFIDENTIAL 160
Subject/Department, Author, MMMM dd, yyyy
MAM and PLL setup Hands-On
S tep
3.
S tep
1.
S tep
2.
CONFIDENTIAL 161
Subject/Department, Author, MMMM dd, yyyy
MAM and PLL setup Hands-On
Solution
11/15/08
15.11.08
CONFIDENTIAL 162
Subject/Department, Author, MMMM dd, yyyy
GPIO Exercise Hands-On
11/15/08
15.11.08
CONFIDENTIAL 163
Subject/Department, Author, MMMM dd, yyyy
GPIO Exercise Hands-On
Solution
11/15/08
15.11.08
CONFIDENTIAL 164
Subject/Department, Author, MMMM dd, yyyy
PWM Exercise Hands-On
Open project 03_PWM.
Run it.
11/15/08
15.11.08
CONFIDENTIAL 165
Subject/Department, Author, MMMM dd, yyyy
PWM Exercise - solution Hands-On
InitPWM ():
PWMMR0 = 0x000FFFFF;→PWMMR0 = 0x00000FFF;.
11/15/08
15.11.08
CONFIDENTIAL 166
Subject/Department, Author, MMMM dd, yyyy
PWM Exercise - solution Hands-On
EnableMotor ():
maxSpeed = PWMMR0 / 2; →maxSpeed = PWMMR0;
11/15/08
15.11.08
CONFIDENTIAL 167
Subject/Department, Author, MMMM dd, yyyy
A/D Converter
Features
– 10 bit successive approximation analog to digital converter
– Multiplexed inputs
• 4 pins (64-pin devices)
• 8 pins (144-pin devices)
– Power down mode
– Measurement range 0V ... 3V
– Minimum 10 bit conversion time: 2.44 µS
– Burst conversion mode for single or multiple inputs
– Optional conversion on transition on input pin or Timer Match signal
– Programmable divider to generate required 4.5MHz from VPB clock
11/15/08
15.11.08
CONFIDENTIAL 168
Subject/Department, Author, MMMM dd, yyyy
A/D Converter – Burst mode
CLKS: bit 17, 18, 19 of ADCR select the number of clocks used per conversion and
the accuracy
– 000b: 11 clocks, 10 bits
– 001b: 10 clocks, 9 bits
– 010b: 9 clocks, 8 bits
– 011b: 8 clocks, 7 bits
– …
– 111b: 4 clocks, 3 bits
11/15/08
15.11.08
CONFIDENTIAL 169
Subject/Department, Author, MMMM dd, yyyy
ADC LPC213X, LPC214X
Measurement range of 0 V to 3 V
– Separate voltage pins for analogue 3V supply (V3A) and analogue ground (VSSA)
11/15/08
15.11.08
CONFIDENTIAL 170
Subject/Department, Author, MMMM dd, yyyy
ADC – Software Controlled Mode
ADC Inputs
7 6 5 4 3 2 1 0
ADDR0
ADDR1
Select Single Channel 10-bit ADC
ADCR (7:0) (11 Clocks/Conv)
11/15/08
15.11.08 ADDR7
V3A VSSA
CONFIDENTIAL 171
Subject/Department, Author, MMMM dd, yyyy
ADC – Burst Mode
ADC Inputs
ADC Clock
(CLKS Bits)
11/15/08
15.11.08
ADDR0 ADDR1 ADDR7
CONFIDENTIAL 172
Subject/Department, Author, MMMM dd, yyyy
LPC213x DAC
11/15/08
15.11.08
CONFIDENTIAL 173
Subject/Department, Author, MMMM dd, yyyy
• Memory Addressing
• System Control Block
• Memory Accelerator Module (MAM)
• General Purpose I/O Hands-On
Pin Connect Block / External Memory Controller
• Integrated Peripherals
Timer 0 / Timer 1, PWM, RTC, Watchdog, ADC
Hands-On
11/15/08
15.11.08
CONFIDENTIAL 174
Subject/Department, Author, MMMM dd, yyyy
Vectored Interrupt Controller (1)
ARM PrimeCell™
32 interrupt request inputs
16 IRQ interrupts can be auto-vectored
– Single instruction vectoring to ISR
– Dynamic software priority assignment
16 non-vectored interrupts
Software interrupts
11/15/08
15.11.08
CONFIDENTIAL 175
Subject/Department, Author, MMMM dd, yyyy
Vectored Interrupt Controller (2)
FIQStatus
Interrupt Source FIQ
FIQ
IntEnableClear
RawInterrupt
32
IntEnable
High Prio
OR VectorCntl
SoftIntClear
En Channel VICVectorAddr 0
SoftInt
IRQStatus 5 0:4
IRQ
...
16 Prioritized
32
11/15/08
15.11.08 Low Prio
CONFIDENTIAL 176
Subject/Department, Author, MMMM dd, yyyy
VIC - Vectored Interrupts
Interrupt source
linked to vector 4
PC
VICVectAddr ISR
11/15/08
15.11.08
CONFIDENTIAL 177
Subject/Department, Author, MMMM dd, yyyy
VIC - Non-Vectored Interrupts
Interrupt
ISR
VICDefVectAddr
ISR
ISR
PC
CODE
ISR
VICVectAddr
ISR
ISR
11/15/08
15.11.08
Load PC with Common
Vector Address
CONFIDENTIAL 178
Subject/Department, Author, MMMM dd, yyyy
VIC - FIQ Interrupt
FIQs have higher priority than IRQs
– Serviced first
– FIQs disable IRQs
• FIQ Vector is last in vector table (allows handler to be run sequentially from that address)
• FIQ mode has 5 extra banked registers, r8-12 (interrupt handlers must always preserve
non-banked registers)
11/15/08
15.11.08
CONFIDENTIAL 179
Subject/Department, Author, MMMM dd, yyyy
Block Flag(s) VIC IR Source #
VIC
WDT Watchdog Interrupt (WDINT) 0
ARM Core
Embedded ICE, DbgCommRx
- reserved 11
11/15/08
15.11.08 System Control External Interrupt 1 (EINT1) 15
CONFIDENTIAL 180
Subject/Department, Author, MMMM dd, yyyy
Block Flag(s) VIC IR Source #
VIC
System Control External Interrupt 3 (EINT3) 17
IR Sources CAN
CAN
CAN Error
CAN 1 Transmit
19
20
290/92
CAN CAN 4 Receive 29
LPC2294
plus more flags for UART0, Timer1,
Capture 0 - 3 (CR0, CR1, CR2, CR3)
11/15/08
15.11.08
CONFIDENTIAL 181
Subject/Department, Author, MMMM dd, yyyy
VIC Interrupt Latency
Some instructions take multiple cycles to execute and cannot be interrupted
– The longest STM and LDM instructions take 20 cycles
– Subsets can be reduced to 7 cycles
FIQ:
12 (25) cycles, 200ns (416ns) @ 60MHz
First Vectored IRQ (assuming no FIQ pending):
26 (39) cycles, 433ns (650ns) @ 60MHz
Default IRQ Vector (assuming no other IRQ pending):
42 (55) cycles, 700ns (916ns) @ 60MHz
11/15/08
15.11.08
CONFIDENTIAL 182
Subject/Department, Author, MMMM dd, yyyy
Interrupt Prioritizing with Nesting
11/15/08
15.11.08
CONFIDENTIAL 183
Subject/Department, Author, MMMM dd, yyyy
Interrupt Prioritizing with RTOS
Prioritizing is handled by
Real-Time Operating System
11/15/08
15.11.08
CONFIDENTIAL 184
Subject/Department, Author, MMMM dd, yyyy
Caution: Spurious Interrupts
11/15/08
15.11.08
CONFIDENTIAL 185
Subject/Department, Author, MMMM dd, yyyy
Serial Communication Interfaces
UARTs
I2C
SPI
10100101
CAN
10110110
01111000
001
USB* 00
10 000
11
01
01
0
1010010110110110
11/15/08
15.11.08
CONFIDENTIAL 186
Subject/Department, Author, MMMM dd, yyyy
UART
UART 0, UART 1
– 16 byte Receive and Transmit FIFOs
– PC UART 16C550 “look-alike”
– Built-in baud rate generator
– Supports 6 modem control signals
• CTS, RTS, DCD, DSR, DTR and RI functions are selectable
• Note:
UART 0 has Tx and Rx pins only
11/15/08
15.11.08
CONFIDENTIAL 187
Subject/Department, Author, MMMM dd, yyyy
I2C Bus
11/15/08
15.11.08
CONFIDENTIAL 188
Subject/Department, Author, MMMM dd, yyyy
SPI Bus
11/15/08
15.11.08
CONFIDENTIAL 189
Subject/Department, Author, MMMM dd, yyyy
USB 2.0
Since USB is a standard doesn’t that make all microcontrollers with USB the
same?
NO!!
11/15/08
15.11.08
CONFIDENTIAL 190
Subject/Department, Author, MMMM dd, yyyy
LPC2148 key high performance
USB features
11/15/08
15.11.08
CONFIDENTIAL 191
Subject/Department, Author, MMMM dd, yyyy
USB 2.0 in LPC2148
11/15/08
15.11.08
CONFIDENTIAL 192
Subject/Department, Author, MMMM dd, yyyy
USB 2.0 in LPC2148
Remote wakeup
11/15/08
15.11.08
CONFIDENTIAL 193
Subject/Department, Author, MMMM dd, yyyy
LPC2148 USB Block Diagram
AHB Bus
8K AHB
Memory Using the DMA, the
USB Logic has direct
DMA access to memory
Engine
VPB Bus
ATX
USB Logic PADS
Force SE0 D+
TX D
OE D-
Endpoint ram Serial Interface Engine
Register access control (SIE)
Interface
RX D
2K FIFO Receivers
11/15/08
15.11.08
CONFIDENTIAL 194
Subject/Department, Author, MMMM dd, yyyy
Transfer Modes
11/15/08
15.11.08
CONFIDENTIAL 195
Subject/Department, Author, MMMM dd, yyyy
Slave Mode Transfer
11/15/08
15.11.08
CONFIDENTIAL 196
Subject/Department, Author, MMMM dd, yyyy
DMA Mode Transfer
Will transfer data directly from the 8K SRAM to the EP_RAM and vice
versa.
11/15/08
15.11.08
CONFIDENTIAL 197
Subject/Department, Author, MMMM dd, yyyy
SoftConnect™ and GoodLink™ LED
SoftConnect™
– Can connect/re-connect to the host through software
– No need to unplug and plug the cable back again
GoodLink™ LED
– Needs a shared GPIO pin
– Shows indication on a LED if connection is established
11/15/08
15.11.08
CONFIDENTIAL 198
Subject/Department, Author, MMMM dd, yyyy
LPC2148 connections
D+
11/15/08
15.11.08
CONFIDENTIAL 199
Subject/Department, Author, MMMM dd, yyyy
LPC2148 Clock Architecture
LPC2148 clocks
Main cclk
XTAL PLL
11/15/08
15.11.08
CONFIDENTIAL 200
Subject/Department, Author, MMMM dd, yyyy
Flexible Clocking Scheme
Two separate PLL’s provide lot of flexibility to the user to run the core and the USB
independently at different speeds
CONFIDENTIAL 201
Subject/Department, Author, MMMM dd, yyyy
Exercise: 04 - SPI Hands-On
Load project
Build
Run on hardware
Use joystick to move a point on the LED display
Browse through the program
Make a “worm” game on the LED display
11/15/08
15.11.08
CONFIDENTIAL 202
Subject/Department, Author, MMMM dd, yyyy
Exercise: 05 – ADC and UART Hands-On
- Open project 05_ADC_and_UART
11/15/08
15.11.08
CONFIDENTIAL 203
Subject/Department, Author, MMMM dd, yyyy
Exercise: 05 – ADC and UART Hands-On
- Rotate analog input AIN1 and notify the
results.
- Try to increase ADC accuracy.
11/15/08
15.11.08
CONFIDENTIAL 204
Subject/Department, Author, MMMM dd, yyyy
Exercise: 05 – ADC and UART Hands-On
Solution:
InitUART():
U0DLL = ( 12000000 * 5 ) / ( 19200 * 16 * 4 ); →
U0DLL = ( 12000000 * 5 ) / ( 57600 * 16 * 4 );
InitADC ():
ADCR = … (7 << 17) …; →
ADCR = … (0 << 17) …;
11/15/08
15.11.08
CONFIDENTIAL 205
Subject/Department, Author, MMMM dd, yyyy
Exercise: 06 - USB Hands-On
Load project
Build
Run on hardware
Watch the new disk in Windows My Computer
Try to put something on it
11/15/08
15.11.08
CONFIDENTIAL 206
Subject/Department, Author, MMMM dd, yyyy
Lowest power consumption (less than 1 mW / MHz)
Very small package options (as small as 7mm x 7mm)
The highest performance and most flexible external memory interface
available
Product highlights:
– ARM7 microcontrollers with Flash that operates up to the maximum clock
speed (60 - 72 MHz) thanks to our patented Memory Accelerator Module
with 128-bit wide memory interface – competitive ARM7 products are
limited to 30 – 45 MHz Flash speeds
– The only ARM7 MCU that allows multiple connectivity protocols to run at
full performance at the same time (LPC2300 and LPC2400 family with dual
AHB bus)
– The only ARM7 microcontrollers with full USB specification and
implementation (LPC214x, LPC2300 and LPC2400)
11/15/08
15.11.08
CONFIDENTIAL 207
Subject/Department, Author, MMMM dd, yyyy
IT’S A TEST TIME!