LPC1769 User Manual Full
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 849
UM10360
LPC176x/5x User manual
Rev. 3.1 — 2 April 2014
User manual
Document information
Info
Content
Keywords
LPC1769, LPC1768, LPC1767, LPC1766, LPC1765, LPC1764, LPC1763,
LPC1759, LPC1758, LPC1756, LPC1754, LPC1752, LPC1751, ARM, ARM
Cortex-M3, 32-bit, USB, Ethernet, CAN, I2S, Microcontroller
Abstract
LPC176x/5x user manual
UM10360
NXP Semiconductors
LPC17xx user manual
Revision history
Rev
Date
Description
3.1
20140402
LPC176x/5x user manual
Modifications:
•
•
3
20131220
Added LPC1768UK.
Table 73 “Pin description (LPC175x)” and Table 74 “Pin description (LPC176x)”: Changed
RX_MCLK and TX_MCLK type from INPUT to OUTPUT.
LPC176x/5x user manual
Modifications:
UM10360
User manual
•
•
•
Part ID for part LPC1763 added.
•
•
•
Updated Serial Wire Output description (Table 610).
•
Description of CAN interrupt request updated. One common CAN interrupt is triggered. See
Section 16.8.3.
•
•
•
•
Condition on minimum frequency of CAP input clock added in Section 21.5.1.
•
•
•
•
Description of INXCNT register updated. See Section 26.6.3.6.
•
•
•
•
Boot loader SRAM use explained. See Section 33.5.
•
Figure 118 “RI timer block diagram” updated.
Changed title to “LPC176x/5x User manual”.
Updated numbering for CAN interfaces: CAN1 uses SCC = 0, CAN2 uses SCC = 1. See
Section 16.13 “ID look-up table RAM” and Section 16.15 “Configuration and search algorithm”.
Clarified burst mode information for ADGINTEN (Table 532 and Table 534).
Condition CCLK > 18 MHz for USB operation is not applicable for this USB peripheral and was
removed (see Section 4.7.1, Section 11.13, and Section 13.11).
Description of RIMASK register corrected. See Table 434.
Condition for maximum allowable STCLK frequency added. See Section 23.4.
Delete statement “All PWM related Match registers are configured for toggle on match.” in
Figure 121.
Reset value of the RTC_AUX register corrected. See Table 508.
DAC power-down mode removed in Section 30.2.
Added: The DAC output is disabled in deep-sleep, power-down, or deep power-down modes.
See Table 538.
SYSRESETREQ supported. See Table 660.
Figure 19 “Ethernet packet fields” corrected.
Bit description in the SPI test control register corrected. Bit 0 indicates test mode. All other bits
are reserved. See Section 17.7.5 “SPI Test Control Register (SPTCR - 0x4002 0010)”.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
2 of 849
UM10360
NXP Semiconductors
LPC17xx user manual
Revision history …continued
Rev
Date
Description
2
20100819
LPC176x/5x user manual revision.
Modifications:
1
20100104
•
•
•
•
UART0/1/2/3: FIFOLVL register removed.
•
•
•
Clocking and power control: add bit 15 (PCGPIO) to PCONP register (Table 46).
•
•
•
Motor control PWM: update description of match and limit registers.
ADC: reset value of the ADCTRM register changed to 0xF00 (Table 500).
Timer0/1/2/3: Description of DMA operation updated.
USB Device: Corrected error in the USBCmdCode register (0x01 = write, 0x02 = read)
(Table 184).
Part LPC1763 added.
Update register bit description of USBIntStat register in Host and Device mode (Table 155 and
Table 221).
GPIO: update register bit description of the FIOPIN register (Table 73).
Numerous editorial updates throughout the user manual.
LPC176x/5x user manual revision.
Contact information
For more information, please visit: http://www.nxp.com
For sales office addresses, please send an email to: salesaddresses@nxp.com
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
3 of 849
UM10360
Chapter 1: LPC176x/5x Introductory information
Rev. 3.1 — 2 April 2014
User manual
1.1 Introduction
The LPC176x/5x is an ARM Cortex-M3 based microcontroller for embedded applications
requiring a high level of integration and low power dissipation. The ARM Cortex-M3 is a
next generation core that offers system enhancements such as modernized debug
features and a higher level of support block integration.
High speed versions (LPC1769 and LPC1759) operate at up to a 120 MHz CPU
frequency. Other versions operate at up to an 100 MHz CPU frequency. The ARM
Cortex-M3 CPU incorporates a 3-stage pipeline and uses a Harvard architecture with
separate local instruction and data buses as well as a third bus for peripherals. The ARM
Cortex-M3 CPU also includes an internal prefetch unit that supports speculative
branches.
The peripheral complement of the LPC176x/5x includes up to 512 kB of flash memory, up
to 64 kB of data memory, Ethernet MAC, a USB interface that can be configured as either
Host, Device, or OTG, 8 channel general purpose DMA controller, 4 UARTs, 2 CAN
channels, 2 SSP controllers, SPI interface, 3 I2C interfaces, 2-input plus 2-output I2S
interface, 8 channel 12-bit ADC, 10-bit DAC, motor control PWM, Quadrature Encoder
interface, 4 general purpose timers, 6-output general purpose PWM, ultra-low power RTC
with separate battery supply, and up to 70 general purpose I/O pins.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
4 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
1.2 Features
Refer to Section 1.4.1 for details of features on specific part numbers.
• ARM Cortex-M3 processor, running at frequencies of up to 120 MHz on high speed
versions (LPC1769 and LPC1759), up to 100 MHz on other versions. A Memory
Protection Unit (MPU) supporting eight regions is included.
• ARM Cortex-M3 built-in Nested Vectored Interrupt Controller (NVIC).
• Up to 512 kB on-chip flash program memory with In-System Programming (ISP) and
In-Application Programming (IAP) capabilities. The combination of an enhanced flash
memory accelerator and location of the flash memory on the CPU local code/data bus
provides high code performance from flash.
• Up to 64 kB on-chip SRAM includes:
– Up to 32 kB of SRAM on the CPU with local code/data bus for high-performance
CPU access.
– Up to two 16 kB SRAM blocks with separate access paths for higher throughput.
These SRAM blocks may be used for Ethernet, USB, and DMA memory, as well as
for general purpose instruction and data storage.
• Eight channel General Purpose DMA controller (GPDMA) on the AHB multilayer
matrix that can be used with the SSP, I2S, UART, the Analog-to-Digital and
Digital-to-Analog converter peripherals, timer match signals, GPIO, and for
memory-to-memory transfers.
• Multilayer AHB matrix interconnect provides a separate bus for each AHB master.
AHB masters include the CPU, General Purpose DMA controller, Ethernet MAC, and
the USB interface. This interconnect provides communication with no arbitration
delays unless two masters attempt to access the same slave at the same time.
• Split APB bus allows for higher throughput with fewer stalls between the CPU and
DMA. A single level of write buffering allows the CPU to continue without waiting for
completion of APB writes if the APB was not already busy.
• Serial interfaces:
– Ethernet MAC with RMII interface and dedicated DMA controller.
– USB 2.0 full-speed controller that can be configured for either device, Host, or
OTG operation with an on-chip PHY for device and Host functions and a dedicated
DMA controller.
– Four UARTs with fractional baud rate generation, internal FIFO, IrDA, and DMA
support. One UART has modem control I/O and RS-485/EIA-485 support.
– Two-channel CAN controller.
– Two SSP controllers with FIFO and multi-protocol capabilities. The SSP interfaces
can be used with the GPDMA controller.
– SPI controller with synchronous, serial, full duplex communication and
programmable data length. SPI is included as a legacy peripheral and can be used
instead of SSP0.
– Three enhanced I2C-bus interfaces, one with an open-drain output supporting the
full I2C specification and Fast mode plus with data rates of 1Mbit/s, two with
standard port pins. Enhancements include multiple address recognition and
monitor mode.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
5 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
– I2S (Inter-IC Sound) interface for digital audio input or output, with fractional rate
control. The I2S interface can be used with the GPDMA. The I2S interface supports
3-wire data transmit and receive or 4-wire combined transmit and receive
connections, as well as master clock output.
• Other peripherals:
– 70 (100 pin package) or 52 (80-pin package) General Purpose I/O (GPIO) pins with
configurable pull-up/down resistors, open drain mode, and repeater mode. All
GPIOs are located on an AHB bus for fast access, and support Cortex-M3
bit-banding. GPIOs can be accessed by the General Purpose DMA Controller. Any
pin of ports 0 and 2 can be used to generate an interrupt.
– 12-bit Analog-to-Digital Converter (ADC) with input multiplexing among eight pins,
conversion rates up to 200 kHz, and multiple result registers. The 12-bit ADC can
be used with the GPDMA controller.
– 10-bit Digital-to-Analog Converter (DAC) with dedicated conversion timer and DMA
support.
– Four general purpose timers/counters, with a total of eight capture inputs and ten
compare outputs. Each timer block has an external count input. Specific timer
events can be selected to generate DMA requests.
– One motor control PWM with support for three-phase motor control.
– Quadrature encoder interface that can monitor one external quadrature encoder.
– One standard PWM/timer block with external count input.
– Real-Time Clock (RTC) with a separate power domain. The RTC is clocked by a
dedicated RTC oscillator. The RTC block includes 20 bytes of battery-powered
backup registers, allowing system status to be stored when the rest of the chip is
powered off. Battery power can be supplied from a standard 3 V Lithium button
cell. The RTC will continue working when the battery voltage drops to as low as
2.1 V. An RTC interrupt can wake up the CPU from any reduced power mode.
– Watchdog Timer (WDT). The WDT can be clocked from the internal RC oscillator,
the RTC oscillator, or the APB clock.
– Cortex-M3 system tick timer, including an external clock input option.
– Repetitive interrupt timer provides programmable and repeating timed interrupts.
• Standard JTAG test/debug interface as well as Serial Wire Debug and Serial Wire
Trace Port options.
• Emulation trace module supports real-time trace.
• Four reduced power modes: Sleep, Deep-sleep, Power-down, and Deep
power-down.
• Single 3.3 V power supply (2.4 V to 3.6 V). Temperature range of -40 °C to 85 °C.
• Four external interrupt inputs configurable as edge/level sensitive. All pins on PORT0
and PORT2 can be used as edge sensitive interrupt sources.
• Non-maskable Interrupt (NMI) input.
• Clock output function that can reflect the main oscillator clock, IRC clock, RTC clock,
CPU clock, or the USB clock.
• The Wake-up Interrupt Controller (WIC) allows the CPU to automatically wake up
from any priority interrupt that can occur while the clocks are stopped in deep sleep,
Power-down, and Deep power-down modes.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
6 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
• Processor wake-up from Power-down mode via any interrupt able to operate during
Power-down mode (includes external interrupts, RTC interrupt, USB activity, Ethernet
wake-up interrupt, CAN bus activity, PORT0/2 pin interrupt, and NMI).
•
•
•
•
•
Each peripheral has its own clock divider for further power savings.
Brownout detect with separate threshold for interrupt and forced reset.
On-chip Power-On Reset (POR).
On-chip crystal oscillator with an operating range of 1 MHz to 25 MHz.
4 MHz internal RC oscillator trimmed to 1% accuracy that can optionally be used as a
system clock.
• An on-chip PLL allows CPU operation up to the maximum CPU rate without the need
for a high-frequency crystal. May be run from the main oscillator, the internal RC
oscillator, or the RTC oscillator.
• A second, dedicated PLL may be used for the USB interface in order to allow added
flexibility for the Main PLL settings.
• Versatile pin function selection feature allows many possibilities for using on-chip
peripheral functions.
• Available as LQFP100 (14 mm 14 mm 1.4 mm), TFBGA1001 (9 mm 9 mm 0.7
mm), WLCSP100 (5.074
mm) packages
5.074
0.6 mm) package, and 80-pin LQFP (12 x 12 x 1.4
1.3 Applications
•
•
•
•
•
•
1.
eMetering
Lighting
Industrial networking
Alarm systems
White goods
Motor control
LPC1768/65 only.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
7 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
1.4 Ordering information
Table 1.
Ordering information
Type number
Package
Name
Description
Version
LQFP100
plastic low profile quad flat package; 100 leads; body 14
LPC1768FET100
TFBGA100
plastic thin fine-pitch ball grid array package; 100 balls; body 9 x 9 x
0.7 mm
LPC1768UK
WLCSP100 wafer level chip-scale package; 100 balls; 5.074
LPC1769FBD100
LPC1768FBD100
LPC1767FBD100
14
1.4 mm
SOT407-1
LPC1766FBD100
LPC1765FBD100
LPC1764FBD100
LPC1763FBD100
5.074
SOT926-1
0.6 mm
-
LPC1759FBD80
LPC1758FBD80
LPC1756FBD80
LQFP80
plastic low profile quad flat package; 80 leads; body 12
12
1.4 mm
SOT315-1
LPC1754FBD80
LPC1752FBD80
LPC1751FBD80
1.4.1 Part options summary
Table 2.
Ordering options for LPC176x/5x parts
Type number
Max. CPU
speed
Flash
Total
SRAM
Ethernet
USB
CAN
I2S
DAC
Package
LPC1769FBD100
120 MHz
512 kB
64 kB
yes
Device/Host/OTG
2
yes
yes
100 pin
LPC1768FBD100
100 MHz
512 kB
64 kB
yes
Device/Host/OTG
2
yes
yes
100 pin
LPC1768FET100
100 MHz
512 kB
64 kB
yes
Device/Host/OTG
2
yes
yes
100 pin
LPC1768UK
100 MHz
512 kB
64 kB
yes
Device/Host/OTG
2
yes
yes
100 pin
LPC1767FBD100
100 MHz
512 kB
64 kB
yes
no
no
yes
yes
100 pin
LPC1766FBD100
100 MHz
256 kB
64 kB
yes
Device/Host/OTG
2
yes
yes
100 pin
LPC1765FBD100
100 MHz
256 kB
64 kB
no
Device/Host/OTG
2
yes
yes
100 pin
LPC1764FBD100
100 MHz
128 kB
32 kB
yes
Device
2
no
no
100 pin
LPC1763FBD100
100 MHz
256 kB
64 kB
no
no
no
yes
yes
100 pin
LPC1759FBD80
120 MHz
512 kB
64 kB
no
Device/Host/OTG
2
yes
yes
80 pin
LPC1758FBD80
100 MHz
512 kB
64 kB
yes
Device/Host/OTG
2
yes
yes
80 pin
LPC1756FBD80
100 MHz
256 kB
32 kB
no
Device/Host/OTG
2
yes
yes
80 pin
LPC1754FBD80
100 MHz
128 kB
32 kB
no
Device/Host/OTG
1
no
yes
80 pin
LPC1752FBD80
100 MHz
64 kB
16 kB
no
Device
1
no
no
80 pin
LPC1751FBD80
100 MHz
32 kB
8 kB
no
Device
1
no
no
80 pin
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
8 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
ARM Cortex-M3
DMA
controller
Ethernet
10/100
MAC
USB
device,
host,
OTG
Clocks
and
Controls
System
bus
D-code
bus
I-code
bus
Clock Generation,
Power Control,
Brownout Detect,
and other
system functions
Flash
Accelerator
Flash
512 kB
SRAM
64 kB
Multilayer AHB Matrix
High Speed GPIO
RST
Test/Debug Interface
USB
interface
Xtalout
JTAG
interface
Trace Module
Ethernet
PHY
interface
Trace
Port
Xtalin
1.5 Simplified block diagram
ROM
8 kB
AHB to
APB bridge
AHB to
APB bridge
APB slave group 0
APB slave group 1
SSP1
SSP0
UARTs 0 & 1
UARTs 2 & 3
CAN 1 & 2
I2S
I2C 0 & 1
I2C2
SPI0
Repetitive Interrupt
Timer
Capture/Compare
Timers 0 & 1
Capture/Compare
Timers 2 & 3
Watchdog Timer
External Interrupts
PWM1
DAC
12-bit ADC
System Control
Pin Connect Block
Motor Control PWM
GPIO Interrupt Ctl
Quadrature Encoder
32 kHz
oscillator
Real Time Clock
Note: shaded peripheral blocks
support General Purpose DMA
20 bytes of backup
registers
RTC Power Domain
Fig 1.
LPC1768 simplified block diagram
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
9 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
1.6 Architectural overview
The ARM Cortex-M3 includes three AHB-Lite buses, one system bus and the I-code and
D-code buses which are faster and are used similarly to TCM interfaces: one bus
dedicated for instruction fetch (I-code) and one bus for data access (D-code). The use of
two core buses allows for simultaneous operations if concurrent operations target different
devices.
The LPC176x/5x uses a multi-layer AHB matrix to connect the Cortex-M3 buses and other
bus masters to peripherals in a flexible manner that optimizes performance by allowing
peripherals on different slaves ports of the matrix to be accessed simultaneously by
different bus masters. Details of the multilayer matrix connections are shown in Figure 2.
APB peripherals are connected to the CPU via two APB busses using separate slave
ports from the multilayer AHB matrix. This allows for better performance by reducing
collisions between the CPU and the DMA controller. The APB bus bridges are configured
to buffer writes so that the CPU or DMA controller can write to APB devices without
always waiting for APB write completion.
1.7 ARM Cortex-M3 processor
The ARM Cortex-M3 is a general purpose 32-bit microprocessor, which offers high
performance and very low power consumption. The Cortex-M3 offers many new features,
including a Thumb-2 instruction set, low interrupt latency, hardware divide,
interruptible/continuable multiple load and store instructions, automatic state save and
restore for interrupts, tightly integrated interrupt controller with Wake-up Interrupt
Controller, and multiple core buses capable of simultaneous accesses.
Pipeline techniques are employed so that all parts of the processing and memory systems
can operate continuously. Typically, while one instruction is being executed, its successor
is being decoded, and a third instruction is being fetched from memory.
The ARM Cortex-M3 processor is described in detail in the Cortex-M3 User Guide that is
appended to this manual.
1.7.1 Cortex-M3 Configuration Options
The LPC176x/5x uses the r2p0 version of the Cortex-M3 CPU, which includes a number
of configurable options, as noted below.
System options:
• The Nested Vectored Interrupt Controller (NVIC) is included. The NVIC includes the
SYSTICK timer.
• The Wake-up Interrupt Controller (WIC) is included. The WIC allows more powerful
options for waking up the CPU from reduced power modes.
• A Memory Protection Unit (MPU) is included.
• A ROM Table in included. The ROM Table provides addresses of debug components
to external debug systems.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
10 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
Debug related options:
• A JTAG debug interface is included.
• Serial Wire Debug is included. Serial Wire Debug allows debug operations using only
2 wires, simple trace functions can be added with a third wire.
• The Embedded Trace Macrocell (ETM) is included. The ETM provides instruction
trace capabilities.
• The Data Watchpoint and Trace (DWT) unit is included. The DWT allows data
address or data value matches to be trace information or trigger other events. The
DWT includes 4 comparators and counters for certain internal events.
• An Instrumentation Trace Macrocell (ITM) is included. Software can write to the ITM in
order to send messages to the trace port.
• The Trace Port Interface Unit (TPIU) is included. The TPIU encodes and provides
trace information to the outside world. This can be on the Serial Wire Viewer pin or the
4-bit parallel trace port.
• A Flash Patch and Breakpoint (FPB) is included. The FPB can generate hardware
breakpoints and remap specific addresses in code space to SRAM as a temporary
method of altering non-volatile code. The FPB include 2 literal comparators and 6
instruction comparators.
1.8 On-chip flash memory system
The LPC176x/5x contains up to 512 kB of on-chip flash memory. A flash memory
accelerator maximizes performance for use with the two fast AHB-Lite buses. This
memory may be used for both code and data storage. Programming of the flash memory
may be accomplished in several ways. It may be programmed In System via the serial
port. The application program may also erase and/or program the flash while the
application is running, allowing a great degree of flexibility for data storage field firmware
upgrades, etc.
1.9 On-chip Static RAM
The LPC176x/5x contains up to 64 kB of on-chip static RAM memory. Up to 32 kB of
SRAM, accessible by the CPU and all three DMA controllers are on a higher-speed bus.
Devices containing more than 32 kB SRAM have two additional 16 kB SRAM blocks, each
situated on separate slave ports on the AHB multilayer matrix.
This architecture allows the possibility for CPU and DMA accesses to be separated in
such a way that there are few or no delays for the bus masters.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
11 of 849
UM10360
NXP Semiconductors
Chapter 1: LPC176x/5x Introductory information
ARM Cortex-M3
D-code
bus
EMULATION
TRACE MODULE
TEST/DEBUG
INTERFACE
I-code
bus
DMA
controller
Ethernet
10/100
MAC
RST
clock generation, CLK
power control, OUT
and other
system functions
Vdd
voltage regulator
clocks
and
controls
USB
device,
host,
OTG
Xtalout
USB
interface
X32Kin
Ethernet PHY
interface
Debug Port
X32Kout
JTAG
interface
Xtalin
1.10 Block diagram
internal
power
System
bus
Flash
Accelerator
Flash
512 kB
SRAM
32 kB
ROM
8 kB
SRAM
16 kB
SRAM
16 kB
AHB to
APB bridge
Multilayer
AHB Matrix
DMAC
regs
USB
regs
HS
GPIO
Ethernet
regs
AHB to
APB bridge
APB slave group 0
APB slave group 1
SSP1
SSP0
UARTs 0 & 1
UARTs 2 & 3
CAN 1 & 2
I2S
I2C 0 & 1
I2C2
SPI0
Capture/compare
timers 2 & 3
Capture/compare
timers 0 & 1
Repetitive interrupt
timer
Watchdog timer
External interrupts
PWM1
DAC
12-bit ADC
System control
Pin connect block
Motor control PWM
GPIO interrupt control
32 kHz
oscillator
Quadrature encoder
Real Time Clock
Note: shaded peripheral blocks
support General Purpose DMA
Vbat ultra-low power
Backup registers
regulator
(20 bytes)
RTC Power Domain
Fig 2.
LPC1768 block diagram, CPU and buses
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
12 of 849
UM10360
Chapter 2: LPC176x/5x Memory map
Rev. 3.1 — 2 April 2014
User manual
2.1 Memory map and peripheral addressing
The ARM Cortex-M3 processor has a single 4 GB address space. The following table
shows how this space is used on the LPC176x/5x.
Table 3.
LPC176x/5x memory usage and details
Address range
General Use
Address range details and description
0x0000 0000 to
0x1FFF FFFF
On-chip non-volatile
memory
0x0000 0000 - 0x0007 FFFF
For devices with 512 kB of flash memory.
0x0000 0000 - 0x0003 FFFF
For devices with 256 kB of flash memory.
0x0000 0000 - 0x0001 FFFF
For devices with 128 kB of flash memory.
On-chip SRAM
0x2000 0000 to
0x3FFF FFFF
0x4000 0000 to
0x5FFF FFFF
0xE000 0000 to
0xE00F FFFF
0x0000 0000 - 0x0000 FFFF
For devices with 64 kB of flash memory.
0x0000 0000 - 0x0000 7FFF
For devices with 32 kB of flash memory.
0x1000 0000 - 0x1000 7FFF
For devices with 32 kB of local SRAM.
0x1000 0000 - 0x1000 3FFF
For devices with 16 kB of local SRAM.
0x1000 0000 - 0x1000 1FFF
For devices with 8 kB of local SRAM.
Boot ROM
0x1FFF 0000 - 0x1FFF 1FFF
8 kB Boot ROM with flash services.
On-chip SRAM
(typically used for
peripheral data)
0x2007 C000 - 0x2007 FFFF
AHB SRAM - bank 0 (16 kB), present on
devices with 32 kB or 64 kB of total SRAM.
0x2008 0000 - 0x2008 3FFF
AHB SRAM - bank 1 (16 kB), present on
devices with 64 kB of total SRAM.
GPIO
0x2009 C000 - 0x2009 FFFF
GPIO.
APB Peripherals
0x4000 0000 - 0x4007 FFFF
APB0 Peripherals, up to 32 peripheral blocks,
16 kB each.
0x4008 0000 - 0x400F FFFF
APB1 Peripherals, up to 32 peripheral blocks,
16 kB each.
AHB peripherals
0x5000 0000 - 0x501F FFFF
DMA Controller, Ethernet interface, and USB
interface.
Cortex-M3 Private
Peripheral Bus
0xE000 0000 - 0xE00F FFFF
Cortex-M3 related functions, includes the
NVIC and System Tick Timer.
2.2 Memory maps
The LPC176x/5x incorporates several distinct memory regions, shown in the following
figures. Figure 3 shows the overall map of the entire address space from the user
program viewpoint following reset. The interrupt vector area supports address remapping,
which is described later in this section.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
13 of 849
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxx
31
0x400B 4000
0x400B 0000
15
14
13
0x400A 8000
10
I2S
0x400A 4000
9
reserved
0x400A 0000
8
I2C2
7
UART3
Rev. 3.1 — 2 April 2014
6
UART2
5
Timer 3
0x5020 0000
0x5000 0000
reserved
reserved
APB1 peripherals
1 GB
APB0 peripherals
4
Timer 2
0x4008 C000
3
DAC
reserved
0x4008 8000
2
SSP0
AHB SRAM bit band alias addressing
1 - 0 reserved
reserved
reserved
0.5 GB
AHB SRAM (2 blocks of 16 kB)
reserved
8 kB boot ROM
reserved
I-code/D-code
memory space
1
GPDMA controller
0
Ethernet controller
32 kB local static RAM
0x4000 0000
0 GB
0x5000 8000
0x5000 4000
0x5000 0000
23
I2C1
22 - 19 reserved
0x4008 0000
0x4006 0000
0x4005 C000
0x4004 C000
CAN2
0x4004 8000
17
CAN1
0x4004 4000
16
CAN common
0x4004 0000
15
CAN AF registers
0x4003 C000
0x2008 4000
14
CAN AF RAM
0x4003 8000
0x2007 C000
13
ADC
0x4003 4000
0x1FFF 2000
12
SSP1
0x4003 0000
11
pin connect
0x4002 C000
10
GPIO interrupts
0x4002 8000
9
RTC + backup registers
0x4002 4000
8
SPI
0x4002 0000
7
I2C0
0x4001 C000
6
PWM1
0x4001 8000
5
reserved
0x4001 4000
4
UART1
0x4001 0000
3
UART0
0x4000 C000
2
TIMER1
0x4000 8000
1
0
TIMER0
0x4000 4000
WDT
0x4000 0000
0x200A 0000
0x1FFF 0000
0x1000 8000
0x1000 0000
0x0000 0000
UM10360
14 of 849
© NXP B.V. 2014. All rights reserved.
LPC176x/5x system memory map
0x5000 C000
18
0x2200 0000
0x0008 0000
512 kB on-chip flash
31 - 24 reserved
0x2400 0000
+ 256 words
active interrupt vectors
APB0 peripherals
0x4008 0000
reserved
Fig 3.
reserved
0x4010 0000
0x2009 C000
0x0000 0000
USB controller
2
0x4200 0000
GPIO
0x0000 0400
3
0x4400 0000
peripheral bit band alias addressing
0x4009 0000
0x4008 0000
0xE000 0000
reserved
AHB periherals
0x5020 0000
127- 4 reserved
Chapter 2: LPC176x/5x Memory map
All information provided in this document is subject to legal disclaimers.
0x4009 4000
private peripheral bus
12 repetitive interrupt timer
reserved
AHB peripherals
0xE010 0000
reserved
11
0x4009 8000
0xFFFF FFFF
reserved
QEI
motor control PWM
0x400A C000
0x4009 C000
LPC1768 memory space
system control
30 - 16 reserved
0x400C 0000
0x400B C000
0x400B 8000
4 GB
NXP Semiconductors
UM10360
User manual
APB1 peripherals
0x4010 0000
0x400F C000
UM10360
NXP Semiconductors
Chapter 2: LPC176x/5x Memory map
Figure 3 and Table 4 show different views of the peripheral address space. The AHB
peripheral area is 2 megabyte in size, and is divided to allow for up to 128 peripherals.
The APB peripheral area is 1 megabyte in size and is divided to allow for up to 64
peripherals. Each peripheral of either type is allocated 16 kilobytes of space. This allows
simplifying the address decoding for each peripheral.
All peripheral register addresses are word aligned (to 32-bit boundaries) regardless of
their size. This eliminates the need for byte lane mapping hardware that would be required
to allow byte (8-bit) or half-word (16-bit) accesses to occur at smaller boundaries. An
implication of this is that word and half-word registers must be accessed all at once. For
example, it is not possible to read or write the upper byte of a word register separately.
2.3 APB peripheral addresses
The following table shows the APB0/1 address maps. No APB peripheral uses all of the
16 kB space allocated to it. Typically each device’s registers are "aliased" or repeated at
multiple locations within each 16 kB range.
Table 4.
UM10360
User manual
APB0 peripherals and base addresses
APB0 peripheral
Base address
Peripheral name
0
0x4000 0000
Watchdog Timer
1
0x4000 4000
Timer 0
2
0x4000 8000
Timer 1
3
0x4000 C000
UART0
4
0x4001 0000
UART1
5
0x4001 4000
reserved
6
0x4001 8000
PWM1
7
0x4001 C000
I2C0
8
0x4002 0000
SPI
9
0x4002 4000
RTC
10
0x4002 8000
GPIO interrupts
11
0x4002 C000
Pin Connect Block
12
0x4003 0000
SSP1
13
0x4003 4000
ADC
14
0x4003 8000
CAN Acceptance Filter RAM
15
0x4003 C000
CAN Acceptance Filter Registers
16
0x4004 0000
CAN Common Registers
17
0x4004 4000
CAN Controller 1
18
0x4004 8000
CAN Controller 2
19 to 22
0x4004 C000 to 0x4005 8000
reserved
23
0x4005 C000
I2C1
24 to 31
0x4006 0000 to 0x4007 C000
reserved
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
15 of 849
UM10360
NXP Semiconductors
Chapter 2: LPC176x/5x Memory map
Table 5.
APB1 peripherals and base addresses
APB1 peripheral
Base address
Peripheral name
0
0x4008 0000
reserved
1
0x4008 4000
reserved
2
0x4008 8000
SSP0
3
0x4008 C000
DAC
4
0x4009 0000
Timer 2
5
0x4009 4000
Timer 3
6
0x4009 8000
UART2
7
0x4009 C000
UART3
8
0x400A 0000
I2C2
9
0x400A 4000
reserved
10
0x400A 8000
I2S
11
0x400A C000
reserved
12
0x400B 0000
Repetitive interrupt timer
13
0x400B 4000
reserved
14
0x400B 8000
Motor control PWM
15
0x400B C000
Quadrature Encoder Interface
16 to 30
0x400C 0000 to 0x400F 8000
reserved
31
0x400F C000
System control
2.4 Memory re-mapping
The Cortex-M3 incorporates a mechanism that allows remapping the interrupt vector table
to alternate locations in the memory map. This is controlled via the Vector Table Offset
Register contained in the Cortex-M3. Refer to Section 6.4 and Section 34.4.3.5 of the
Cortex-M3 User Guide appended to this manual for details of the Vector Table Offset
feature.
Boot ROM re-mapping
Following a hardware reset, the Boot ROM is temporarily mapped to address 0. This is
normally transparent to the user. However, if execution is halted immediately after reset by
a debugger, it should correct the mapping for the user. See Section 33.6.
2.5 AHB arbitration
The Multilayer AHB Matrix arbitrates between several masters. By default, the Cortex-M3
D-code bus has the highest priority, followed by the I-Code bus. All other masters share a
lower priority.
2.6 Bus fault exceptions
The LPC176x/5x generates Bus Fault exception if an access is attempted for an address
that is in a reserved or unassigned address region. The regions are areas of the memory
map that are not implemented for a specific derivative. These include all spaces marked
“reserved” in Figure 3.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
16 of 849
UM10360
NXP Semiconductors
Chapter 2: LPC176x/5x Memory map
For these areas, both attempted data access and instruction fetch generate an exception.
In addition, a Bus Fault exception is generated for any instruction fetch that maps to an
AHB or APB peripheral address.
Within the address space of an existing APB peripheral, an exception is not generated in
response to an access to an undefined address. Address decoding within each peripheral
is limited to that needed to distinguish defined registers within the peripheral itself. For
example, an access to address 0x4000 D000 (an undefined address within the UART0
space) may result in an access to the register defined at address 0x4000 C000. Details of
such address aliasing within a peripheral space are not defined in the LPC176x/5x
documentation and are not a supported feature.
If software executes a write directly to the flash memory, the flash accelerator will
generate a Bus Fault exception. Flash programming must be accomplished by using the
specified flash programming interface provided by the Boot Code.
Note that the Cortex-M3 core stores the exception flag along with the associated
instruction in the pipeline and processes the exception only if an attempt is made to
execute the instruction fetched from the disallowed address. This prevents accidental
aborts that could be caused by prefetches that occur when code is executed very near a
memory boundary.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
17 of 849
UM10360
Chapter 3: LPC176x/5x System control
Rev. 3.1 — 2 April 2014
User manual
3.1 Introduction
The system control block includes several system features and control registers for a
number of functions that are not related to specific peripheral devices. These include:
•
•
•
•
Reset
Brown-Out Detection
External Interrupt Inputs
Miscellaneous System Controls and Status
Each type of function has its own register(s) if any are required and unneeded bits are
defined as reserved in order to allow future expansion. Unrelated functions never share
the same register addresses
3.2 Pin description
Table 6 shows pins that are associated with System Control block functions.
Table 6.
UM10360
User manual
Pin summary
Pin name
Pin
direction
Pin description
EINT0
Input
External Interrupt Input 0 - An active low/high level or falling/rising
edge general purpose interrupt input. This pin may be used to wake up
the processor from Sleep, Deep-sleep, or Power-down modes.
EINT1
Input
External Interrupt Input 1 - See the EINT0 description above.
EINT2
Input
External Interrupt Input 2 - See the EINT0 description above.
EINT3
Input
External Interrupt Input 3 - See the EINT0 description above.
RESET
Input
External Reset input - A LOW on this pin resets the chip, causing I/O
ports and peripherals to take on their default states, and the processor to
begin execution at address 0x0000 0000.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
18 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
3.3 Register description
All registers, regardless of size, are on word address boundaries. Details of the registers
appear in the description of each function.
Table 7.
Summary of system control registers
Name
Description
Access
Reset value
Address
External Interrupts
EXTINT
External Interrupt Flag Register
R/W
0
0x400F C140
EXTMODE
External Interrupt Mode register
R/W
0
0x400F C148
EXTPOLAR
External Interrupt Polarity Register
R/W
0
0x400F C14C
Reset Source Identification Register
R/W
see Table 8
0x400F C180
R/W
0
0x400F C1A0
Reset
RSID
Syscon Miscellaneous Registers
SCS
System Control and Status
3.4 Reset
Reset has 4 sources on the LPC176x/5x: the RESET pin, Watchdog Reset, Power On
Reset (POR), and Brown Out Detect (BOD).
The RESET pin is a Schmitt trigger input pin. Assertion of chip Reset by any source, once
the operating voltage attains a usable level, starts the wake-up timer (see description in
Section 4.9 “Wake-up timer” in this chapter), causing reset to remain asserted until the
external Reset is de-asserted, the oscillator is running, a fixed number of clocks have
passed, and the flash controller has completed its initialization. The reset logic is shown in
the following block diagram (see Figure 4).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
19 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
external
reset
Reset to the
on-chip circuitry
C
Q
watchdog
reset
Reset to
PCON.PD
S
POR
BOD
WAKE-UP TIMER
START
power-down
COUNT 2 n
EINT0 wake-up
EINT1 wake-up
Q
internal RC
oscillator
S
write “1”
from APB
EINT2 wake-up
EINT3 wake-up
RTC wake-up
BOD wake-up
Ethernet MAC wake-up
reset
APB read of
PDBIT
in PCON
USB need_clk wake-up
CAN wake-up
GPIO0 port wake-up
GPIO2 port wake-up
Fig 4.
C
FOSC
to other
blocks
Reset block diagram including the wake-up timer
On the assertion of a reset source external to the Cortex-M3 CPU (POR, BOD reset,
External reset, and Watchdog reset), the IRC starts up. After the IRC-start-up time
(maximum of 60 s on power-up) and after the IRC provides a stable clock output, the
reset signal is latched and synchronized on the IRC clock. Then the following two
sequences start simultaneously:
1. The 2-bit IRC wake-up timer starts counting when the synchronized reset is
de-asserted. The boot code in the ROM starts when the 2-bit IRC wake-up timer times
out. The boot code performs the boot tasks and may jump to the flash. If the flash is
not ready to access, the Flash Accelerator will insert wait cycles until the flash is
ready.
2. The flash wake-up timer (9-bit) starts counting when the synchronized reset is
de-asserted. The flash wake-up timer generates the 100 s flash start-up time. Once
it times out, the flash initialization sequence is started, which takes about 250 cycles.
When it’s done, the Flash Accelerator will be granted access to the flash.
When the internal Reset is removed, the processor begins executing at address 0, which
is initially the Reset vector mapped from the Boot Block. At that point, all of the processor
and peripheral registers have been initialized to predetermined values.
Figure 5 shows an example of the relationship between the RESET, the IRC, and the
processor status when the LPC176x/5x starts up after reset. See Section 4.3.2 “Main
oscillator” for start-up of the main oscillator if selected by the user code.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
20 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
IRC
starts
IRC
stable
IRC status
RESET
VDD(REG)(3V3)
valid threshold
GND
60 µs
1 µs; IRC stability count
boot time
supply ramp-up
time
7 µs
181 µs
224 µs
user code
processor status
flash read
starts
Fig 5.
flash read
finishes
boot code
execution
finishes;
user code starts
Example of start-up after reset
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
21 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
3.4.1 Reset Source Identification Register (RSID - 0x400F C180)
This register contains one bit for each source of Reset. Writing a 1 to any of these bits
clears the corresponding read-side bit to 0. The interactions among the four sources are
described below.
Table 8.
Reset Source Identification register (RSID - address 0x400F C180) bit description
Bit
Symbol Description
Reset
value
0
POR
Assertion of the POR signal sets this bit, and clears all of the other bits in
this register. But if another Reset signal (e.g., External Reset) remains
asserted after the POR signal is negated, then its bit is set. This bit is not
affected by any of the other sources of Reset.
See
text
1
EXTR
Assertion of the RESET signal sets this bit. This bit is cleared only by
software or POR.
See
text
2
WDTR
This bit is set when the Watchdog Timer times out and the WDTRESET bit See
in the Watchdog Mode Register is 1. This bit is cleared only by software or text
POR.
3
BODR
This bit is set when the VDD(REG)(3V3) voltage reaches a level below the
BOD reset trip level (typically 1.85 V under nominal room temperature
conditions).
See
text
If the VDD(REG)(3V3) voltage dips from the normal operating range to below
the BOD reset trip level and recovers, the BODR bit will be set to 1.
If the VDD(REG)(3V3) voltage dips from the normal operating range to below
the BOD reset trip level and continues to decline to the level at which POR
is asserted (nominally 1 V), the BODR bit is cleared.
If the VDD(REG)(3V3) voltage rises continuously from below 1 V to a level
above the BOD reset trip level, the BODR will be set to 1.
This bit is cleared only by software or POR.
Note: Only in the case where a reset occurs and the POR = 0, the BODR
bit indicates if the VDD(REG)(3V3) voltage was below the BOD reset trip level
or not.
31:4 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The value NA
read from a reserved bit is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
22 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
3.5 Brown-out detection
The LPC176x/5x includes a Brown-Out Detector (BOD) that provides 2-stage monitoring
of the voltage on the VDD(REG)(3V3) pins. If this voltage falls below the BOD interrupt trip
level (typically 2.2 V under nominal room temperature conditions), the BOD asserts an
interrupt signal to the NVIC. This signal can be enabled for interrupt in the Interrupt
Enable Register in the NVIC in order to cause a CPU interrupt; if not, software can monitor
the signal by reading the Raw Interrupt Status Register.
The second stage of low-voltage detection asserts Reset to inactivate the LPC176x/5x
when the voltage on the VDD(REG)(3V3) pins falls below the BOD reset trip level (typically
1.85 V under nominal room temperature conditions). This Reset prevents alteration of the
flash as operation of the various elements of the chip would otherwise become unreliable
due to low voltage. The BOD circuit maintains this reset down below 1 V, at which point
the Power-On Reset circuitry maintains the overall Reset.
Both the BOD reset interrupt level and the BOD reset trip level thresholds include some
hysteresis. In normal operation, this hysteresis allows the BOD reset interrupt level
detection to reliably interrupt, or a regularly-executed event loop to sense the condition.
But when Brown-Out Detection is enabled to bring the LPC176x/5x out of Power-down
mode (which is itself not a guaranteed operation -- see Section 4.8.7 “Power Mode
Control register (PCON - 0x400F C0C0)”), the supply voltage may recover from a
transient before the wake-up timer has completed its delay. In this case, the net result of
the transient BOD is that the part wakes up and continues operation after the instructions
that set Power-down mode, without any interrupt occurring and with the BOD bit in the
RSID being 0. Since all other wake-up conditions have latching flags (see Section 3.6.2
“External Interrupt flag register (EXTINT - 0x400F C140)” and Section 27.6.2), a wake-up
of this type, without any apparent cause, can be assumed to be a Brown-Out that has
gone away.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
23 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
3.6 External interrupt inputs
TheLPC176x/5x includes four External Interrupt Inputs as selectable pin functions. The
logic of an individual external interrupt is represented in Figure 6. In addition, external
interrupts have the ability to wake up the CPU from Power-down mode. Refer to
Section 4.8.8 “Wake-up from Reduced Power Modes” for details.
EINTi interrupt enable
EINTi pin
EINTi to wakeup timer
GLITCH
FILTER
Interrupt flag
(one bit of EXTINT)
EXTPOLARi
S
1
D
S
Q
EXTMODEi
S
Q
R
R
PCLK
PCLK
internal reset
write to EXTINTi
Fig 6.
Q
to interrupt
controller
APB read
of EXTINTi
100621
External interrupt logic
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
24 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
3.6.1 Register description
The external interrupt function has four registers associated with it. The EXTINT register
contains the interrupt flags. The EXTMODE and EXTPOLAR registers specify the level
and edge sensitivity parameters.
Table 9.
External Interrupt registers
Name
Description
Access
Reset
Address
value[1]
EXTINT
The External Interrupt Flag Register contains
interrupt flags for EINT0, EINT1, EINT2 and
EINT3. See Table 10.
R/W
0x00
0x400F C140
EXTMODE
The External Interrupt Mode Register controls
whether each pin is edge- or level-sensitive.
See Table 11.
R/W
0x00
0x400F C148
EXTPOLAR
The External Interrupt Polarity Register controls R/W
which level or edge on each pin will cause an
interrupt. See Table 12.
0x00
0x400F C14C
[1]
Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
3.6.2 External Interrupt flag register (EXTINT - 0x400F C140)
When a pin is selected for its external interrupt function, the level or edge on that pin
(selected by its bits in the EXTPOLAR and EXTMODE registers) will set its interrupt flag in
this register. This asserts the corresponding interrupt request to the NVIC, which will
cause an interrupt if interrupts from the pin are enabled.
Writing ones to bits EINT0 through EINT3 in EXTINT register clears the corresponding
bits. In level-sensitive mode the interrupt is cleared only when the pin is in its inactive
state.
Once a bit from EINT0 to EINT3 is set and an appropriate code starts to execute (handling
wake-up and/or external interrupt), this bit in EXTINT register must be cleared. Otherwise
event that was just triggered by activity on the EINT pin will not be recognized in future.
Important: whenever a change of external interrupt operating mode (i.e. active
level/edge) is performed (including the initialization of an external interrupt), the
corresponding bit in the EXTINT register must be cleared! For details see
Section 3.6.3 “External Interrupt Mode register (EXTMODE - 0x400F C148)” and
Section 3.6.4 “External Interrupt Polarity register (EXTPOLAR - 0x400F C14C)”.
For example, if a system wakes up from Power-down using low level on external interrupt
0 pin, its post wake-up code must reset EINT0 bit in order to allow future entry into the
Power-down mode. If EINT0 bit is left set to 1, subsequent attempt(s) to invoke
Power-down mode will fail. The same goes for external interrupt handling.
More details on Power-down mode will be discussed in the following chapters.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
25 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
Table 10.
External Interrupt Flag register (EXTINT - address 0x400F C140) bit description
Bit
Symbol Description
Reset
value
0
EINT0
0
In level-sensitive mode, this bit is set if the EINT0 function is selected for
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT0 function is selected for its pin, and the selected edge
occurs on the pin.
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.[1]
1
EINT1
In level-sensitive mode, this bit is set if the EINT1 function is selected for
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT1 function is selected for its pin, and the selected edge
occurs on the pin.
0
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.[1]
2
EINT2
In level-sensitive mode, this bit is set if the EINT2 function is selected for
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT2 function is selected for its pin, and the selected edge
occurs on the pin.
0
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.[1]
3
EINT3
In level-sensitive mode, this bit is set if the EINT3 function is selected for
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT3 function is selected for its pin, and the selected edge
occurs on the pin.
0
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.[1]
31:4 [1]
Reserved, user software should not write ones to reserved bits. The value NA
read from a reserved bit is not defined.
Example: e.g. if the EINTx is selected to be low level sensitive and low level is present on
corresponding pin, this bit can not be cleared; this bit can be cleared only when signal on the
pin becomes high.
3.6.3 External Interrupt Mode register (EXTMODE - 0x400F C148)
The bits in this register select whether each EINT pin is level- or edge-sensitive. Only pins
that are selected for the EINT function (see Section 8.5) and enabled in the appropriate
NVIC register) can cause interrupts from the External Interrupt function (though of course
pins selected for other functions may cause interrupts from those functions).
Note: Software should only change a bit in this register when its interrupt is
disabled in the NVIC (state readable in the ISERn/ICERn registers), and should write
the corresponding 1 to EXTINT before enabling (initializing) or re-enabling the
interrupt. An extraneous interrupt(s) could be set by changing the mode and not
having the EXTINT cleared.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
26 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
Table 11.
External Interrupt Mode register (EXTMODE - address 0x400F C148) bit
description
Bit
Symbol
Value Description
Reset
value
0
EXTMODE0
0
Level-sensitivity is selected for EINT0.
0
1
EINT0 is edge sensitive.
1
2
3
EXTMODE1
EXTMODE2
EXTMODE3
31:4 -
0
Level-sensitivity is selected for EINT1.
1
EINT1 is edge sensitive.
0
Level-sensitivity is selected for EINT2.
1
EINT2 is edge sensitive.
0
0
0
Level-sensitivity is selected for EINT3.
1
EINT3 is edge sensitive.
-
Reserved, user software should not write ones to reserved
bits. The value read from a reserved bit is not defined.
0
NA
3.6.4 External Interrupt Polarity register (EXTPOLAR - 0x400F C14C)
In level-sensitive mode, the bits in this register select whether the corresponding pin is
high- or low-active. In edge-sensitive mode, they select whether the pin is rising- or
falling-edge sensitive. Only pins that are selected for the EINT function Only pins that are
selected for the EINT function (see Section 8.5) and enabled in the appropriate NVIC
register) can cause interrupts from the External Interrupt function (though of course pins
selected for other functions may cause interrupts from those functions).
Note: Software should only change a bit in this register when its interrupt is
disabled in the NVIC (state readable in the ISERn/ICERn registers), and should write
the corresponding 1 to EXTINT before enabling (initializing) or re-enabling the
interrupt. An extraneous interrupt(s) could be set by changing the polarity and not
having the EXTINT cleared.
Table 12.
Bit
Symbol
0
EXTPOLAR0 0
EINT0 is low-active or falling-edge sensitive (depending on
EXTMODE0).
1
EINT0 is high-active or rising-edge sensitive (depending on
EXTMODE0).
EXTPOLAR1 0
EINT1 is low-active or falling-edge sensitive (depending on
EXTMODE1).
1
EINT1 is high-active or rising-edge sensitive (depending on
EXTMODE1).
EXTPOLAR2 0
EINT2 is low-active or falling-edge sensitive (depending on
EXTMODE2).
1
EINT2 is high-active or rising-edge sensitive (depending on
EXTMODE2).
1
2
UM10360
User manual
External Interrupt Polarity register (EXTPOLAR - address 0x400F C14C) bit
description
Value Description
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Reset
value
0
0
0
© NXP B.V. 2014. All rights reserved.
27 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
Table 12.
Bit
Symbol
3
EXTPOLAR3 0
EINT3 is low-active or falling-edge sensitive (depending on
EXTMODE3).
1
EINT3 is high-active or rising-edge sensitive (depending on
EXTMODE3).
-
Reserved, user software should not write ones to reserved
bits. The value read from a reserved bit is not defined.
31:4 -
UM10360
User manual
External Interrupt Polarity register (EXTPOLAR - address 0x400F C14C) bit
description
Value Description
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Reset
value
0
NA
© NXP B.V. 2014. All rights reserved.
28 of 849
UM10360
NXP Semiconductors
Chapter 3: LPC176x/5x System control
3.7 Other system controls and status flags
Some aspects of controlling LPC176x/5x operation that do not fit into peripheral or other
registers are grouped here.
3.7.1 System Controls and Status register (SCS - 0x400F C1A0)
The SCS register contains several control/status bits related to the main oscillator. Since
chip operation always begins using the Internal RC Oscillator, and the main oscillator may
not be used at all in some applications, it will only be started by software request. This is
accomplished by setting the OSCEN bit in the SCS register, as described in Table 3-13.
The main oscillator provides a status flag (the OSCSTAT bit in the SCS register) so that
software can determine when the oscillator is running and stable. At that point, software
can control switching to the main oscillator as a clock source. Prior to starting the main
oscillator, a frequency range must be selected by configuring the
OSCRANGE bit in the SCS register.
Table 13.
Bit
Symbol
Value Description
3:0
-
-
4
OSCRANGE
5
6
User manual
Access Reset
value
Reserved. User software should not write ones to reserved bits. The value read from a reserved bit is
not defined.
NA
Main oscillator range select.
R/W
0
R/W
0
RO
0
0
The frequency range of the main oscillator is 1 MHz
to 20 MHz.
1
The frequency range of the main oscillator is
15 MHz to 25 MHz.
OSCEN
Main oscillator enable.
0
The main oscillator is disabled.
1
The main oscillator is enabled, and will start up if
the correct external circuitry is connected to the
XTAL1 and XTAL2 pins.
OSCSTAT
31:7 -
UM10360
System Controls and Status register (SCS - address 0x400F C1A0) bit description
Main oscillator status.
0
The main oscillator is not ready to be used as a
clock source.
1
The main oscillator is ready to be used as a clock
source. The main oscillator must be enabled via the
OSCEN bit.
-
Reserved. User software should not write ones to reserved bits. The value read from a reserved bit is
not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
NA
© NXP B.V. 2014. All rights reserved.
29 of 849
UM10360
Chapter 4: LPC176x/5x Clocking and power control
Rev. 3.1 — 2 April 2014
User manual
4.1 Summary of clocking and power control functions
This section describes the generation of the various clocks needed by the LPC176x/5x
and options of clock source selection, as well as power control and wake-up from reduced
power modes. Functions described in the following subsections include:
•
•
•
•
•
•
•
•
Oscillators
Clock source selection
PLLs
Clock dividers
APB dividers
Power control
Wake-up timer
External clock output
USB PLL settings
(PLL1...)
USB PLL
select
(PLL1CON)
USB PLL
(PLL1)
main PLL
settings
(PLL0...)
osc_clk
rtc_clk
irc_osc
sysclk
usb_clk
USB
Clock
Divider
CPU PLL
select
(PLL0CON)
USB clock divider setting
USBCLKCFG[3:0]
Main PLL
(PLL0)
system clock select
CLKSRCSEL[1:0]
`
pllclk
CPU
Clock
Divider
cclk
CPU clock divider setting
CCLKCFG[7:0]
watchdog clock select
WDCLKSEL[1:0]
Peripheral
Clock
Divider
pclk1
pclk2
pclk4
pclk8
wd_clk
PCLK_WDT
Fig 7.
Clock generation for the LPC176x/5x
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
30 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.2 Register description
All registers, regardless of size, are on word address boundaries. Details of the registers
appear in the description of each function.
Table 14.
Summary of system control registers
Name
Description
Access
Reset value Address
R/W
0
0x400F C10C
Clock source selection
CLKSRCSEL
Clock Source Select Register
Phase Locked Loop (PLL0, Main PLL)
PLL0CON
PLL0 Control Register
R/W
0
0x400F C080
PLL0CFG
PLL0 Configuration Register
R/W
0
0x400F C084
PLL0STAT
PLL0 Status Register
RO
0
0x400F C088
PLL0FEED
PLL0 Feed Register
WO
NA
0x400F C08C
PLL1 Control Register
R/W
0
0x400F C0A0
PLL1CFG
PLL1 Configuration Register
R/W
0
0x400F C0A4
PLL1STAT
PLL1 Status Register
RO
0
0x400F C0A8
PLL1FEED
PLL1 Feed Register
WO
NA
0x400F C0AC
CCLKCFG
CPU Clock Configuration Register
R/W
0
0x400F C104
USBCLKCFG
USB Clock Configuration Register
R/W
0
0x400F C108
PCLKSEL0
Peripheral Clock Selection register 0.
R/W
0
0x400F C1A8
PCLKSEL1
Peripheral Clock Selection register 1.
R/W
0
0x400F C1AC
PCON
Power Control Register
R/W
0
0x400F C0C0
PCONP
Power Control for Peripherals Register
R/W
0x03BE
0x400F C0C4
Clock Output Configuration Register
R/W
0
0x400F C1C8
Phase Locked Loop (PLL1, USB PLL)
PLL1CON
Clock dividers
Power control
Utility
CLKOUTCFG
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
31 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.3 Oscillators
The LPC176x/5x includes three independent oscillators. These are the Main Oscillator,
the Internal RC Oscillator, and the RTC oscillator. Each oscillator can be used for more
than one purpose as required in a particular application. This can be seen in Figure 7.
Following Reset, the LPC176x/5x will operate from the Internal RC Oscillator until
switched by software. This allows systems to operate without any external crystal, and
allows the boot loader code to operate at a known frequency.
4.3.1 Internal RC oscillator
The Internal RC Oscillator (IRC) may be used as the clock source for the watchdog timer,
and/or as the clock that drives PLL0 and subsequently the CPU. The precision of the IRC
does not allow for use of the USB interface, which requires a much more precise time
base in order to comply with the USB specification. Also, the IRC should not be used with
the CAN1/2 block if the CAN baud rate is higher than 100 kbit/s.The nominal IRC
frequency is 4 MHz.
Upon power-up or any chip reset, the LPC176x/5x uses the IRC as the clock source.
Software may later switch to one of the other available clock sources.
4.3.2 Main oscillator
The main oscillator can be used as the clock source for the CPU, with or without using
PLL0. The main oscillator operates at frequencies of 1 MHz to 25 MHz. This frequency
can be boosted to a higher frequency, up to the maximum CPU operating frequency, by
the Main PLL (PLL0). The oscillator output is called OSC_CLK. The clock selected as the
PLL0 input is PLLCLKIN and the ARM processor clock frequency is referred to as CCLK
for purposes of rate equations, etc. elsewhere in this document. The frequencies of
PLLCLKIN and CCLK are the same value unless the PLL0 is active and connected. Refer
to Section 4.5 “PLL0 (Phase Locked Loop 0)” for details.
The on-board oscillator in the LPC176x/5x can operate in one of two modes: slave mode
and oscillation mode.
In slave mode the input clock signal should be coupled by means of a capacitor of 100 pF
(CC in Figure 8, drawing a), with an amplitude between 200 mVrms and 1000 mVrms.
This corresponds to a square wave signal with a signal swing of between 280 mV and 1.4
V. The XTAL2 pin in this configuration can be left unconnected.
External components and models used in oscillation mode are shown in Figure 8,
drawings b and c, and in Table 15 and Table 16. Since the feedback resistance is
integrated on chip, only a crystal and the capacitances CX1 and CX2 need to be connected
externally in case of fundamental mode oscillation (the fundamental frequency is
represented by L, CL and RS). Capacitance CP in Figure 8, drawing c, represents the
parallel package capacitance and should not be larger than 7 pF. Parameters FC, CL, RS
and CP are supplied by the crystal manufacturer.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
32 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
LPC17xx
XTAL1
LPC17xx
XTAL2
XTAL1
XTAL2
L
<=>
CC
Clock
Xtal
CX1
a)
Fig 8.
CL
CX2
CP
RS
b)
c)
Oscillator modes and models: a) slave mode of operation, b) oscillation mode of operation, c) external
crystal model used for CX1/X2 evaluation
Table 15.
Recommended values for CX1/X2 in oscillation mode (crystal and external
components parameters) low frequency mode (OSCRANGE = 0, see Table 13)
Fundamental oscillation
frequency FOSC
Crystal load
capacitance CL
Maximum crystal
series resistance RS
External load
capacitors CX1, CX2
1 MHz to 5 MHz
10 pF
< 300
18 pF, 18 pF
20 pF
< 300
39 pF, 39 pF
30 pF
< 300
57 pF, 57 pF
10 pF
< 300
18 pF, 18 pF
20 pF
< 200
39 pF, 39 pF
30 pF
< 100
57 pF, 57 pF
10 pF
< 160
18 pF, 18 pF
20 pF
< 60
39 pF, 39 pF
10 pF
< 80
18 pF, 18 pF
5 MHz to 10 MHz
10 MHz to 15 MHz
15 MHz to 20 MHz
Table 16.
Recommended values for CX1/X2 in oscillation mode (crystal and external
components parameters) high frequency mode (OSCRANGE = 1, see Table 13)
Fundamental oscillation
frequency FOSC
Crystal load
capacitance CL
Maximum crystal
series resistance RS
External load
capacitors CX1, CX2
15 MHz to 20 MHz
10 pF
< 180
18 pF, 18 pF
20 pF
< 100
39 pF, 39 pF
10 pF
< 160
18 pF, 18 pF
20 pF
< 80
39 pF, 39 pF
20 MHz to 25 MHz
Since chip operation always begins using the Internal RC Oscillator, and the main
oscillator may not be used at all in some applications, it will only be started by software
request. This is accomplished by setting the OSCEN bit in the SCS register, as described
in Table 13. The main oscillator provides a status flag (the OSCSTAT bit in the SCS
register) so that software can determine when the oscillator is running and stable. At that
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
33 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
point, software can control switching to the main oscillator as a clock source. Prior to
starting the main oscillator, a frequency range must be selected by configuring the
OSCRANGE bit in the SCS register.
4.3.3 RTC oscillator
The RTC oscillator provides a 1 Hz clock to the RTC and a 32 kHz clock output that can
be used as the clock source for PLL0 and CPU and/or the watchdog timer.
Remark: The RTC oscillator must not be used as a clock source when the PLL0 output is
selected to drive the USB controller. In this case select the main oscillator as clock source
for PLL0 (see also Table 17).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
34 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.4 Clock source selection multiplexer
Several clock sources may be chosen to drive PLL0 and ultimately the CPU and on-chip
peripheral devices. The clock sources available are the main oscillator, the RTC oscillator,
and the Internal RC oscillator.
The clock source selection can only be changed safely when PLL0 is not connected. For a
detailed description of how to change the clock source in a system using PLL0 see
Section 4.5.13 “PLL0 setup sequence”.
Note the following restrictions regarding the choice of clock sources:
• Only the main oscillator must be used (via PLL0) as the clock source for the USB
subsystem. The IRC or RTC oscillators do not provide the proper tolerances for this
use.
• The IRC oscillator should not be used (via PLL0) as the clock source for the CAN
controllers if the CAN baud rate is higher than 100 kbit/s.
4.4.1 Clock Source Select register (CLKSRCSEL - 0x400F C10C)
The CLKSRCSEL register contains the bits that select the clock source for PLL0.
Table 17.
Clock Source Select register (CLKSRCSEL - address 0x400F C10C) bit
description
Bit
Symbol
1:0
CLKSRC
Value Description
Reset
value
Selects the clock source for PLL0 as follows:
0
00
Selects the Internal RC oscillator as the PLL0 clock source
(default).
01
Selects the main oscillator as the PLL0 clock source.
Remark: Select the main oscillator as PLL0 clock source if the
PLL0 clock output is used for USB or for CAN with baudrates
> 100 kBit/s.
10
Selects the RTC oscillator as the PLL0 clock source.
11
Reserved, do not use this setting.
Warning: Improper setting of this value, or an incorrect sequence of
changing this value may result in incorrect operation of the device.
31:2
UM10360
User manual
-
0
Reserved, user software should not write ones to reserved bits. NA
The value read from a reserved bit is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
35 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.5 PLL0 (Phase Locked Loop 0)
PLL0 accepts an input clock frequency in the range of 32 kHz to 50 MHz. The clock
source is selected in the CLKSRCSEL register (see Section 4.4). The input frequency is
multiplied up to a high frequency, then divided down to provide the actual clock used by
the CPU, peripherals, and optionally the USB subsystem. Note that the USB subsystem
has its own dedicated PLL (see Section 4.6). PLL0 can produce a clock up to the
maximum allowed for the CPU, which is 120 MHz on high speed versions (LPC1769 and
LPC1759), and 100 MHz on other versions.
4.5.1 PLL0 operation
The PLL input, in the range of 32 kHZ to 50 MHz, may initially be divided down by a value
"N", which may be in the range of 1 to 256. This input division provides a greater number
of possibilities in providing a wide range of output frequencies from the same input
frequency.
Following the PLL input divider is the PLL multiplier. This can multiply the input divider
output through the use of a Current Controlled Oscillator (CCO) by a value "M", in the
range of 6 through 512, plus additional values listed in Table 21. The resulting frequency
must be in the range of 275 MHz to 550 MHz. The multiplier works by dividing the CCO
output by the value of M, then using a phase-frequency detector to compare the divided
CCO output to the multiplier input. The error value is used to adjust the CCO frequency.
There are additional dividers at the output of PLL0 to bring the frequency down to what is
needed for the CPU, peripherals, and potentially the USB subsystem. PLL0 output
dividers are described in the Clock Dividers section following the PLL0 description. A
block diagram of PLL0 is shown in Figure 9
PLL activation is controlled via the PLL0CON register. PLL0 multiplier and divider values
are controlled by the PLL0CFG register. These two registers are protected in order to
prevent accidental alteration of PLL0 parameters or deactivation of the PLL. Since all chip
operations, including the Watchdog Timer, could be dependent on PLL0 if so configured
(for example when it is providing the chip clock), accidental changes to the PLL0 setup
values could result in unexpected or fatal behavior of the microcontroller. The protection is
accomplished by a feed sequence similar to that of the Watchdog Timer. Details are
provided in the description of the PLL0FEED register.
PLL0 is turned off and bypassed following a chip Reset and by entering Power-down
mode. PLL0 must be configured, enabled, and connected to the system by software.
It is important that the setup procedure described in Section 4.5.13 “PLL0 setup
sequence” is followed or PLL0 might not operate at all!
4.5.1.1 PLL0 and startup/boot code interaction
When there is no valid user code (determined by the checksum word) in the user flash or
the ISP enable pin (P2.10) is pulled low on startup, the ISP mode will be entered and the
boot code will setup the PLL with the IRC. Therefore it can not be assumed that the PLL is
disabled when the user opens a debug session to debug the application code. The user
startup code must follow the steps described in this chapter to disconnect the PLL.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
36 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.5.2 PLL0 register description
PLL0 is controlled by the registers shown in Table 18. More detailed descriptions follow.
Warning: Improper setting of PLL0 values may result in incorrect operation of the
device!
Table 18.
PLL0 registers
Name
Description
PLL0CON
PLL0 Control Register. Holding register for
R/W
updating PLL0 control bits. Values written to this
register do not take effect until a valid PLL0 feed
sequence has taken place.
0
0x400F C080
PLL0CFG
PLL0 Configuration Register. Holding register for R/W
updating PLL0 configuration values. Values
written to this register do not take effect until a
valid PLL0 feed sequence has taken place.
0
0x400F C084
PLL0STAT
PLL0 Status Register. Read-back register for
RO
PLL0 control and configuration information. If
PLL0CON or PLL0CFG have been written to, but
a PLL0 feed sequence has not yet occurred, they
will not reflect the current PLL0 state. Reading
this register provides the actual values controlling
the PLL0, as well as the PLL0 status.
0
0x400F C088
PLL0FEED
PLL0 Feed Register. This register enables
loading of the PLL0 control and configuration
information from the PLL0CON and PLL0CFG
registers into the shadow registers that actually
affect PLL0 operation.
NA
0x400F C08C
[1]
Access Reset
Address
value[1]
WO
Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
PLLC
PLLE
PLOCK
pd
refclk
pllclkin
N-DIVIDER
NSEL
[7:0]
PHASEFREQUENCY
DETECTOR
FILTER
M-DIVIDER
CCO
pllclk
/2
MSEL
[14:0]
Fig 9.
PLL0 block diagram
4.5.3 PLL0 Control register (PLL0CON - 0x400F C080)
The PLL0CON register contains the bits that enable and connect PLL0. Enabling PLL0
allows it to attempt to lock to the current settings of the multiplier and divider values.
Connecting PLL0 causes the processor and most chip functions to run from the PLL0
output clock. Changes to the PLL0CON register do not take effect until a correct PLL0
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
37 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
feed sequence has been given (see Section 4.5.8 “PLL0 Feed register (PLL0FEED 0x400F C08C)”).
Table 19.
PLL Control register (PLL0CON - address 0x400F C080) bit description
Bit
Symbol
Description
Reset
value
0
PLLE0
PLL0 Enable. When one, and after a valid PLL0 feed, this bit will activate 0
PLL0 and allow it to lock to the requested frequency. See PLL0STAT
register, Table 22.
1
PLLC0
PLL0 Connect. Setting PLLC0 to one after PLL0 has been enabled and
locked, then followed by a valid PLL0 feed sequence causes PLL0 to
become the clock source for the CPU, AHB peripherals, and used to
derive the clocks for APB peripherals. The PLL0 output may potentially
be used to clock the USB subsystem if the frequency is 48 MHz. See
PLL0STAT register, Table 22.
0
31:2
-
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
NA
PLL0 must be set up, enabled, and Lock established before it may be used as a clock
source. When switching from the oscillator clock to the PLL0 output or vice versa, internal
circuitry synchronizes the operation in order to ensure that glitches are not generated.
Hardware does not insure that PLL0 is locked before it is connected or automatically
disconnect PLL0 if lock is lost during operation. In the event of loss of lock on PLL0, it is
likely that the oscillator clock has become unstable and disconnecting PLL0 will not
remedy the situation.
4.5.4 PLL0 Configuration register (PLL0CFG - 0x400F C084)
The PLL0CFG register contains PLL0 multiplier and divider values. Changes to the
PLL0CFG register do not take effect until a correct PLL feed sequence has been given
(see Section 4.5.8 “PLL0 Feed register (PLL0FEED - 0x400F C08C)”). Calculations for
the PLL frequency, and multiplier and divider values are found in the Section 4.5.10 “PLL0
frequency calculation”.
Table 20.
PLL0 Configuration register (PLL0CFG - address 0x400F C084) bit description
Bit
Symbol
Description
Reset
value
14:0
MSEL0
PLL0 Multiplier value. Supplies the value "M" in PLL0 frequency
calculations. The value stored here is M - 1. Supported values for M
are 6 through 512 and those listed in Table 21.
0
Note: Not all values of M are needed, and therefore some are not
supported by hardware. For details on selecting values for MSEL0 see
Section 4.5.10 “PLL0 frequency calculation”.
15
-
23:16 NSEL0
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
NA
PLL0 Pre-Divider value. Supplies the value "N" in PLL0 frequency
0
calculations. The value stored here is N - 1. Supported values for N are
1 through 32.
Note: For details on selecting the right value for NSEL0 see
Section 4.5.10 “PLL0 frequency calculation”.
31:24 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
NA
© NXP B.V. 2014. All rights reserved.
38 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 21.
Multiplier values for PLL0 with a 32 kHz input
Multiplier
(M)
Pre-divide
(N)
FCCO
Multiplier
(M)
Pre-divide
(N)
FCCO
4272
1
279.9698
12085
2
396.0013
4395
1
288.0307
12207
2
399.9990
4578
1
300.0238
12817
2
419.9875
4725
1
309.6576
12817
3
279.9916
4807
1
315.0316
13184
2
432.0133
5127
1
336.0031
13184
3
288.0089
5188
1
340.0008
13672
2
448.0041
5400
1
353.8944
13733
2
450.0029
5493
1
359.9892
13733
3
300.0020
5859
1
383.9754
13916
2
455.9995
6042
1
395.9685
14099
2
461.9960
6075
1
398.1312
14420
3
315.0097
6104
1
400.0317
14648
2
479.9857
6409
1
420.0202
15381
2
504.0046
6592
1
432.0133
15381
3
336.0031
6750
1
442.3680
15564
3
340.0008
6836
1
448.0041
15625
2
512.0000
6866
1
449.9702
15869
2
519.9954
6958
1
455.9995
16113
2
527.9908
7050
1
462.0288
16479
3
359.9892
7324
1
479.9857
17578
3
383.9973
7425
1
486.6048
18127
3
395.9904
7690
1
503.9718
18311
3
400.0099
7813
1
512.0328
19226
3
419.9984
7935
1
520.0282
19775
3
431.9915
8057
1
528.0236
20508
3
448.0041
8100
1
530.8416
20599
3
449.9920
8545
2
280.0026
20874
3
455.9995
8789
2
287.9980
21149
3
462.0070
9155
2
299.9910
21973
3
480.0075
9613
2
314.9988
23071
3
503.9937
10254
2
336.0031
23438
3
512.0109
10376
2
340.0008
23804
3
520.0063
10986
2
359.9892
24170
3
528.0017
11719
2
384.0082
4.5.5 PLL0 Status register (PLL0STAT - 0x400F C088)
The read-only PLL0STAT register provides the actual PLL0 parameters that are in effect
at the time it is read, as well as PLL0 status. PLL0STAT may disagree with values found in
PLL0CON and PLL0CFG because changes to those registers do not take effect until a
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
39 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
proper PLL0 feed has occurred (see Section 4.5.8 “PLL0 Feed register (PLL0FEED 0x400F C08C)”).
Table 22.
PLL Status register (PLL0STAT - address 0x400F C088) bit description
Bit
Symbol
Description
14:0
MSEL0
Read-back for the PLL0 Multiplier value. This is the value currently 0
used by PLL0, and is one less than the actual multiplier.
15
-
Reserved, user software should not write ones to reserved bits.
The value read from a reserved bit is not defined.
NA
23:16 NSEL0
Read-back for the PLL0 Pre-Divider value. This is the value
currently used by PLL0, and is one less than the actual divider.
0
24
Reset
value
PLLE0_STAT Read-back for the PLL0 Enable bit. This bit reflects the state of the 0
PLEC0 bit in PLL0CON (see Table 19) after a valid PLL0 feed.
When one, PLL0 is currently enabled. When zero, PLL0 is turned
off. This bit is automatically cleared when Power-down mode is
entered.
25
PLLC0_STAT Read-back for the PLL0 Connect bit. This bit reflects the state of
the PLLC0 bit in PLL0CON (see Table 19) after a valid PLL0 feed.
0
When PLLC0 and PLLE0 are both one, PLL0 is connected as the
clock source for the CPU. When either PLLC0 or PLLE0 is zero,
PLL0 is bypassed. This bit is automatically cleared when
Power-down mode is entered.
26
PLOCK0
31:27 -
Reflects the PLL0 Lock status. When zero, PLL0 is not locked.
When one, PLL0 is locked onto the requested frequency. See text
for details.
0
Reserved, user software should not write ones to reserved bits.
The value read from a reserved bit is not defined.
NA
4.5.6 PLL0 Interrupt: PLOCK0
The PLOCK0 bit in the PLL0STAT register reflects the lock status of PLL0. When PLL0 is
enabled, or parameters are changed, PLL0 requires some time to establish lock under the
new conditions. PLOCK0 can be monitored to determine when PLL0 may be connected
for use. The value of PLOCK0 may not be stable when the PLL reference frequency
(FREF, the frequency of REFCLK, which is equal to the PLL input frequency divided by the
pre-divider value) is less than 100 kHz or greater than 20 MHz. In these cases, the PLL
may be assumed to be stable after a start-up time has passed. This time is 500 s when
FREF is greater than 400 kHz and 200 / FREF seconds when FREF is less than 400 kHz
PLOCK0 is connected to the interrupt controller. This allows for software to turn on PLL0
and continue with other functions without having to wait for PLL0 to achieve lock. When
the interrupt occurs, PLL0 may be connected, and the interrupt disabled. PLOCK0
appears as interrupt 32 in Table 50. Note that PLOCK0 remains asserted whenever PLL0
is locked, so if the interrupt is used, the interrupt service routine must disable the PLOCK0
interrupt prior to exiting.
4.5.7 PLL0 Modes
The combinations of PLLE0 and PLLC0 are shown in Table 23.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
40 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 23.
PLL control bit combinations
PLLC0 PLLE0 PLL Function
0
0
PLL0 is turned off and disconnected. PLL0 outputs the unmodified clock input.
0
1
PLL0 is active, but not yet connected. PLL0 can be connected after PLOCK0 is
asserted.
1
0
Same as 00 combination. This prevents the possibility of PLL0 being connected
without also being enabled.
1
1
PLL0 is active and has been connected as the system clock source.
4.5.8 PLL0 Feed register (PLL0FEED - 0x400F C08C)
A correct feed sequence must be written to the PLL0FEED register in order for changes to
the PLL0CON and PLL0CFG registers to take effect. The feed sequence is:
1. Write the value 0xAA to PLL0FEED.
2. Write the value 0x55 to PLL0FEED.
The two writes must be in the correct sequence, and there must be no other register
access in the same address space (0x400F C000 to 0x400F FFFF) between them.
Because of this, it may be necessary to disable interrupts for the duration of the PLL0 feed
operation, if there is a possibility that an interrupt service routine could write to another
register in that space. If either of the feed values is incorrect, or one of the previously
mentioned conditions is not met, any changes to the PLL0CON or PLL0CFG register will
not become effective.
Table 24.
PLL Feed register (PLL0FEED - address 0x400F C08C) bit description
Bit
Symbol
Description
Reset
value
7:0
PLL0FEED The PLL0 feed sequence must be written to this register in order for
PLL0 configuration and control register changes to take effect.
0x00
31:8
-
NA
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
4.5.9 PLL0 and Power-down mode
Power-down mode automatically turns off and disconnects PLL0. Wake-up from
Power-down mode does not automatically restore PLL0 settings, this must be done in
software. Typically, a routine to activate PLL0, wait for lock, and then connect PLL0 can be
called at the beginning of any interrupt service routine that might be called due to the
wake-up. It is important not to attempt to restart PLL0 by simply feeding it when execution
resumes after a wake-up from Power-down mode. This would enable and connect PLL0
at the same time, before PLL lock is established.
4.5.10 PLL0 frequency calculation
PLL0 equations use the following parameters:
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
41 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 25.
PLL frequency parameter
Parameter
Description
FIN
the frequency of PLLCLKIN from the Clock Source Selection Multiplexer.
FCCO
the frequency of the PLLCLK (output of the PLL Current Controlled Oscillator)
N
PLL0 Pre-divider value from the NSEL0 bits in the PLL0CFG register (PLL0CFG
NSEL0 field + 1). N is an integer from 1 through 32.
M
PLL0 Multiplier value from the MSEL0 bits in the PLL0CFG register (PLL0CFG
MSEL0 field + 1). Not all potential values are supported. See below.
FREF
PLL internal reference frequency, FIN divided by N.
The PLL0 output frequency (when PLL0 is both active and connected) is given by:
FCCO = (2
M
FIN) / N
PLL inputs and settings must meet the following:
• FIN is in the range of 32 kHz to 50 MHz.
• FCCO is in the range of 275 MHz to 550 MHz.
The equation can be solved for other PLL parameters:
M = (FCCO
N) / (2
N = (2
FIN) / FCCO
M
FIN = (FCCO
FIN)
N) / (2
M)
Allowed values for M:
At higher oscillator frequencies, in the MHz range, values of M from 6 through 512 are
allowed. This supports the entire useful range of both the main oscillator and the IRC.
For lower frequencies, specifically when the RTC is used to clock PLL0, a set of 65
additional M values have been selected for supporting baud rate generation, CAN
operation, and obtaining integer MHz frequencies. These values are shown in Table 26.
Table 26.
Additional Multiplier Values for use with a Low Frequency Clock Input
Low Frequency PLL Multipliers
UM10360
User manual
4272
4395
4578
4725
4807
5127
5188
5400
5493
5859
6042
6075
6104
6409
6592
6750
6836
6866
6958
7050
7324
7425
7690
7813
7935
8057
8100
8545
8789
9155
9613
10254
10376
10986
11719
12085
12207
12817
13184
13672
13733
13916
14099
14420
14648
15381
15564
15625
15869
16113
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
42 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 26.
Additional Multiplier Values for use with a Low Frequency Clock Input
Low Frequency PLL Multipliers
16479
17578
18127
18311
19226
19775
20508
20599
20874
21149
21973
23071
23438
23804
24170
4.5.11 Procedure for determining PLL0 settings
PLL0 parameter determination can be simplified by using a spreadsheet available from
NXP. To determine PLL0 parameters by hand, the following general procedure may be
used:
1. Determine if the application requires use of the USB interface, and whether it will be
clocked from PLL0. The USB requires a 50% duty cycle clock of 48 MHz within a very
small tolerance, which means that FCCO must be an even integer multiple of 48 MHz
(i.e. an integer multiple of 96 MHz), within a very small tolerance.
2. Choose the desired processor operating frequency (CCLK). This may be based on
processor throughput requirements, need to support a specific set of UART baud
rates, etc. Bear in mind that peripheral devices may be running from a lower clock
frequency than that of the processor (see Section 4.7 “Clock dividers” on page 55 and
Section 4.8 “Power control” on page 59). Find a value for FCCO that is close to a
multiple of the desired CCLK frequency, bearing in mind the requirement for USB
support in [1] above, and that lower values of FCCO result in lower power dissipation.
3. Choose a value for the PLL input frequency (FIN). This can be a clock obtained from
the main oscillator, the RTC oscillator, or the on-chip RC oscillator. For USB support,
the main oscillator should be used. Bear in mind that if PLL1 rather than PLL0 is used
to clock the USB subsystem, this affects the choice of the main oscillator frequency.
4. Calculate values for M and N to produce a sufficiently accurate FCCO frequency. The
desired M value -1 will be written to the MSEL0 field in PLL0CFG. The desired N value
-1 will be written to the NSEL0 field in PLL0CFG.
In general, it is better to use a smaller value for N, to reduce the level of multiplication that
must be accomplished by the CCO. Due to the difficulty in finding the best values in some
cases, it is recommended to use a spreadsheet or similar method to show many
possibilities at once, from which an overall best choice may be selected. A spreadsheet is
available from NXP for this purpose.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
43 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.5.12 Examples of PLL0 settings
The following table gives a summary of examples that illustrate selecting PLL0 values
based on different system requirements.
Table 27.
Summary of PLL0 examples
Example
Description
1
• The PLL0 clock source is 10 MHz.
• PLL0 is not used as the USB clock source, or the USB interface is not used.
• The desired CPU clock is 100 MHz.
2
• The PLL0 clock source is 4 MHz.
• PLL0 is used as the USB clock source.
• The desired CPU clock is 60 MHz.
3
• The PLL0 clock source is the 32.768 kHz RTC clock.
• PLL0 is not used as the USB clock source, or the USB interface is not used.
• The desired CPU clock is 72 MHz.
Example 1
Assumptions:
• The USB interface will not be used in the application, or will be clocked by PLL1.
• The desired CPU rate is 100 MHz.
• An external 10 MHz crystal or clock source will be used as the system clock source.
Calculations:
M = (FCCO
N) / (2
FIN)
A smaller value for the PLL pre-divide (N) as well as a smaller value of the multiplier (M),
both result in better PLL operational stability and lower output jitter. Lower values of FCCO
also save power. So, the process of determining PLL setup parameters involves looking
for the smallest N and M values giving the lowest FCCO value that will support the required
CPU and/or USB clocks. It is usually easier to work backward from the desired output
clock rate and determine a target FCCO rate, then find a way to obtain that FCCO rate from
the available input clock.
Potential precise values of FCCO are integer multiples of the desired CPU clock. In this
example, it is clear that the smallest frequency for FCCO that can produce the desired CPU
clock rate and is within the PLL0 operating range of 275 to 550 MHz is 300 MHz
(3 ´ 100 MHz).
Assuming that the PLL pre-divide is 1 (N = 1), the equation above gives
M = ((300 ´ 106 ´ 1) / (2 10 ´ 106) = 300 / 20 = 15. Since the result is an integer, there is
no need to look any further for a good set of PLL0 configuration values. The value written
to PLL0CFG would be 0x0E (N - 1 = 0; M - 1 = 14 gives 0x0E).
The PLL output must be further divided in order to produce the CPU clock. This is
accomplished using a separate divider that is described later in this chapter, see
Section 4.7.1.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
44 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Example 2
Assumptions:
• The USB interface will be used in the application and will be clocked from PLL0.
• The desired CPU rate is 60 MHz.
• An external 4 MHz crystal or clock source will be used as the system clock source.
This clock source could be the Internal RC oscillator (IRC).
Calculations:
M = (FCCO
N) / (2
FIN)
Because supporting USB requires a precise 48 MHz clock with a 50% duty cycle, that
need must be addressed first. Potential precise values of FCCO are integer multiples of the
2 ´ the 48 MHz USB clock. The 2 ´ insures that the clock has a 50% duty cycle, which
would not be the case for a division of the PLL output by an odd number.
The possibilities for the FCCO rate when the USB is used are 288 MHz, 384 MHz, and 480
MHz. The smallest frequency for FCCO that can produce a valid USB clock rate and is
within the PLL0 operating range is 288 MHz (3 ´ 2 ´ 48 MHz).
Start by assuming N = 1, since this produces the smallest multiplier needed for PLL0. So,
M = ((288 ´ 106) ´ 1) / (2 (4 ´ 106)) = 288 / 8 = 36. The result is an integer, which is
necessary to obtain a precise USB clock. The value written to PLL0CFG would be 0x23
(N - 1 = 0; M - 1 = 35 = 0x23).
The potential CPU clock rate can be determined by dividing FCCO by the desired CPU
frequency: 288 ´ 106 / 60 ´ 106 = 4.8. The nearest integer value for the CPU Clock Divider
is then 5, giving us 57.6 MHz as the nearest value to the desired CPU clock rate.
If it is important to obtain exactly 60 MHz, an FCCO rate must be found that can be divided
down to both 48 MHz and 60 MHz. As previously noted, the possibilities for the FCCO rate
when the USB is used are 288 MHz, 384 MHz, and 480 MHz. Of these, only is 480 MHz is
also evenly divisible by 60. Divided by 10, this gives the 48 MHz with a 50% duty cycle
needed by the USB subsystem. Divided by 8, it gives 60 MHz for the CPU clock. PLL0
settings for 480 MHz are N = 1 and M = 60.
The PLL output must be further divided in order to produce both the CPU clock and the
USB clock. This is accomplished using separate dividers that are described later in this
chapter. See Section 4.7.1 and Section 4.7.2.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
45 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Example 3
Assumptions:
• The USB interface will not be used in the application, or will be clocked by PLL1.
• The desired CPU rate is 72 MHz
• The 32.768 kHz RTC clock source will be used as the system clock source
Calculations:
M = (FCCO
N) / (2
FIN)
The smallest integer multiple of the desired CPU clock rate that is within the PLL0
operating range is 288 MHz (4 ´ 72 MHz).
Using the equation above and assuming that N = 1, M = ((288 ´ 106) ´ 1) / (2 32,768) =
4,394.53125. This is not an integer, so the CPU frequency will not be exactly 72 MHz with
this setting. Since this example is less obvious, it may be useful to make a table of
possibilities for different values of N (see below).
Table 28.
Potential values for PLL example
N
M
M Rounded
FREF in
Hz (FIN /
N)
FCCO in
CCLK in MHz
Error
MHz (FREF x (FCCO / 4)
(CCLK-72) / 72
M)
1
4394.53125
4395
32768
288.0307
72.0077
0.0107
2
8789.0625
8789
16384
287.9980
71.9995
-0.0007
3
13183.59375
13184
10922.67
288.0089
72.0022
0.0031
4
17578.125
17578
8192
287.9980
71.9995
-0.0007
5
21972.65625
21973
6553.6
288.0045
72.0011
0.0016
Beyond N = 5, the value of M is out of range or not supported, so the table stops at that
point. In the third column of the table, the calculated M value is rounded to the nearest
integer. If this results in CCLK being above the maximum operating frequency, it is
allowed if it is not more than 1/2 above the maximum frequency.
In general, larger values of FREF result in a more stable PLL when the input clock is a low
frequency. Even the first table entry shows a very small error of just over 1 hundredth of a
percent, or 107 parts per million (ppm). If that is not accurate enough in the application,
the second case gives a much smaller error of 7 ppm. There are no allowed combinations
that give a smaller error than that.
Remember that when a frequency below about 1 MHz is used as the PLL0 clock source,
not all multiplier values are available. As it turns out, all of the rounded M values found in
Table 28 of this example are supported, which may be confirmed in Table 26. If PLL0
calculations suggest use of unsupported multiplier values, those values must be
disregarded and other values examined to find the best fit.
The value written to PLL0CFG for the second table entry would be 0x12254
(N - 1 = 1 = 0x1; M - 1 = 8788 = 0x2254).
The PLL output must be further divided in order to produce the CPU clock. This is
accomplished using a separate divider that is described later in this chapter, see
Section 4.7.1.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
46 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.5.13 PLL0 setup sequence
The following sequence must be followed step by step in order to have PLL0 initialized
and running:
1. Disconnect PLL0 with one feed sequence if PLL0 is already connected.
2. Disable PLL0 with one feed sequence.
3. Change the CPU Clock Divider setting to speed up operation without PLL0, if desired.
4. Write to the Clock Source Selection Control register to change the clock source if
needed.
5. Write to the PLL0CFG and make it effective with one feed sequence. The PLL0CFG
can only be updated when PLL0 is disabled.
6. Enable PLL0 with one feed sequence.
7. Change the CPU Clock Divider setting for the operation with PLL0. It is critical to do
this before connecting PLL0.
8. Wait for PLL0 to achieve lock by monitoring the PLOCK0 bit in the PLL0STAT register,
or using the PLOCK0 interrupt, or wait for a fixed time when the input clock to PLL0 is
slow (i.e. 32 kHz). The value of PLOCK0 may not be stable when the PLL reference
frequency (FREF, the frequency of REFCLK, which is equal to the PLL input
frequency divided by the pre-divider value) is less than 100 kHz or greater than
20 MHz. In these cases, the PLL may be assumed to be stable after a start-up time
has passed. This time is 500 µs when FREF is greater than 400 kHz and 200 / FREF
seconds when FREF is less than 400 kHz.
9. Connect PLL0 with one feed sequence.
It is very important not to merge any steps above. For example, do not update the
PLL0CFG and enable PLL0 simultaneously with the same feed sequence.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
47 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.6 PLL1 (Phase Locked Loop 1)
PLL1 receives its clock input from the main oscillator only and can be used to provide a
fixed 48 MHz clock only to the USB subsystem. This is an option in addition to the
possibility of generating the USB clock from PLL0.
PLL1 is disabled and powered off on reset. If PLL1 is left disabled, the USB clock can be
supplied by PLL0 if everything is set up to provide 48 MHz through that route. If PLL1 is
enabled and connected via the PLL1CON register (see Section 4.6.2), it is automatically
selected to drive the USB subsystem (see Figure 7).
PLL1 activation is controlled via the PLL1CON register. PLL1 multiplier and divider values
are controlled by the PLL1CFG register. These two registers are protected in order to
prevent accidental alteration of PLL1 parameters or deactivation of PLL1. The protection
is accomplished by a feed sequence similar to that of the Watchdog Timer. Details are
provided in the description of the PLL1FEED register.
PLL1 accepts an input clock frequency in the range of 10 MHz to 25 MHz only. The input
frequency is multiplied up to the range of 48 MHz for the USB clock using a Current
Controlled Oscillator (CCO). The multiplier can be an integer value from 1 to 32 (for USB,
the multiplier value cannot be higher than 4. The CCO operates in the range of 156 MHz
to 320 MHz, so there is an additional divider in the loop to keep the CCO within its
frequency range while PLL1 is providing the desired output frequency. The output divider
may be set to divide by 2, 4, 8, or 16 to produce the output clock. Since the minimum
output divider value is 2, it is insured that the output of PLL1 has a 50% duty cycle. A
block diagram of PLL1 is shown in Figure 10.
4.6.1 PLL1 register description
PLL1 is controlled by the registers shown in Table 29. More detailed descriptions follow.
Writes to any unused bits are ignored. A read of any unused bits will return a logic zero.
Warning: Improper setting of PLL1 values may result in incorrect operation of the
USB subsystem!
Table 29.
UM10360
User manual
PLL1 registers
Name
Description
PLL1CON
PLL1 Control Register. Holding register for
R/W
updating PLL1 control bits. Values written to this
register do not take effect until a valid PLL1 feed
sequence has taken place.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Access Reset
Address
value[1]
0
0x400F C0A0
© NXP B.V. 2014. All rights reserved.
48 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 29.
PLL1 registers
Name
Description
Access Reset
Address
value[1]
PLL1CFG
PLL1 Configuration Register. Holding register
for updating PLL1 configuration values. Values
written to this register do not take effect until a
valid PLL1 feed sequence has taken place.
R/W
PLL1STAT
PLL1FEED
[1]
0
0x400F C0A4
PLL1 Status Register. Read-back register for
RO
PLL1 control and configuration information. If
PLL1CON or PLL1CFG have been written to,
but a PLL1 feed sequence has not yet occurred,
they will not reflect the current PLL1 state.
Reading this register provides the actual values
controlling PLL1, as well as PLL1 status.
0
0x400F C0A8
PLL1 Feed Register. This register enables
loading of PLL1 control and configuration
information from the PLL1CON and PLL1CFG
registers into the shadow registers that actually
affect PLL1 operation.
NA
0x400F C0AC
WO
Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
PLOCK
PLLSTAT[10]
PLL input
clock
Phase
Detector
CurrentControlled
Oscillator
Fcco
Divide by 2P
PLL output
clock
PSEL
PLLSTAT[6:5]
Divide by M
MSEL
PLLSTAT[4:0]
100416
Fig 10. PLL1 block diagram
4.6.2 PLL1 Control register (PLL1CON - 0x400F C0A0)
The PLL1CON register contains the bits that enable and connect PLL1. Enabling PLL1
allows it to attempt to lock to the current settings of the multiplier and divider values.
Connecting PLL1 causes the USB subsystem to run from the PLL1 output clock. Changes
to the PLL1CON register do not take effect until a correct PLL feed sequence has been
given (see Section 4.6.6 and Section 4.6.3).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
49 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 30.
PLL1 Control register (PLL1CON - address 0x400F C0A0) bit description
Bit
Symbol
Description
Reset
value
0
PLLE1
PLL1 Enable. When one, and after a valid PLL1 feed, this bit will
activate PLL1 and allow it to lock to the requested frequency. See
PLL1STAT register, Table 32.
0
1
PLLC1
PLL1 Connect. Setting PLLC to one after PLL1 has been enabled and
locked, then followed by a valid PLL1 feed sequence causes PLL1 to
become the clock source for the USB subsystem via the USB clock
divider. See PLL1STAT register, Table 32.
0
31:2
-
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
NA
PLL1 must be set up, enabled, and lock established before it may be used as a clock
source for the USB subsystem. The hardware does not insure that the PLL is locked
before it is connected nor does it automatically disconnect the PLL if lock is lost during
operation.
4.6.3 PLL1 Configuration register (PLL1CFG - 0x400F C0A4)
The PLL1CFG register contains the PLL1 multiplier and divider values. Changes to the
PLL1CFG register do not take effect until a correct PLL1 feed sequence has been given
(see Section 4.6.6). Calculations for the PLL1 frequency, and multiplier and divider values
are found in Section 4.6.9.
Table 31.
PLL Configuration register (PLL1CFG - address 0x400F C0A4) bit description
Bit
Symbol
Description
Reset
value
4:0
MSEL1
PLL1 Multiplier value. Supplies the value "M" in the PLL1 frequency
calculations.
0
Note: For details on selecting the right value for MSEL1 see
Section 4.6.8.
6:5
PSEL1
PLL1 Divider value. Supplies the value "P" in the PLL1 frequency
calculations.
0
Note: For details on selecting the right value for PSEL1 see
Section 4.6.8.
31:7
-
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
NA
4.6.4 PLL1 Status register (PLL1STAT - 0x400F C0A8)
The read-only PLL1STAT register provides the actual PLL1 parameters that are in effect
at the time it is read, as well as the PLL1 status. PLL1STAT may disagree with values
found in PLL1CON and PLL1CFG because changes to those registers do not take effect
until a proper PLL1 feed has occurred (see Section 4.6.6 “PLL1 Feed register (PLL1FEED
- 0x400F C0AC)”).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
50 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 32.
PLL1 Status register (PLL1STAT - address 0x400F C0A8) bit description
Bit
Symbol
Description
4:0
MSEL1
Read-back for the PLL1 Multiplier value. This is the value currently 0
used by PLL1.
6:5
PSEL1
Read-back for the PLL1 Divider value. This is the value currently
used by PLL1.
0
7
-
Reserved, user software should not write ones to reserved bits.
The value read from a reserved bit is not defined.
NA
8
PLLE1_STAT Read-back for the PLL1 Enable bit. When one, PLL1 is currently
activated. When zero, PLL1 is turned off. This bit is automatically
cleared when Power-down mode is activated.
9
PLLC1_STAT Read-back for the PLL1 Connect bit. When PLLC and PLLE are
0
both one, PLL1 is connected as the clock source for the
microcontroller. When either PLLC or PLLE is zero, PLL1 is
bypassed and the oscillator clock is used directly by the
microcontroller. This bit is automatically cleared when Power-down
mode is activated.
10
PLOCK1
31:11 -
Reset
value
0
Reflects the PLL1 Lock status. When zero, PLL1 is not locked.
When one, PLL1 is locked onto the requested frequency.
0
Reserved, user software should not write ones to reserved bits.
The value read from a reserved bit is not defined.
NA
4.6.4.1 PLL1 modes
The combinations of PLLE1 and PLLC1 are shown in Table 33.
Table 33.
PLL1 control bit combinations
PLLC1
PLLE1
PLL1 Function
0
0
PLL1 is turned off and disconnected.
0
1
PLL1 is active, but not yet connected. PLL1 can be connected after PLOCK1
is asserted.
1
0
Same as 00 combination. This prevents the possibility of PLL1 being
connected without also being enabled.
1
1
PLL1 is active and has been connected. The clock for the USB subsystem is
sourced from PLL1.
4.6.5 PLL1 Interrupt: PLOCK1
The PLOCK1 bit in the PLL1STAT register reflects the lock status of PLL1. When PLL1 is
enabled, or parameters are changed, the PLL requires some time to establish lock under
the new conditions. PLOCK1 can be monitored to determine when the PLL may be
connected for use.
PLOCK1 is connected to the interrupt controller. This allows for software to turn on the
PLL and continue with other functions without having to wait for the PLL to achieve lock.
When the interrupt occurs, the PLL may be connected, and the interrupt disabled.
PLOCK1 appears as interrupt 48 in Table 50. Note that PLOCK1 remains asserted
whenever PLL1 is locked, so if the interrupt is used, the interrupt service routine must
disable the PLOCK1 interrupt prior to exiting.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
51 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.6.6 PLL1 Feed register (PLL1FEED - 0x400F C0AC)
A correct feed sequence must be written to the PLL1FEED register in order for changes to
the PLL1CON and PLL1CFG registers to take effect. The feed sequence is:
1. Write the value 0xAA to PLL1FEED.
2. Write the value 0x55 to PLL1FEED.
The two writes must be in the correct sequence, and there must be no other register
access in the same address space (0x400F C000 to 0x400F FFFF) between them.
Because of this, it may be necessary to disable interrupts for the duration of the PLL feed
operation, if there is a possibility that an interrupt service routine could write to another
register in that space. If either of the feed values is incorrect, or one of the previously
mentioned conditions is not met, any changes to the PLL1CON or PLL1CFG register will
not become effective.
Table 34.
PLL1 Feed register (PLL1FEED - address 0x400F C0AC) bit description
Bit
Symbol
Description
Reset
value
7:0
PLL1FEED
The PLL1 feed sequence must be written to this register in order for
PLL1 configuration and control register changes to take effect.
0x00
31:8
-
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
NA
4.6.7 PLL1 and Power-down mode
Power-down mode automatically turns off and disconnects activated PLL(s). Wake-up
from Power-down mode does not automatically restore PLL settings, this must be done in
software. Typically, a routine to activate the PLL, wait for lock, and then connect the PLL
can be called at the beginning of any interrupt service routine that might be called due to
the wake-up. It is important not to attempt to restart a PLL by simply feeding it when
execution resumes after a wake-up from Power-down mode. This would enable and
connect the PLL at the same time, before PLL lock is established.
If activity on the USB data lines is not selected to wake the microcontroller from
Power-down mode (see Section 4.8.8 for details of wake up from reduced modes), both
the Main PLL (PLL0) and the USB PLL (PLL1) will be automatically be turned off and
disconnected when Power-down mode is invoked, as described above. However, if the
USB activity interrupt is enabled and USB_NEED_CLK = 1 (see Table 192 for a
description of USB_NEED_CLK), it is not possible to go into Power-down mode and any
attempt to set the PD bit will fail, leaving the PLLs in the current state.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
52 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.6.8 PLL1 frequency calculation
The PLL1 equations use the following parameters:
Table 35.
Elements determining PLL frequency
Element
Description
FOSC
the frequency from the crystal oscillator
FCCO
the frequency of the PLL1 current controlled oscillator
USBCLK
the PLL1 output frequency (48 MHz for USB)
M
PLL1 Multiplier value from the MSEL1 bits in the PLL1CFG register
P
PLL1 Divider value from the PSEL1 bits in the PLL1CFG register
The PLL1 output frequency (when the PLL is both active and connected) is given by:
USBCLK = M
FOSC or USBCLK = FCCO / (2
P)
The CCO frequency can be computed as:
FCCO = USBCLK
2
P or FCCO = FOSC ´ M
2
P
The PLL1 inputs and settings must meet the following criteria:
• FOSC is in the range of 10 MHz to 25 MHz.
• USBCLK is 48 MHz.
• FCCO is in the range of 156 MHz to 320 MHz.
4.6.9 Procedure for determining PLL1 settings
The PLL1 configuration for USB may be determined as follows:
1. The desired PLL1 output frequency is USBCLK = 48 MHz.
2. Choose an oscillator frequency (FOSC). USBCLK must be the whole (non-fractional)
multiple of FOSC meaning that the possible values for FOSC are 12 MHz, 16 MHz, and
24 MHz.
3. Calculate the value of M to configure the MSEL1 bits. M = USBCLK / FOSC. In this
case, the possible values for M = 2, 3, or 4 (FOSC = 24 MHz, 16 MHz, or 12 MHz). The
value written to the MSEL1 bits in PLL1CFG is M - 1 (see Table 37).
4. Find a value for P to configure the PSEL1 bits, such that FCCO is within its defined
frequency limits of 156 MHz to 320 MHz. FCCO is calculated using FCCO = USBCLK
2 P. It follows that P = 2 is the only P value to yield FCCO in the allowed range. The
value written to the PSEL1 bits in PLL1CFG is ‘01’ for P = 2 (see Table 36).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
53 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 36. PLL1 Divider values
Values allowed for using PLL1 with USB are highlighted.
PSEL1 Bits (PLL1CFG bits [6:5])
Value of P
00
1
01
2
10
4
11
8
Table 37. PLL1 Multiplier values
Values allowed for using PLL1 with USB are highlighted.
UM10360
User manual
MSEL1 Bits (PLL1CFG bits [4:0])
Value of M
00000
1
00001
2
00010
3
00011
4
...
...
11110
31
11111
32
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
54 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.7 Clock dividers
The output of the PLL0 must be divided down for use by the CPU and the USB subsystem
(if used with PLL0, see Section 4.6). Separate dividers are provided such that the CPU
frequency can be determined independently from the USB subsystem, which always
requires 48 MHz with a 50% duty cycle for proper operation.
USB PLL settings
(PLL1...)
osc_clk
USB PLL select
(PLL1CON)
USB PLL
(PLL1)
main PLL
settings
(PLL0...)
sysclk
CPU PLL
select
(PLL0CON)
Main PLL
(PLL0)
pllclk
USB
Clock
Divider
usb_clk
USB clock divider setting
USBCLKCFG[3:0]
CPU
Clock
Divider
cclk
CPU clock divider setting
CCLKCFG[7:0]
Fig 11. PLLs and clock dividers
4.7.1 CPU Clock Configuration register (CCLKCFG - 0x400F C104)
The CCLKCFG register controls the division of the PLL0 output before it is used by the
CPU. When PLL0 is bypassed, the division may be by 1. When PLL0 is running, the
output must be divided in order to bring the CPU clock frequency (CCLK) within operating
limits. An 8-bit divider allows a range of options, including slowing CPU operation to a low
rate for temporary power savings without turning off PLL0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
55 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 38.
CPU Clock Configuration register (CCLKCFG - address 0x400F C104) bit
description
Bit
Symbol
7:0
CCLKSEL
31:8
-
Value
Description
Reset
value
Selects the divide value for creating the CPU clock (CCLK)
from the PLL0 output.
0x00
0
pllclk is divided by 1 to produce the CPU clock. This setting is
not allowed when the PLL0 is connected, because the rate
would always be greater than the maximum allowed CPU
clock.
1
pllclk is divided by 2 to produce the CPU clock. This setting is
not allowed when the PLL0 is connected, because the rate
would always be greater than the maximum allowed CPU
clock.
2
pllclk is divided by 3 to produce the CPU clock.
3
pllclk is divided by 4 to produce the CPU clock.
4
pllclk is divided by 5 to produce the CPU clock.
:
:
255
pllclk is divided by 256 to produce the CPU clock.
Reserved, user software should not write ones to reserved
bits. The value read from a reserved bit is not defined.
NA
The CCLK is derived from the PLL0 output signal, divided by CCLKSEL + 1. Having
CCLKSEL = 2 results in CCLK being one third of the PLL0 output, CCLKSEL = 3 results in
CCLK being one quarter of the PLL0 output, etc.
4.7.2 USB Clock Configuration register (USBCLKCFG - 0x400F C108)
This register is used only if the USB PLL (PLL1) is not connected (via the PLLC1 bit in
PLL1CON). If PLL1 is connected, its output is automatically used as the USB clock
source, and PLL1 must be configured to supply the correct 48 MHz clock to the USB
subsystem. If PLL1 is not connected, the USB subsystem will be driven by PLL0 via the
USB clock divider.
The USBCLKCFG register controls the division of the PLL0 output before it is used by the
USB subsystem.The PLL0 output must be divided in order to bring the USB clock
frequency to 48 MHz with a 50% duty cycle. A 4-bit divider allows obtaining the correct
USB clock from any even multiple of 48 MHz (i.e. any multiple of 96 MHz) within the PLL
operating range.
Remark: The Internal RC oscillator should not be used to drive PLL0 when the USB is
using PLL0 as a clock source because a more precise clock is needed for USB
specification compliance (see Table 17).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
56 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 39.
USB Clock Configuration register (USBCLKCFG - address 0x400F C108) bit
description
Bit
Symbol
3:0
USBSEL
Value Description
Reset
value
Selects the divide value for creating the USB clock from the
PLL0 output. Only the values shown below can produce even
number multiples of 48 MHz from the PLL0 output.
0
Warning: Improper setting of this value will result in incorrect
operation of the USB interface.
31:4
5
PLL0 output is divided by 6. PLL0 output must be 288 MHz.
7
PLL0 output is divided by 8. PLL0 output must be 384 MHz.
9
PLL0 output is divided by 10. PLL0 output must be 480 MHz.
-
Reserved, user software should not write ones to reserved
bits. The value read from a reserved bit is not defined.
NA
4.7.3 Peripheral Clock Selection registers 0 and 1 (PCLKSEL0 0x400F C1A8 and PCLKSEL1 - 0x400F C1AC)
A pair of bits in a Peripheral Clock Selection register controls the rate of the clock signal
that will be supplied to the corresponding peripheral as specified in Table 40, Table 41 and
Table 42.
Remark: The peripheral clock for the RTC block is fixed at CCLK/8.
Table 40.
Bit
Symbol
Description
Reset
value
1:0
PCLK_WDT
Peripheral clock selection for WDT.
00
3:2
PCLK_TIMER0
Peripheral clock selection for TIMER0.
00
5:4
PCLK_TIMER1
Peripheral clock selection for TIMER1.
00
7:6
PCLK_UART0
Peripheral clock selection for UART0.
00
9:8
PCLK_UART1
Peripheral clock selection for UART1.
00
11:10
-
Reserved.
NA
13:12
PCLK_PWM1
Peripheral clock selection for PWM1.
00
15:14
PCLK_I2C0
Peripheral clock selection for I2C0.
00
17:16
PCLK_SPI
Peripheral clock selection for SPI.
00
19:18
-
Reserved.
NA
21:20
PCLK_SSP1
Peripheral clock selection for SSP1.
00
23:22
PCLK_DAC
Peripheral clock selection for DAC.
00
25:24
PCLK_ADC
Peripheral clock selection for ADC.
00
PCLK_CAN1
Peripheral clock selection for
29:28
PCLK_CAN2
Peripheral clock selection for CAN2.[1]
[1]
User manual
CAN1.[1]
27:26
31:30
UM10360
Peripheral Clock Selection register 0 (PCLKSEL0 - address 0x400F C1A8) bit
description
PCLK_ACF
Peripheral clock selection for CAN acceptance
00
00
filtering.[1]
00
PCLK_CAN1 and PCLK_CAN2 must have the same PCLK divide value when the CAN function is used.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
57 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 41.
Bit
Symbol
Description
Reset
value
1:0
PCLK_QEI
Peripheral clock selection for the Quadrature Encoder
Interface.
00
3:2
PCLK_GPIOINT
Peripheral clock selection for GPIO interrupts.
00
5:4
PCLK_PCB
Peripheral clock selection for the Pin Connect block.
00
7:6
PCLK_I2C1
Peripheral clock selection for I2C1.
00
9:8
-
Reserved.
NA
11:10
PCLK_SSP0
Peripheral clock selection for SSP0.
00
13:12
PCLK_TIMER2
Peripheral clock selection for TIMER2.
00
15:14
PCLK_TIMER3
Peripheral clock selection for TIMER3.
00
17:16
PCLK_UART2
Peripheral clock selection for UART2.
00
19:18
PCLK_UART3
Peripheral clock selection for UART3.
00
21:20
PCLK_I2C2
Peripheral clock selection for I2C2.
00
23:22
PCLK_I2S
Peripheral clock selection for I2S.
00
25:24
-
Reserved.
NA
27:26
PCLK_RIT
Peripheral clock selection for Repetitive Interrupt Timer.
00
29:28
PCLK_SYSCON
Peripheral clock selection for the System Control block.
00
31:30
PCLK_MC
Peripheral clock selection for the Motor Control PWM.
00
Table 42.
UM10360
User manual
Peripheral Clock Selection register 1 (PCLKSEL1 - address 0x400F C1AC) bit
description
Peripheral Clock Selection register bit values
PCLKSEL0 and PCLKSEL1 Function
individual peripheral’s clock
select options
Reset
value
00
PCLK_peripheral = CCLK/4
00
01
PCLK_peripheral = CCLK
10
PCLK_peripheral = CCLK/2
11
PCLK_peripheral = CCLK/8, except for CAN1, CAN2, and
CAN filtering when “11” selects = CCLK/6.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
58 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.8 Power control
The LPC176x/5x supports a variety of power control features: Sleep mode, Deep Sleep
mode, Power-down mode, and Deep Power-down mode. The CPU clock rate may also be
controlled as needed by changing clock sources, re-configuring PLL values, and/or
altering the CPU clock divider value. This allows a trade-off of power versus processing
speed based on application requirements. In addition, Peripheral Power Control allows
shutting down the clocks to individual on-chip peripherals, allowing fine tuning of power
consumption by eliminating all dynamic power use in any peripherals that are not required
for the application.
Entry to any reduced power mode begins with the execution of either a WFI (Wait For
Interrupt) or WFE (Wait For Exception) instruction by the Cortex-M3. The Cortex-M3
internally supports two reduced power modes: Sleep and Deep Sleep. These are selected
by the SLEEPDEEP bit in the cortex-M3 System Control Register. Power-down and Deep
Power-down modes are selected by bits in the PCON register. See Table 44. The same
register contains flags that indicate whether entry into each reduced power mode actually
occurred.
The LPC176x/5x also implements a separate power domain in order to allow turning off
power to the bulk of the device while maintaining operation of the Real Time Clock.
Reduced power modes have some limitation during debug, see Section 33.5 for more
information.
4.8.1 Sleep mode
Note: Sleep mode on the LPC176x/5x corresponds to the Idle mode on LPC2xxx series
devices. The name is changed because ARM has incorporated portions of reduced power
mode control into the Cortex-M3. LPC176x/5x documentation uses the Cortex-M3
terminology where applicable.
When Sleep mode is entered, the clock to the core is stopped, and the SMFLAG bit in
PCON is set, see Table 44.Resumption from the Sleep mode does not need any special
sequence but re-enabling the clock to the ARM core.
In Sleep mode, execution of instructions is suspended until either a Reset or an interrupt
occurs. Peripheral functions continue operation during Sleep mode and may generate
interrupts to cause the processor to resume execution. Sleep mode eliminates dynamic
power used by the processor itself, memory systems and related controllers, and internal
buses.
The GPDMA may operate in Sleep mode to access AHB SRAMs and peripherals with
GPDMA support, but the GPDMA cannot access the flash memory or the main SRAM,
which are disabled in order to save power.
Wake-up from Sleep mode will occur whenever any enabled interrupt occurs.
4.8.2 Deep Sleep mode
Note: Deep Sleep mode on the LPC176x/5x corresponds to the Sleep mode on LPC23xx
and LPC24xx series devices. The name is changed because ARM has incorporated
portions of reduced power mode control into the Cortex-M3. LPC176x/5x documentation
uses the Cortex-M3 terminology where applicable.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
59 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
When the chip enters the Deep Sleep mode, the main oscillator is powered down, nearly
all clocks are stopped, and the DSFLAG bit in PCON is set, see Table 44. The IRC
remains running and can be configured to drive the Watchdog Timer, allowing the
Watchdog to wake up the CPU. The 32 kHz RTC oscillator is not stopped and RTC
interrupts may be used as a wake-up source. The flash is left in the standby mode
allowing a quick wake-up. The PLLs are automatically turned off and disconnected. The
CCLK and USBCLK clock dividers automatically get reset to zero.
The processor state and registers, peripheral registers, and internal SRAM values are
preserved throughout Deep Sleep mode and the logic levels of chip pins remain static.
The Deep Sleep mode can be terminated and normal operation resumed by either a
Reset or certain specific interrupts that are able to function without clocks. Since all
dynamic operation of the chip is suspended, Deep Sleep mode reduces chip power
consumption to a very low value.
On the wake-up of Deep Sleep mode, if the IRC was used before entering Deep Sleep
mode, a 2-bit IRC timer starts counting and the code execution and peripherals activities
will resume after the timer expires (4 cycles). If the main external oscillator was used, the
12-bit main oscillator timer starts counting and the code execution will resume when the
timer expires (4096 cycles). The user must remember to re-configure any required PLLs
and clock dividers after the wake-up.
Wake-up from Deep Sleep mode can be brought about by NMI, External Interrupts EINT0
through EINT3, GPIO interrupts, the Ethernet Wake-on-LAN interrupt, Brownout Detect,
an RTC Alarm interrupt, a Watchdog Timer time out, a USB input pin transition (USB
activity interrupt), or a CAN input pin transition, when the related interrupt is enabled.
Wake-up will occur whenever any enabled interrupt occurs.
4.8.3 Power-down mode
Power-down mode does everything that Deep Sleep mode does, but also turns off the
flash memory. Entry to Power-down mode causes the PDFLAG bit in PCON to be set, see
Table 44. This saves more power, but requires waiting for resumption of flash operation
before execution of code or data access in the flash memory can be accomplished.
When the chip enters Power-down mode, the IRC, the main oscillator, and all clocks are
stopped. The RTC remains running if it has been enabled and RTC interrupts may be
used to wake up the CPU. The flash is forced into Power-down mode. The PLLs are
automatically turned off and disconnected. The CCLK and USBCLK clock dividers
automatically get reset to zero.
Upon wake-up from Power-down mode, if the IRC was used before entering Power-down
mode, after IRC-start-up time (about 60 s), the 2-bit IRC timer starts counting and
expiring in 4 cycles. Code execution can then be resumed immediately following the
expiration of the IRC timer if the code was running from SRAM. In the meantime, the flash
wake-up timer measures flash start-up time of about 100 s. When it times out, access to
the flash is enabled. The user must remember to re-configure any required PLLs and
clock dividers after the wake-up.
Wake-up from Power-down mode can be brought about by NMI, External Interrupts EINT0
through EINT3, GPIO interrupts, the Ethernet Wake-on-LAN interrupt, Brownout Detect,
an RTC Alarm interrupt, a USB input pin transition (USB activity interrupt), or a CAN input
pin transition, when the related interrupt is enabled.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
60 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.8.4 Deep Power-down mode
In Deep Power-down mode, power is shut off to the entire chip with the exception of the
Real-Time Clock, the RESET pin, the WIC, and the RTC backup registers. Entry to Deep
Power-down mode causes the DPDFLAG bit in PCON to be set, see Table 44.
To optimize power conservation, the user has the additional option of turning off or
retaining power to the 32 kHz oscillator. It is also possible to use external circuitry to turn
off power to the on-chip regulator via the VDD(REG)(3V3) pins after entering Deep
Power-down mode.Power to the on-chip regulator must be restored before device
operation can be restarted.
Wake-up from Deep Power-down mode will occur when an external reset signal is
applied, or the RTC interrupt is enabled and an RTC interrupt is generated.
4.8.5 Peripheral power control
A Power Control for Peripherals feature allows individual peripherals to be turned off if
they are not needed in the application, resulting in additional power savings. This is
detailed in the description of the PCONP register.
4.8.6 Register description
The Power Control function uses registers shown in Table 43. More detailed descriptions
follow.
Table 43.
Power Control registers
Name
Description
Access
Reset
value[1]
Address
PCON
Power Control Register. This register contains
control bits that enable some reduced power
operating modes of the LPC176x/5x. See
Table 44.
R/W
0x00
0x400F C0C0
PCONP
Power Control for Peripherals Register. This
register contains control bits that enable and
disable individual peripheral functions, allowing
elimination of power consumption by peripherals
that are not needed.
R/W
[1]
UM10360
User manual
0x400F C0C4
Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
61 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.8.7 Power Mode Control register (PCON - 0x400F C0C0)
Controls for some reduced power modes and other power related controls are contained
in the PCON register, as described in Table 44.
Table 44.
Power Mode Control register (PCON - address 0x400F C0C0) bit description
Bit
Symbol
Description
Reset
value
0
PM0
Power mode control bit 0. This bit controls entry to the Power-down
mode. See Section 4.8.7.1 below for details.
0
1
PM1
Power mode control bit 1. This bit controls entry to the Deep
Power-down mode. See Section 4.8.7.1 below for details.
0
2
BODRPM
Brown-Out Reduced Power Mode. When BODRPM is 1, the
0
Brown-Out Detect circuitry will be turned off when chip Power-down
mode or Deep Sleep mode is entered, resulting in a further reduction
in power usage. However, the possibility of using Brown-Out Detect as
a wake-up source from the reduced power mode will be lost.
When 0, the Brown-Out Detect function remains active during
Power-down and Deep Sleep modes.
See the System Control Block chapter for details of Brown-Out
detection.
3
BOGD[1]
Brown-Out Global Disable. When BOGD is 1, the Brown-Out Detect
circuitry is fully disabled at all times, and does not consume power.
0
When 0, the Brown-Out Detect circuitry is enabled.
See the System Control Block chapter for details of Brown-Out
detection.
Note: the Brown-Out Reset Disable (BORD, in this register) and the
Brown-Out Interrupt (xx) must be disabled when software changes the
value of this bit.
4
BORD
Brown-Out Reset Disable. When BORD is 1, the BOD will not reset
the device when the VDD(REG)(3V3) voltage dips goes below the BOD
reset trip level. The Brown-Out interrupt is not affected.
0
When BORD is 0, the BOD reset is enabled.
See the Section 3.5 for details of Brown-Out detection.
7:3
-
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
NA
8
SMFLAG
Sleep Mode entry flag. Set when the Sleep mode is successfully
entered. Cleared by software writing a one to this bit.
0 [2][3]
9
DSFLAG
Deep Sleep entry flag. Set when the Deep Sleep mode is successfully 0 [2][3]
entered. Cleared by software writing a one to this bit.
10
PDFLAG
Power-down entry flag. Set when the Power-down mode is
successfully entered. Cleared by software writing a one to this bit.
11
DPDFLAG Deep Power-down entry flag. Set when the Deep Power-down mode
is successfully entered. Cleared by software writing a one to this bit.
31:12 [1]
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
0 [2][3]
0 [2][4]
NA
BOD reset (BORD- bit 4 in PCON register) and BOD interrupt needs to be disabled before a user disables
or enables the power to BOD (BOGD - bit 3 in PCON register).
[2]
Only one of these flags will be valid at a specific time.
[3]
Hardware reset only for a power-up of core power or by a brownout detect event.
[4]
Hardware reset only for a power-up event on Vbat.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
62 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.8.7.1 Encoding of Reduced Power Modes
The PM1and PM0 bits in PCON allow entering reduced power modes as needed. The
encoding of these bits allows backward compatibility with devices that previously only
supported Sleep and Power-down modes. Table 45 below shows the encoding for the
three reduced power modes supported by the LPC176x/5x.
Table 45.
Encoding of reduced power modes
PM1, PM0
Description
00
Execution of WFI or WFE enters either Sleep or Deep Sleep mode as defined by the
SLEEPDEEP bit in the Cortex-M3 System Control Register.
01
Execution of WFI or WFE enters Power-down mode if the SLEEPDEEP bit in the
Cortex-M3 System Control Register is 1.
10
Reserved, this setting should not be used.
11
Execution of WFI or WFE enters Deep Power-down mode if the SLEEPDEEP bit in
the Cortex-M3 System Control Register is 1.
4.8.8 Wake-up from Reduced Power Modes
Any enabled interrupt can wake up the CPU from Sleep mode. Certain interrupts can
wake up the processor if it is in either Deep Sleep mode or Power-down mode.
Interrupts that can occur during Deep Sleep or Power-down mode will wake up the CPU if
the interrupt is enabled. After wake-up, execution will continue to the appropriate interrupt
service routine. These interrupts are NMI, External Interrupts EINT0 through EINT3, GPIO
interrupts, Ethernet Wake-on-LAN interrupt, Brownout Detect, RTC Alarm, CAN Activity
Interrupt, and USB Activity Interrupt. In addition, the watchdog timer can wake up the part
from Deep Sleep mode if the watchdog timer is being clocked by the IRC oscillator. For
the wake-up process to take place the corresponding interrupt must be enabled in the
NVIC. For pin-related peripheral functions, the related functions must also be mapped to
pins.
The CAN Activity Interrupt is generated by activity on the CAN bus pins, and the USB
Activity Interrupt is generated by activity on the USB bus pins. These interrupts are only
useful to wake up the CPU when it is on Deep Sleep or Power-down mode, when the
peripheral functions are powered up, but not active. Typically, if these interrupts are used,
their flags should be polled just before enabling the interrupt and entering the desired
reduced power mode. This can save time and power by avoiding an immediate wake-up.
Upon wake-up, the interrupt service can turn off the related activity interrupt, do any
application specific setup, and exit to await a normal peripheral interrupt.
In Deep Power-down mode, internal power to most of the device is removed, which limits
the possibilities for waking up from this mode. Wake-up from Deep Power-down mode will
occur when an external reset signal is applied, or the RTC interrupt is enabled and an
RTC interrupt is generated.
4.8.9 Power Control for Peripherals register (PCONP - 0x400F C0C4)
The PCONP register allows turning off selected peripheral functions for the purpose of
saving power. This is accomplished by gating off the clock source to the specified
peripheral blocks. A few peripheral functions cannot be turned off (i.e. the Watchdog timer,
the Pin Connect block, and the System Control block).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
63 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Some peripherals, particularly those that include analog functions, may consume power
that is not clock dependent. These peripherals may contain a separate disable control that
turns off additional circuitry to reduce power. Information on peripheral specific power
saving features may be found in the chapter describing that peripheral.
Each bit in PCONP controls one peripheral as shown in Table 46.
If a peripheral control bit is 1, that peripheral is enabled. If a peripheral control bit is 0, that
peripheral’s clock is disabled (gated off) to conserve power. For example if bit 19 is 1, the
I2C1 interface is enabled. If bit 19 is 0, the I2C1 interface is disabled.
Important: valid read from a peripheral register and valid write to a peripheral
register is possible only if that peripheral is enabled in the PCONP register!
Table 46.
Power Control for Peripherals register (PCONP - address 0x400F C0C4) bit
description
Bit
Symbol
Description
Reset
value
0
-
Reserved.
NA
1
PCTIM0
Timer/Counter 0 power/clock control bit.
1
2
PCTIM1
Timer/Counter 1 power/clock control bit.
1
3
PCUART0
UART0 power/clock control bit.
1
4
PCUART1
UART1 power/clock control bit.
1
5
-
Reserved.
NA
6
PCPWM1
PWM1 power/clock control bit.
1
I2C0
7
PCI2C0
The
8
PCSPI
The SPI interface power/clock control bit.
1
9
PCRTC
The RTC power/clock control bit.
1
10
PCSSP1
The SSP 1 interface power/clock control bit.
1
11
-
Reserved.
NA
12
PCADC
A/D converter (ADC) power/clock control bit.
0
interface power/clock control bit.
1
Note: Clear the PDN bit in the AD0CR before clearing this bit, and set
this bit before setting PDN.
UM10360
User manual
13
PCCAN1
CAN Controller 1 power/clock control bit.
14
PCCAN2
CAN Controller 2 power/clock control bit.
0
15
PCGPIO
Power/clock control bit for IOCON, GPIO, and GPIO interrupts.
1
16
PCRIT
Repetitive Interrupt Timer power/clock control bit.
0
17
PCMCPWM Motor Control PWM
0
18
PCQEI
Quadrature Encoder Interface power/clock control bit.
0
19
PCI2C1
The I2C1 interface power/clock control bit.
1
20
-
Reserved.
NA
21
PCSSP0
The SSP0 interface power/clock control bit.
1
22
PCTIM2
Timer 2 power/clock control bit.
0
23
PCTIM3
Timer 3 power/clock control bit.
0
24
PCUART2
UART 2 power/clock control bit.
0
25
PCUART3
UART 3 power/clock control bit.
0
26
PCI2C2
I2C interface 2 power/clock control bit.
1
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
0
© NXP B.V. 2014. All rights reserved.
64 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 46.
Power Control for Peripherals register (PCONP - address 0x400F C0C4) bit
description
Bit
Symbol
Description
Reset
value
27
28
PCI2S
I2S interface power/clock control bit.
0
-
Reserved.
NA
29
PCGPDMA
GPDMA function power/clock control bit.
0
30
PCENET
Ethernet block power/clock control bit.
0
31
PCUSB
USB interface power/clock control bit.
0
Note that the DAC peripheral does not have a control bit in PCONP. To enable the DAC,
its output must be selected to appear on the related pin, P0.26, by configuring the
PINSEL1 register. See Section 8.5.2 “Pin Function Select Register 1 (PINSEL1 0x4002 C004)”.
4.8.10 Power control usage notes
After every reset, the PCONP register contains the value that enables selected interfaces
and peripherals controlled by the PCONP to be enabled. Therefore, apart from proper
configuring via peripheral dedicated registers, the user’s application might have to access
the PCONP in order to start using some of the on-board peripherals.
Power saving oriented systems should have 1s in the PCONP register only in positions
that match peripherals really used in the application. All other bits, declared to be
"Reserved" or dedicated to the peripherals not used in the current application, must be
cleared to 0.
4.8.11 Power domains
The LPC176x/5x provides two independent power domains that allow the bulk of the
device to have power removed while maintaining operation of the Real Time Clock.
The VBAT pin supplies power only to the RTC domain. The RTC requires a minimum of
power to operate, which can be supplied by an external battery. Whenever the device core
power is present, that power is used to operate the RTC, causing no power drain from a
battery when main power is available.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
65 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.9 Wake-up timer
The LPC176x/5x begins operation at power-up and when awakened from Power-down
mode by using the 4 MHz IRC oscillator as the clock source. This allows chip operation to
begin quickly. If the main oscillator or one or both PLLs are needed by the application,
software will need to enable these features and wait for them to stabilize before they are
used as a clock source.
When the main oscillator is initially activated, the wake-up timer allows software to ensure
that the main oscillator is fully functional before the processor uses it as a clock source
and starts to execute instructions. This is important at power-on, all types of Reset, and
whenever any of the aforementioned functions are turned off for any reason. Since the
oscillator and other functions are turned off during Power-down mode, any wake-up of the
processor from Power-down mode makes use of the Wake-up Timer.
The Wake-up Timer monitors the crystal oscillator as the means of checking whether it is
safe to begin code execution. When power is applied to the chip, or some event caused
the chip to exit Power-down mode, some time is required for the oscillator to produce a
signal of sufficient amplitude to drive the clock logic. The amount of time depends on
many factors, including the rate of VDD(REG)(3V3) ramp (in the case of power on), the type
of crystal and its electrical characteristics (if a quartz crystal is used), as well as any other
external circuitry (e.g. capacitors), and the characteristics of the oscillator itself under the
existing ambient conditions.
Once a clock is detected, the Wake-up Timer counts a fixed number of clocks (4,096),
then sets the flag (OSCSTAT bit in the SCS register) that indicates that the main oscillator
is ready for use. Software can then switch to the main oscillator and start any required
PLLs. Refer to the Main Oscillator description in this chapter for details.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
66 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
4.10 External clock output pin
For system test and development purposes, any one of several internal clocks may be
brought out on the CLKOUT function available on the P1.27 pin, as shown in Figure 12.
Clocks that may be observed via CLKOUT are the CPU clock (cclk), the main oscillator
(osc_clk), the internal RC oscillator (irc_osc), the USB clock (usb_clk), and the RTC clock
(rtc_clk).
CLKOUTCFG[3:0]
cclk
000
osc_clk
irc_osc
usb_clk
rtc_clk
CLKOUTCFG[7:4]
CLKOUTCFG[8]
CLKOUT
Divider
Clock Enable
Syncronizer
001
010
CLKOUT
011
100
CLKOUTCFG[9]
Fig 12. CLKOUT selection
4.10.1 Clock Output Configuration register (CLKOUTCFG - 0x400F C1C8)
The CLKOUTCFG register controls the selection of the internal clock that appears on the
CLKOUT pin and allows dividing the clock by an integer value up to 16. The divider can be
used to produce a system clock that is related to one of the on-chip clocks. For most clock
sources, the division may be by 1. When the CPU clock is selected and is higher than
approximately 50 MHz, the output must be divided in order to bring the frequency within
the ability of the pin to switch with reasonable logic levels.
Note: The CLKOUT multiplexer is designed to switch cleanly, without glitches, between
the possible clock sources. The divider is also designed to allow changing the divide value
without glitches.
Table 47.
Clock Output Configuration register (CLKOUTCFG - 0x400F C1C8) bit description
Bit
Symbol
Value Description
3:0
CLKOUTSEL
Reset
value
Selects the clock source for the CLKOUT function.
0000
Selects the CPU clock as the CLKOUT source.
0001
Selects the main oscillator as the CLKOUT source.
0010
Selects the Internal RC oscillator as the CLKOUT source.
0011
Selects the USB clock as the CLKOUT source.
0100
Selects the RTC oscillator as the CLKOUT source.
0
others Reserved, do not use these settings.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
67 of 849
UM10360
NXP Semiconductors
Chapter 4: LPC176x/5x Clocking and power control
Table 47.
Clock Output Configuration register (CLKOUTCFG - 0x400F C1C8) bit description
Bit
Symbol
Value Description
7:4
CLKOUTDIV
Integer value to divide the output clock by, minus one.
0000
Clock is divided by 1.
0001
Clock is divided by 2.
0010
Clock is divided by 3.
...
...
1111
User manual
0
Clock is divided by 16.
8
CLKOUT_EN
CLKOUT enable control, allows switching the CLKOUT
source without glitches. Clear to stop CLKOUT on the
next falling edge. Set to enable CLKOUT.
9
CLKOUT_ACT
CLKOUT activity indication. Reads as 1 when CLKOUT is 0
enabled. Read as 0 when CLKOUT has been disabled via
the CLKOUT_EN bit and the clock has completed being
stopped.
31:10 -
UM10360
Reset
value
0
Reserved, user software should not write ones to reserved NA
bits. The value read from a reserved bit is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
68 of 849
UM10360
Chapter 5: LPC176x/5x Flash accelerator
Rev. 3.1 — 2 April 2014
User manual
5.1 Introduction
The flash accelerator block in the LPC176x/5x allows maximization of the performance of
the Cortex-M3 processor when it is running code from flash memory, while also saving
power. The flash accelerator also provides speed and power improvements for data
accesses to the flash memory.
5.2 Flash accelerator blocks
The flash accelerator is divided into several functional blocks:
• AHB-Lite bus interface, accessible by the Cortex-M3 I-code and D-code buses, as
well as by the General Purpose DMA Controller
• An array of eight 128-bit buffers
• Flash accelerator control logic, including address compare and flash control
• A flash memory interface
Figure 13 shows a simplified diagram of the flash accelerator blocks and data paths.
DCode
bus
Cortex-M3
CPU
ICode
bus
Bus
Matrix
Flash Accelerator
Combined
AHB
AHB-Lite
bus interface
Buffer
Array
Flash
Interface
Flash
Memory
Flash
Accelerator
Control
DMA
General
Master
Port
Purpose
DMA
Controller
Fig 13. Simplified block diagram of the flash accelerator showing potential bus connections
In the following descriptions, the term “fetch” applies to an explicit flash read request from
the CPU. “Prefetch” is used to denote a flash read of instructions beyond the current
processor fetch address.
5.2.1 Flash memory bank
There is one bank of flash memory controlled by the LPC176x/5x flash accelerator.
Flash programming operations are not controlled by the flash accelerator, but are handled
as a separate function. A Boot ROM contains flash programming algorithms that may be
called as part of the application program, and a loader that may be run to allow
programming of the flash memory.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
69 of 849
UM10360
NXP Semiconductors
Chapter 5: LPC176x/5x Flash accelerator
5.2.2 Flash programming Issues
Since the flash memory does not allow accesses during programming and erase
operations, it is necessary for the flash accelerator to force the CPU to wait if a memory
access to a flash address is requested while the flash memory is busy with a
programming operation. Under some conditions, this delay could result in a Watchdog
time-out. The user will need to be aware of this possibility and take steps to insure that an
unwanted Watchdog reset does not cause a system failure while programming or erasing
the flash memory.
In order to preclude the possibility of stale data being read from the flash memory, the
LPC176x/5x flash accelerator buffers are automatically invalidated at the beginning of any
flash programming or erase operation. Any subsequent read from a flash address will
cause a new fetch to be initiated after the flash operation has completed.
5.3 Register description
The flash accelerator is controlled by the register shown in Table 48. More detailed
descriptions follow.
Table 48.
Name
Description
Access Reset
Address
value[1]
FLASHCFG
Flash Accelerator Configuration Register.
Controls flash access timing. See Table 49.
R/W
[1]
UM10360
User manual
Summary of flash accelerator registers
0x303A 0x400F C000
Reset Value reflects the data stored in defined bits only. It does not include reserved bits content.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
70 of 849
UM10360
NXP Semiconductors
Chapter 5: LPC176x/5x Flash accelerator
5.4 Flash Accelerator Configuration register (FLASHCFG - 0x400F C000)
Configuration bits select the flash access time, as shown in Table 49. The lower bits of
FLASHCFG control internal flash accelerator functions and should not be altered.
Following reset, flash accelerator functions are enabled and flash access timing is set to a
default value of 4 clocks.
Changing the FLASHCFG register value causes the flash accelerator to invalidate all of
the holding latches, resulting in new reads of flash information as required. This
guarantees synchronization of the flash accelerator to CPU operation.
Table 49.
Flash Accelerator Configuration register (FLASHCFG - address 0x400F C000) bit description
Bit
Symbol
Value Description
Reset
value
11:0
-
-
0x03A
Reserved, user software should not change these bits from the reset value.
Flash access time. The value of this field plus 1 gives the number of CPU clocks used 0x3
for a flash access.
15:12 FLASHTIM
Warning: improper setting of this value may result in incorrect operation of the device.
0000
Flash accesses use 1 CPU clock. Use for up to 20 MHz CPU clock.
0001
Flash accesses use 2 CPU clocks. Use for up to 40 MHz CPU clock.
0010
Flash accesses use 3 CPU clocks. Use for up to 60 MHz CPU clock.
0011
Flash accesses use 4 CPU clocks. Use for up to 80 MHz CPU clock.
0100
Flash accesses use 5 CPU clocks. Use for up to 100 MHz CPU clock.
Use for up to 120 Mhz for LPC1759 and LPC1769 only.
0101
Flash accesses use 6 CPU clocks. This “safe” setting will work under any conditions.
Other
Intended for potential future higher speed devices.
31:16 -
Reserved. The value read from a reserved bit is not defined.
NA
5.5 Operation
Simply put, the flash accelerator attempts to have the next Cortex-M3 instruction that will
be needed in its latches in time to prevent CPU fetch stalls. The LPC176x/5x uses one
bank of flash memory. The flash accelerator includes an array of eight 128-bit buffers to
store both instructions and data in a configurable manner. Each 128-bit buffer in the array
can include four 32-bit instructions, eight 16-bit instructions or some combination of the
two. During sequential code execution, a buffer typically contains the current instruction
and the entire flash line that contains that instruction, or one flash line of data containing a
previously requested address. Buffers are marked according to how they are used (as
instruction or data buffers), and when they have been accessed. This information is used
to carry out the buffer replacement strategy.
The Cortex-M3 provides a separate bus for instruction access (I-code) and data access
(D-code) in the code memory space. These buses, plus the General Purpose DMA
Controllers’s master port, are arbitrated by the AHB multilayer matrix. Any access to the
flash memory’s address space is presented to the flash accelerator.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
71 of 849
UM10360
NXP Semiconductors
Chapter 5: LPC176x/5x Flash accelerator
If a flash instruction fetch and a flash data access from the CPU occur at the same time,
the multilayer matrix gives precedence to the data access. This is because a stalled data
access always slows down execution, while a stalled instruction fetch often does not.
When the flash data access is concluded, any flash fetch or prefetch that had been in
progress is re-initiated.
Branches and other program flow changes cause a break in the sequential flow of
instruction fetches described above. Buffer replacement strategy in the flash accelerator
attempts to maximize the chances that potentially reusable information is retained until it
is needed again.
If an attempt is made to write directly to the flash memory without using the normal flash
programming interface (via Boot ROM function calls), the flash accelerator generates an
error condition. The CPU treats this error as a data abort. The GPDMA handles error
conditions as described in Section 31.4.1.6.3.
When an Instruction Fetch is not satisfied by existing contents of the buffer array, nor has
a prefetch been initiated for that flash line, the CPU will be stalled while a fetch is initiated
for the related 128-bit flash line. If a prefetch has been initiated but not yet completed, the
CPU is stalled for a shorter time since the required flash access is already in progress.
Typically, a flash prefetch is begun whenever an access is made to a just prefetched
address, or to a buffer whose immediate successor is not already in another buffer. A
prefetch in progress may be aborted by a data access, in order to minimize CPU stalls.
A prefetched flash line is latched within the flash memory, but the flash accelerator does
not capture the line in a buffer until the CPU presents an address that is contained within
the prefetched flash line. If the core presents an instruction address that is not already
buffered and is not contained in the prefetched flash line, the prefetched line will be
discarded.
Some special cases include the possibility that the CPU will request a data access to an
address already contained in an instruction buffer. In this case, the data will be read from
the buffer as if it was a data buffer. The reverse case, if the CPU requests an instruction
address that can be satisfied from an existing data buffer, causes the instruction to be
supplied from the data buffer, and the buffer to be changed into an instruction buffer. This
causes the buffer to be handled differently when the flash accelerator is determining which
buffer is to be overwritten next.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
72 of 849
UM10360
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller
(NVIC)
Rev. 3.1 — 2 April 2014
User manual
6.1 Features
•
•
•
•
•
•
•
•
Nested Vectored Interrupt Controller that is an integral part of the ARM Cortex-M3
Tightly coupled interrupt controller provides low interrupt latency
Controls system exceptions and peripheral interrupts
In the LPC176x/5x, the NVIC supports 35 vectored interrupts
32 programmable interrupt priority levels, with hardware priority level masking
Relocatable vector table
Non-Maskable Interrupt
Software interrupt generation
6.2 Description
The Nested Vectored Interrupt Controller (NVIC) is an integral part of the Cortex-M3. The
tight coupling to the CPU allows for low interrupt latency and efficient processing of late
arriving interrupts.
Refer to the Cortex-M3 User Guide Section 34.4.2 for details of NVIC operation.
6.3 Interrupt sources
Table 50 lists the interrupt sources for each peripheral function. Each peripheral device
may have one or more interrupt lines to the Vectored Interrupt Controller. Each line may
represent more than one interrupt source, as noted.
Exception numbers relate to where entries are stored in the exception vector table.
Interrupt numbers are used in some other contexts, such as software interrupts.
In addition, the NVIC handles the Non-Maskable Interrupt (NMI). In order for NMI to
operate from an external signal, the NMI function must be connected to the related device
pin (P2.10 / EINT0n / NMI). When connected, a logic 1 on the pin will cause the NMI to be
processed. For details, refer to the Cortex-M3 User Guide that is an appendix to this User
Manual.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
73 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
Table 50.
Connection of interrupt sources to the Vectored Interrupt Controller
Interrupt Exception Vector Function
ID
Number
Offset
Flag(s)
0
16
0x40
WDT
Watchdog Interrupt (WDINT)
1
17
0x44
Timer 0
Match 0 - 1 (MR0, MR1)
2
18
0x48
Timer 1
Match 0 - 2 (MR0, MR1, MR2)
Capture 0 - 1 (CR0, CR1)
Capture 0 - 1 (CR0, CR1)
3
19
0x4C
Timer 2
Match 0-3
Capture 0-1
4
20
0x50
Timer 3
Match 0-3
Capture 0-1
5
21
0x54
UART0
Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
6
22
0x58
UART1
Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
Modem Control Change
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
7
23
0x5C
UART 2
Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
8
24
0x60
UART 3
Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
9
25
0x64
PWM1
Match 0 - 6 of PWM1
Capture 0-1 of PWM1
10
26
0x68
I2C0
SI (state change)
0x6C
I2C1
SI (state change)
SI (state change)
SPI Interrupt Flag (SPIF)
11
27
12
28
0x70
I2C2
13
29
0x74
SPI
Mode Fault (MODF)
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
74 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
Table 50.
Connection of interrupt sources to the Vectored Interrupt Controller
Interrupt Exception Vector Function
ID
Number
Offset
Flag(s)
14
Tx FIFO half empty of SSP0
30
0x78
SSP0
Rx FIFO half full of SSP0
Rx Timeout of SSP0
Rx Overrun of SSP0
15
31
0x7C
SSP 1
Tx FIFO half empty
Rx FIFO half full
Rx Timeout
Rx Overrun
16
32
0x80
PLL0 (Main PLL)
PLL0 Lock (PLOCK0)
17
33
0x84
RTC
Counter Increment (RTCCIF)
18
34
0x88
External Interrupt
External Interrupt 0 (EINT0)
19
35
0x8C
External Interrupt
External Interrupt 1 (EINT1)
20
36
0x90
External Interrupt
External Interrupt 2 (EINT2)
21
37
0x94
External Interrupt
Alarm (RTCALF)
External Interrupt 3 (EINT3).
Note: EINT3 channel is shared with GPIO interrupts
22
38
0x98
ADC
A/D Converter end of conversion
23
39
0x9C
BOD
Brown Out detect
24
40
0xA0
USB
USB_INT_REQ_LP, USB_INT_REQ_HP, USB_INT_REQ_DMA
25
41
0xA4
CAN
CAN Common, CAN 0 Tx, CAN 0 Rx, CAN 1 Tx, CAN 1 Rx
26
42
0xA8
GPDMA
IntStatus of DMA channel 0, IntStatus of DMA channel 1
irq, dmareq1, dmareq2
27
43
0xAC
I2S
28
44
0xB0
Ethernet
WakeupInt, SoftInt, TxDoneInt, TxFinishedInt, TxErrorInt,
TxUnderrunInt, RxDoneInt, RxFinishedInt, RxErrorInt,
RxOverrunInt.
29
45
0xB4
Repetitive Interrupt
Timer
RITINT
30
46
0xB8
Motor Control PWM
IPER[2:0], IPW[2:0], ICAP[2:0], FES
31
47
0xBC
Quadrature Encoder
INX_Int, TIM_Int, VELC_Int, DIR_Int, ERR_Int, ENCLK_Int,
POS0_Int, POS1_Int, POS2_Int, REV_Int, POS0REV_Int,
POS1REV_Int, POS2REV_Int
32
48
0xC0
PLL1 (USB PLL)
PLL1 Lock (PLOCK1)
33
49
0xC4
USB Activity Interrupt USB_NEED_CLK
34
50
0xC8
CAN Activity Interrupt CAN1WAKE, CAN2WAKE
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
75 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.4 Vector table remapping
The Cortex-M3 incorporates a mechanism that allows remapping the interrupt vector table
to alternate locations in the memory map. This is controlled via the Vector Table Offset
Register (VTOR) contained in the Cortex-M3.
The vector table may be located anywhere within the bottom 1 GB of Cortex-M3 address
space. The vector table should be located on a 256 word (1024 byte) boundary to insure
alignment on LPC176x/5x family devices. Refer to Section 34.4.3.5 of the Cortex-M3 User
Guide appended to this manual for details of the Vector Table Offset feature.
ARM describes bit 29 of the VTOR (TBLOFF) as selecting a memory region, either code
or SRAM. For simplicity, this bit can be thought as simply part of the address offset since
the split between the “code” space and the “SRAM” space occurs at the location
corresponding to bit 29 in a memory address.
Examples:
To place the vector table at the beginning of the “local” static RAM, starting at address
0x1000 0000, place the value 0x1000 0000 in the VTOR register. This indicates address
0x1000 0000 in the code space, since bit 29 of the VTOR equals 0.
To place the vector table at the beginning of the AHB static RAM, starting at address
0x2007 C000, place the value 0x2007 C000 in the VTOR register. This indicates address
0x2007 C000 in the SRAM space, since bit 29 of the VTOR equals 1.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
76 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5 Register description
The following table summarizes the registers in the NVIC as implemented in the
LPC176x/5x. The Cortex-M3 User Guide Section 34.4.2 provides a functional description
of the NVIC.
Table 51.
Name
NVIC register map
Description
Access Reset
value
Address
ISER0 to Interrupt Set-Enable Registers. These 2 registers allow enabling
ISER1
interrupts and reading back the interrupt enables for specific
peripheral functions.
RW
ISER0 - 0xE000 E100
ICER0 to Interrupt Clear-Enable Registers. These 2 registers allow disabling
ICER1
interrupts and reading back the interrupt enables for specific
peripheral functions.
RW
ISPR0 to Interrupt Set-Pending Registers. These 2 registers allow changing
ISPR1
the interrupt state to pending and reading back the interrupt
pending state for specific peripheral functions.
RW
ICPR0 to Interrupt Clear-Pending Registers. These 2 registers allow
ICPR1
changing the interrupt state to not pending and reading back the
interrupt pending state for specific peripheral functions.
RW
IABR0 to Interrupt Active Bit Registers. These 2 registers allow reading the
IABR1
current interrupt active state for specific peripheral functions.
RO
IPR0 to
IPR8
RW
Interrupt Priority Registers. These 9 registers allow assigning a
priority to each interrupt. Each register contains the 5-bit priority
fields for 4 interrupts.
0
ISER1 - 0xE000 E104
0
ICER0 - 0xE000 E180
ICER1 - 0xE000 E184
0
ISPR0 - 0xE000 E200
ISPR1 - 0xE000 E204
0
ICPR0 - 0xE000 E280
ICPR1 - 0xE000 E284
0
IABR0 - 0xE000 E300
IABR1 - 0xE000 E304
0
IPR0 - 0xE000 E400
IPR1 - 0xE000 E404
IPR2 - 0xE000 E408
IPR3 - 0xE000 E40C
IPR4 - 0xE000 E410
IPR5 - 0xE000 E414
IPR6 - 0xE000 E418
IPR7 - 0xE000 E41C
IPR8 - 0xE000 E420
STIR
Software Trigger Interrupt Register. This register allows software to WO
generate an interrupt.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
0
STIR - 0xE000 EF00
© NXP B.V. 2014. All rights reserved.
77 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.1 Interrupt Set-Enable Register 0 register (ISER0 - 0xE000 E100)
The ISER0 register allows enabling the first 32 peripheral interrupts, or for reading the
enabled state of those interrupts. The remaining interrupts are enabled via the ISER1
register (Section 6.5.2). Disabling interrupts is done through the ICER0 and ICER1
registers (Section 6.5.3 and Section 6.5.4).
Table 52.
Interrupt Set-Enable Register 0 register (ISER0 - 0xE000 E100)
Bit
Name
Function
0
ISE_WDT
Watchdog Timer Interrupt Enable.
Write: writing 0 has no effect, writing 1 enables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
1
ISE_TIMER0
Timer 0 Interrupt Enable. See functional description for bit 0.
2
ISE_TIMER1
Timer 1. Interrupt Enable. See functional description for bit 0.
3
ISE_TIMER2
Timer 2 Interrupt Enable. See functional description for bit 0.
4
ISE_TIMER3
Timer 3 Interrupt Enable. See functional description for bit 0.
5
ISE_UART0
UART0 Interrupt Enable. See functional description for bit 0.
6
ISE_UART1
UART1 Interrupt Enable. See functional description for bit 0.
7
ISE_UART2
UART2 Interrupt Enable. See functional description for bit 0.
8
ISE_UART3
UART3 Interrupt Enable. See functional description for bit 0.
9
ISE_PWM
PWM1 Interrupt Enable. See functional description for bit 0.
10
ISE_I2C0
I2C0 Interrupt Enable. See functional description for bit 0.
11
ISE_I2C1
I2C1 Interrupt Enable. See functional description for bit 0.
12
ISE_I2C2
I2C2 Interrupt Enable. See functional description for bit 0.
13
ISE_SPI
SPI Interrupt Enable. See functional description for bit 0.
14
ISE_SSP0
SSP0 Interrupt Enable. See functional description for bit 0.
15
ISE_SSP1
SSP1 Interrupt Enable. See functional description for bit 0.
16
ISE_PLL0
PLL0 (Main PLL) Interrupt Enable. See functional description for bit 0.
17
ISE_RTC
Real Time Clock (RTC) Interrupt Enable. See functional description for bit 0.
18
ISE_EINT0
External Interrupt 0 Interrupt Enable. See functional description for bit 0.
19
ISE_EINT1
External Interrupt 1 Interrupt Enable. See functional description for bit 0.
20
ISE_EINT2
External Interrupt 2 Interrupt Enable. See functional description for bit 0.
21
ISE_EINT3
External Interrupt 3 Interrupt Enable. See functional description for bit 0.
22
ISE_ADC
ADC Interrupt Enable. See functional description for bit 0.
23
ISE_BOD
BOD Interrupt Enable. See functional description for bit 0.
24
ISE_USB
USB Interrupt Enable. See functional description for bit 0.
25
ISE_CAN
CAN Interrupt Enable. See functional description for bit 0.
26
ISE_DMA
GPDMA Interrupt Enable. See functional description for bit 0.
27
ISE_I2S
I2S Interrupt Enable. See functional description for bit 0.
28
ISE_ENET
Ethernet Interrupt Enable. See functional description for bit 0.
29
ISE_RIT
Repetitive Interrupt Timer Interrupt Enable. See functional description for bit 0.
30
ISE_MCPWM
Motor Control PWM Interrupt Enable. See functional description for bit 0.
31
ISE_QEI
Quadrature Encoder Interface Interrupt Enable. See functional description for bit 0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
78 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.2 Interrupt Set-Enable Register 1 register (ISER1 - 0xE000 E104)
The ISER1 register allows enabling the second group of peripheral interrupts, or for
reading the enabled state of those interrupts. Disabling interrupts is done through the
ICER0 and ICER1 registers (Section 6.5.3 and Section 6.5.4).
Table 53.
Interrupt Set-Enable Register 1 register (ISER1 - 0xE000 E104)
Bit
Name
0
ISE_PLL1
Function
PLL1 (USB PLL) Interrupt Enable.
Write: writing 0 has no effect, writing 1 enables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
1
ISE_USBACT
USB Activity Interrupt Enable. See functional description for bit 0.
2
ISE_CANACT
CAN Activity Interrupt Enable. See functional description for bit 0.
31:3 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
79 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.3 Interrupt Clear-Enable Register 0 (ICER0 - 0xE000 E180)
The ICER0 register allows disabling the first 32 peripheral interrupts, or for reading the
enabled state of those interrupts. The remaining interrupts are disabled via the ICER1
register (Section 6.5.4). Enabling interrupts is done through the ISER0 and ISER1
registers (Section 6.5.1 and Section 6.5.2).
Table 54.
Interrupt Clear-Enable Register 0 (ICER0 - 0xE000 E180)
Bit
Name
Function
0
ICE_WDT
Watchdog Timer Interrupt Disable.
Write: writing 0 has no effect, writing 1 disables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
1
ICE_TIMER0
Timer 0 Interrupt Disable. See functional description for bit 0.
2
ICE_TIMER1
Timer 1. Interrupt Disable. See functional description for bit 0.
3
ICE_TIMER2
Timer 2 Interrupt Disable. See functional description for bit 0.
4
ICE_TIMER3
Timer 3 Interrupt Disable. See functional description for bit 0.
5
ICE_UART0
UART0 Interrupt Disable. See functional description for bit 0.
6
ICE_UART1
UART1 Interrupt Disable. See functional description for bit 0.
7
ICE_UART2
UART2 Interrupt Disable. See functional description for bit 0.
8
ICE_UART3
UART3 Interrupt Disable. See functional description for bit 0.
9
ICE_PWM
PWM1 Interrupt Disable. See functional description for bit 0.
10
ICE_I2C0
I2C0 Interrupt Disable. See functional description for bit 0.
11
ICE_I2C1
I2C1 Interrupt Disable. See functional description for bit 0.
12
ICE_I2C2
I2C2 Interrupt Disable. See functional description for bit 0.
13
ICE_SPI
SPI Interrupt Disable. See functional description for bit 0.
14
ICE_SSP0
SSP0 Interrupt Disable. See functional description for bit 0.
15
ICE_SSP1
SSP1 Interrupt Disable. See functional description for bit 0.
16
ICE_PLL0
PLL0 (Main PLL) Interrupt Disable. See functional description for bit 0.
17
ICE_RTC
Real Time Clock (RTC) Interrupt Disable. See functional description for bit 0.
18
ICE_EINT0
External Interrupt 0 Interrupt Disable. See functional description for bit 0.
19
ICE_EINT1
External Interrupt 1 Interrupt Disable. See functional description for bit 0.
20
ICE_EINT2
External Interrupt 2 Interrupt Disable. See functional description for bit 0.
21
ICE_EINT3
External Interrupt 3 Interrupt Disable. See functional description for bit 0.
22
ICE_ADC
ADC Interrupt Disable. See functional description for bit 0.
23
ICE_BOD
BOD Interrupt Disable. See functional description for bit 0.
24
ICE_USB
USB Interrupt Disable. See functional description for bit 0.
25
ICE_CAN
CAN Interrupt Disable. See functional description for bit 0.
26
ICE_DMA
GPDMA Interrupt Disable. See functional description for bit 0.
27
ICE_I2S
I2S Interrupt Disable. See functional description for bit 0.
28
ICE_ENET
Ethernet Interrupt Disable. See functional description for bit 0.
29
ICE_RIT
Repetitive Interrupt Timer Interrupt Disable. See functional description for bit 0.
30
ICE_MCPWM
Motor Control PWM Interrupt Disable. See functional description for bit 0.
31
ICE_QEI
Quadrature Encoder Interface Interrupt Disable. See functional description for bit 0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
80 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.4 Interrupt Clear-Enable Register 1 register (ICER1 - 0xE000 E184)
The ICER1 register allows disabling the second group of peripheral interrupts, or for
reading the enabled state of those interrupts. Enabling interrupts is done through the
ISER0 and ISER1 registers (Section 6.5.1 and Section 6.5.2).
Table 55.
Interrupt Clear-Enable Register 1 register (ICER1 - 0xE000 E184)
Bit
Name
Function
0
ICE_PLL1
PLL1 (USB PLL) Interrupt Disable.
Write: writing 0 has no effect, writing 1 disables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
1
ICE_USBACT
USB Activity Interrupt Disable. See functional description for bit 0.
2
ICE_CANACT
CAN Activity Interrupt Disable. See functional description for bit 0.
31:3 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
81 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.5 Interrupt Set-Pending Register 0 register (ISPR0 - 0xE000 E200)
The ISPR0 register allows setting the pending state of the first 32 peripheral interrupts, or
for reading the pending state of those interrupts. The remaining interrupts can have their
pending state set via the ISPR1 register (Section 6.5.6). Clearing the pending state of
interrupts is done through the ICPR0 and ICPR1 registers (Section 6.5.7 and
Section 6.5.8).
Table 56.
Interrupt Set-Pending Register 0 register (ISPR0 - 0xE000 E200)
Bit
Name
Function
0
ISP_WDT
Watchdog Timer Interrupt Pending set.
Write: writing 0 has no effect, writing 1 changes the interrupt state to pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the interrupt is pending.
1
ISP_TIMER0
Timer 0 Interrupt Pending set. See functional description for bit 0.
2
ISP_TIMER1
Timer 1. Interrupt Pending set. See functional description for bit 0.
3
ISP_TIMER2
Timer 2 Interrupt Pending set. See functional description for bit 0.
4
ISP_TIMER3
Timer 3 Interrupt Pending set. See functional description for bit 0.
5
ISP_UART0
UART0 Interrupt Pending set. See functional description for bit 0.
6
ISP_UART1
UART1 Interrupt Pending set. See functional description for bit 0.
7
ISP_UART2
UART2 Interrupt Pending set. See functional description for bit 0.
8
ISP_UART3
UART3 Interrupt Pending set. See functional description for bit 0.
9
ISP_PWM
PWM1 Interrupt Pending set. See functional description for bit 0.
10
ISP_I2C0
I2C0 Interrupt Pending set. See functional description for bit 0.
11
ISP_I2C1
I2C1 Interrupt Pending set. See functional description for bit 0.
12
ISP_I2C2
I2C2 Interrupt Pending set. See functional description for bit 0.
13
ISP_SPI
SPI Interrupt Pending set. See functional description for bit 0.
14
ISP_SSP0
SSP0 Interrupt Pending set. See functional description for bit 0.
15
ISP_SSP1
SSP1 Interrupt Pending set. See functional description for bit 0.
16
ISP_PLL0
PLL0 (Main PLL) Interrupt Pending set. See functional description for bit 0.
17
ISP_RTC
Real Time Clock (RTC) Interrupt Pending set. See functional description for bit 0.
18
ISP_EINT0
External Interrupt 0 Interrupt Pending set. See functional description for bit 0.
19
ISP_EINT1
External Interrupt 1 Interrupt Pending set. See functional description for bit 0.
20
ISP_EINT2
External Interrupt 2 Interrupt Pending set. See functional description for bit 0.
21
ISP_EINT3
External Interrupt 3 Interrupt Pending set. See functional description for bit 0.
22
ISP_ADC
ADC Interrupt Pending set. See functional description for bit 0.
23
ISP_BOD
BOD Interrupt Pending set. See functional description for bit 0.
24
ISP_USB
USB Interrupt Pending set. See functional description for bit 0.
25
ISP_CAN
CAN Interrupt Pending set. See functional description for bit 0.
26
ISP_DMA
GPDMA Interrupt Pending set. See functional description for bit 0.
27
ISP_I2S
I2S Interrupt Pending set. See functional description for bit 0.
28
ISP_ENET
Ethernet Interrupt Pending set. See functional description for bit 0.
29
ISP_RIT
Repetitive Interrupt Timer Interrupt Pending set. See functional description for bit 0.
30
ISP_MCPWM
Motor Control PWM Interrupt Pending set. See functional description for bit 0.
31
ISP_QEI
Quadrature Encoder Interface Interrupt Pending set. See functional description for bit 0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
82 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.6 Interrupt Set-Pending Register 1 register (ISPR1 - 0xE000 E204)
The ISPR1 register allows setting the pending state of the second group of peripheral
interrupts, or for reading the pending state of those interrupts. Clearing the pending state
of interrupts is done through the ICPR0 and ICPR1 registers (Section 6.5.7 and
Section 6.5.8).
Table 57.
Interrupt Set-Pending Register 1 register (ISPR1 - 0xE000 E204)
Bit
Name
Function
0
ISP_PLL1
PLL1 (USB PLL) Interrupt Pending set.
Write: writing 0 has no effect, writing 1 changes the interrupt state to pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the interrupt is pending.
1
ISP_USBACT
USB Activity Interrupt Pending set. See functional description for bit 0.
2
ISP_CANACT
CAN Activity Interrupt Pending set. See functional description for bit 0.
31:3 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
83 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.7 Interrupt Clear-Pending Register 0 register (ICPR0 - 0xE000 E280)
The ICPR0 register allows clearing the pending state of the first 32 peripheral interrupts,
or for reading the pending state of those interrupts. The remaining interrupts can have
their pending state cleared via the ICPR1 register (Section 6.5.8). Setting the pending
state of interrupts is done through the ISPR0 and ISPR1 registers (Section 6.5.5 and
Section 6.5.6).
Table 58.
Interrupt Clear-Pending Register 0 register (ICPR0 - 0xE000 E280)
Bit
Name
Function
0
ICP_WDT
Watchdog Timer Interrupt Pending clear.
Write: writing 0 has no effect, writing 1 changes the interrupt state to not pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the interrupt is pending.
1
ICP_TIMER0
Timer 0 Interrupt Pending clear. See functional description for bit 0.
2
ICP_TIMER1
Timer 1. Interrupt Pending clear. See functional description for bit 0.
3
ICP_TIMER2
Timer 2 Interrupt Pending clear. See functional description for bit 0.
4
ICP_TIMER3
Timer 3 Interrupt Pending clear. See functional description for bit 0.
5
ICP_UART0
UART0 Interrupt Pending clear. See functional description for bit 0.
6
ICP_UART1
UART1 Interrupt Pending clear. See functional description for bit 0.
7
ICP_UART2
UART2 Interrupt Pending clear. See functional description for bit 0.
8
ICP_UART3
UART3 Interrupt Pending clear. See functional description for bit 0.
9
ICP_PWM
PWM1 Interrupt Pending clear. See functional description for bit 0.
10
ICP_I2C0
I2C0 Interrupt Pending clear. See functional description for bit 0.
11
ICP_I2C1
I2C1 Interrupt Pending clear. See functional description for bit 0.
12
ICP_I2C2
I2C2 Interrupt Pending clear. See functional description for bit 0.
13
ICP_SPI
SPI Interrupt Pending clear. See functional description for bit 0.
14
ICP_SSP0
SSP0 Interrupt Pending clear. See functional description for bit 0.
15
ICP_SSP1
SSP1 Interrupt Pending clear. See functional description for bit 0.
16
ICP_PLL0
PLL0 (Main PLL) Interrupt Pending clear. See functional description for bit 0.
17
ICP_RTC
Real Time Clock (RTC) Interrupt Pending clear. See functional description for bit 0.
18
ICP_EINT0
External Interrupt 0 Interrupt Pending clear. See functional description for bit 0.
19
ICP_EINT1
External Interrupt 1 Interrupt Pending clear. See functional description for bit 0.
20
ICP_EINT2
External Interrupt 2 Interrupt Pending clear. See functional description for bit 0.
21
ICP_EINT3
External Interrupt 3 Interrupt Pending clear. See functional description for bit 0.
22
ICP_ADC
ADC Interrupt Pending clear. See functional description for bit 0.
23
ICP_BOD
BOD Interrupt Pending clear. See functional description for bit 0.
24
ICP_USB
USB Interrupt Pending clear. See functional description for bit 0.
25
ICP_CAN
CAN Interrupt Pending clear. See functional description for bit 0.
26
ICP_DMA
GPDMA Interrupt Pending clear. See functional description for bit 0.
27
ICP_I2S
I2S Interrupt Pending clear. See functional description for bit 0.
28
ICP_ENET
Ethernet Interrupt Pending clear. See functional description for bit 0.
29
ICP_RIT
Repetitive Interrupt Timer Interrupt Pending clear. See functional description for bit 0.
30
ICP_MCPWM
Motor Control PWM Interrupt Pending clear. See functional description for bit 0.
31
ICP_QEI
Quadrature Encoder Interface Interrupt Pending clear. See functional description for bit 0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
84 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.8 Interrupt Clear-Pending Register 1 register (ICPR1 - 0xE000 E284)
The ICPR1 register allows clearing the pending state of the second group of peripheral
interrupts, or for reading the pending state of those interrupts. Setting the pending state of
interrupts is done through the ISPR0 and ISPR1 registers (Section 6.5.5 and
Section 6.5.6).
Table 59.
Interrupt Set-Pending Register 1 register (ISPR1 - 0xE000 E204)
Bit
Name
Function
0
ICP_PLL1
PLL1 (USB PLL) Interrupt Pending clear.
Write: writing 0 has no effect, writing 1 changes the interrupt state to not pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the interrupt is pending.
1
ICP_USBACT
USB Activity Interrupt Pending clear. See functional description for bit 0.
2
ICP_CANACT
CAN Activity Interrupt Pending clear. See functional description for bit 0.
31:3 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
85 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.9 Interrupt Active Bit Register 0 (IABR0 - 0xE000 E300)
The IABR0 register is a read-only register that allows reading the active state of the first
32 peripheral interrupts. This allows determining which peripherals are asserting an
interrupt to the NVIC, and may also be pending if they are enabled. The remaining
interrupts can have their active state read via the IABR1 register (Section 6.5.10).
Table 60.
Interrupt Active Bit Register 0 (IABR0 - 0xE000 E300)
Bit
Name
Function
0
IAB_WDT
Watchdog Timer Interrupt Active.
Read: 0 indicates that the interrupt is not active, 1 indicates that the interrupt is active.
1
IAB_TIMER0
Timer 0 Interrupt Active. See functional description for bit 0.
2
IAB_TIMER1
Timer 1. Interrupt Active. See functional description for bit 0.
3
IAB_TIMER2
Timer 2 Interrupt Active. See functional description for bit 0.
4
IAB_TIMER3
Timer 3 Interrupt Active. See functional description for bit 0.
5
IAB_UART0
UART0 Interrupt Active. See functional description for bit 0.
6
IAB_UART1
UART1 Interrupt Active. See functional description for bit 0.
7
IAB_UART2
UART2 Interrupt Active. See functional description for bit 0.
8
IAB_UART3
UART3 Interrupt Active. See functional description for bit 0.
9
IAB_PWM
PWM1 Interrupt Active. See functional description for bit 0.
10
IAB_I2C0
I2C0 Interrupt Active. See functional description for bit 0.
11
IAB_I2C1
I2C1 Interrupt Active. See functional description for bit 0.
12
IAB_I2C2
I2C2 Interrupt Active. See functional description for bit 0.
13
IAB_SPI
SPI Interrupt Active. See functional description for bit 0.
14
IAB_SSP0
SSP0 Interrupt Active. See functional description for bit 0.
15
IAB_SSP1
SSP1 Interrupt Active. See functional description for bit 0.
16
IAB_PLL0
PLL0 (Main PLL) Interrupt Active. See functional description for bit 0.
17
IAB_RTC
Real Time Clock (RTC) Interrupt Active. See functional description for bit 0.
18
IAB_EINT0
External Interrupt 0 Interrupt Active. See functional description for bit 0.
19
IAB_EINT1
External Interrupt 1 Interrupt Active. See functional description for bit 0.
20
IAB_EINT2
External Interrupt 2 Interrupt Active. See functional description for bit 0.
21
IAB_EINT3
External Interrupt 3 Interrupt Active. See functional description for bit 0.
22
IAB_ADC
ADC Interrupt Active. See functional description for bit 0.
23
IAB_BOD
BOD Interrupt Active. See functional description for bit 0.
24
IAB_USB
USB Interrupt Active. See functional description for bit 0.
25
IAB_CAN
CAN Interrupt Active. See functional description for bit 0.
26
IAB_DMA
GPDMA Interrupt Active. See functional description for bit 0.
27
IAB_I2S
I2S Interrupt Active. See functional description for bit 0.
28
IAB_ENET
Ethernet Interrupt Active. See functional description for bit 0.
29
IAB_RIT
Repetitive Interrupt Timer Interrupt Active. See functional description for bit 0.
30
IAB_MCPWM
Motor Control PWM Interrupt Active. See functional description for bit 0.
31
IAB_QEI
Quadrature Encoder Interface Interrupt Active. See functional description for bit 0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
86 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.10 Interrupt Active Bit Register 1 (IABR1 - 0xE000 E304)
The IABR1 register is a read-only register that allows reading the active state of the
second group of peripheral interrupts. This allows determining which peripherals are
asserting an interrupt to the NVIC, and may also be pending if they are enabled.
Table 61.
Interrupt Active Bit Register 1 (IABR1 - 0xE000 E304)
Bit
Name
0
IAB_PLL1
Function
PLL1 (USB PLL) Interrupt Active.
Read: 0 indicates that the interrupt is not active, 1 indicates that the interrupt is active.
1
IAB_USBACT
USB Activity Interrupt Active. See functional description for bit 0.
2
IAB_CANACT
CAN Activity Interrupt Active. See functional description for bit 0.
31:3 -
UM10360
User manual
Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
87 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.11 Interrupt Priority Register 0 (IPR0 - 0xE000 E400)
The IPR0 register controls the priority of the first 4 peripheral interrupts. Each interrupt can
have one of 32 priorities, where 0 is the highest priority.
Table 62.
Interrupt Priority Register 0 (IPR0 - 0xE000 E400)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_WDT
Watchdog Timer Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_TIMER0
Timer 0 Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_TIMER1
Timer 1 Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_TIMER2
Timer 2 Interrupt Priority. See functional description for bits 7-3.
6.5.12 Interrupt Priority Register 1 (IPR1 - 0xE000 E404)
The IPR1 register controls the priority of the second group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 63.
Interrupt Priority Register 1 (IPR1 - 0xE000 E404)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_TIMER3
Timer 3 Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_UART0
UART0 Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_UART1
UART1 Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_UART2
UART2 Interrupt Priority. See functional description for bits 7-3.
6.5.13 Interrupt Priority Register 2 (IPR2 - 0xE000 E408)
The IPR2 register controls the priority of the third group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 64.
Interrupt Priority Register 2 (IPR2 - 0xE000 E408)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_UART3
UART3 Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_PWM
PWM Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_I2C0
I2C0 Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_I2C1
I2C1 Interrupt Priority. See functional description for bits 7-3.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
88 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.14 Interrupt Priority Register 3 (IPR3 - 0xE000 E40C)
The IPR3 register controls the priority of the fourth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 65.
Interrupt Priority Register 3 (IPR3 - 0xE000 E40C)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_I2C2
I2C2 Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_SPI
SPI Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_SSP0
SSP0 Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_SSP1
SSP1 Interrupt Priority. See functional description for bits 7-3.
6.5.15 Interrupt Priority Register 4 (IPR4 - 0xE000 E410)
The IPR4 register controls the priority of the fifth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 66.
Interrupt Priority Register 4 (IPR4 - 0xE000 E410)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_PLL0
PLL0 (Main PLL) Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_RTC
Real Time Clock (RTC) Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_EINT0
External Interrupt 0 Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_EINT1
External Interrupt 1 Interrupt Priority. See functional description for bits 7-3.
6.5.16 Interrupt Priority Register 5 (IPR5 - 0xE000 E414)
The IPR5 register controls the priority of the sixth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 67.
Interrupt Priority Register 5 (IPR5 - 0xE000 E414)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_EINT2
External Interrupt 2 Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_EINT3
External Interrupt 3 Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_ADC
ADC Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_BOD
BOD Interrupt Priority. See functional description for bits 7-3.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
89 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.17 Interrupt Priority Register 6 (IPR6 - 0xE000 E418)
The IPR6 register controls the priority of the seventh group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 68.
Interrupt Priority Register 6 (IPR6 - 0xE000 E418)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_USB
USB Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_CAN
CAN Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_DMA
GPDMA Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_I2S
I2S Interrupt Priority. See functional description for bits 7-3.
6.5.18 Interrupt Priority Register 7 (IPR7 - 0xE000 E41C)
The IPR7 register controls the priority of the eighth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 69.
Interrupt Priority Register 7 (IPR7 - 0xE000 E41C)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_ENET
Ethernet Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_RIT
Repetitive Interrupt Timer Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_MCPWM
Motor Control PWM Interrupt Priority. See functional description for bits 7-3.
26:24 Unimplemented
These bits ignore writes, and read as 0.
31:27 IP_QEI
Quadrature Encoder Interface Interrupt Priority. See functional description for bits 7-3.
6.5.19 Interrupt Priority Register 8 (IPR8 - 0xE000 E420)
The IPR8 register controls the priority of the ninth and last group of 4 peripheral interrupts.
Each interrupt can have one of 32 priorities, where 0 is the highest priority.
Table 70.
Interrupt Priority Register 8 (IPR8 - 0xE000 E420)
Bit
Name
Function
2:0
Unimplemented
These bits ignore writes, and read as 0.
7:3
IP_PLL1
PLL1 (USB PLL) Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
10:8
Unimplemented
These bits ignore writes, and read as 0.
15:11 IP_USBACT
USB Activity Interrupt Priority. See functional description for bits 7-3.
18:16 Unimplemented
These bits ignore writes, and read as 0.
23:19 IP_CANACT
CAN Activity Interrupt Priority. See functional description for bits 7-3.
31:24 Unimplemented
These bits ignore writes, and read as 0.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
90 of 849
UM10360
NXP Semiconductors
Chapter 6: LPC176x/5x Nested Vectored Interrupt Controller (NVIC)
6.5.20 Software Trigger Interrupt Register (STIR - 0xE000 EF00)
The STIR register provides an alternate way for software to generate an interrupt, in
addition to using the ISPR registers. This mechanism can only be used to generate
peripheral interrupts, not system exceptions.
By default, only privileged software can write to the STIR register. Unprivileged software
can be given this ability if privileged software sets the USERSETMPEND bit in the CCR
register (see Section 34.4.3.8).
Table 71.
Software Trigger Interrupt Register (STIR - 0xE000 EF00)
Bit
Name
Function
8:0
INTID
Writing a value to this field generates an interrupt for the specified the interrupt number (see
Table 50). The range allowed for the LPC176x/5x is 0 to 111.
31:9
-
Reserved, user software should not write ones to reserved bits. The value read from a reserved
bit is not defined.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
91 of 849
UM10360
Chapter 7: LPC176x/5x Pin configuration
Rev. 3.1 — 2 April 2014
User manual
76
100
7.1 LPC176x/5x pin configuration
25
51
50
75
26
1
002aad945_1
61
80
Fig 14. LPC176x LQFP100 pin configuration
20
41
40
60
21
1
002aae158
Fig 15. LPC175x LQFP80 pin configuration
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
92 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
ball A1
index area
LPC1768FET100
1
2
3
4
5
6
7
8
9 10
A
B
C
D
E
F
G
H
J
K
002aaf723
Transparent top view
Fig 16. Pin configuration TFBGA100 package
LPC1768UK
bump A1
index area
1
2
3
4
5
6
7
8
9
10
A
B
C
D
E
F
G
H
J
K
aaa-009522
Transparent top view
Fig 17. Pin configuration WLCSP100 package
Table 72.
Pin allocation table TFBGA100 package
Pin Symbol
Pin Symbol
Pin Symbol
Pin Symbol
Row A
1
TDO/SWO
2
P0[3]/RXD0/AD0[6]
3
VDD(3V3)
4
P1[4]/ENET_TX_EN
5
P1[10]/ENET_RXD1
6
P1[16]/ENET_MDC
7
VDD(REG)(3V3)
8
P0[4]/I2SRX_CLK/
RD2/CAP2[0]
9
P0[7]/I2STX_CLK/
SCK1/MAT2[1]
10
P0[9]/I2STX_SDA/
MOSI1/MAT2[3]
11
-
12
-
2
RTCK
3
VSS
4
P1[1]/ENET_TXD1
Row B
1
TMS/SWDIO
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
93 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 72.
Pin allocation table TFBGA100 package …continued
Pin Symbol
Pin Symbol
Pin Symbol
Pin Symbol
5
P1[9]/ENET_RXD0
6
P1[17]/
ENET_MDIO
7
VSS
8
P0[6]/I2SRX_SDA/
SSEL1/MAT2[0]
9
P2[0]/PWM1[1]/TXD1
10
P2[1]/PWM1[2]/RXD1
11
-
12
-
Row C
1
TCK/SWDCLK
2
TRST
3
TDI
4
P0[2]/TXD0/AD0[7]
5
P1[8]/ENET_CRS
6
P1[15]/
ENET_REF_CLK
7
P4[28]/RX_MCLK/
MAT2[0]/TXD3
8
P0[8]/I2STX_WS/
MISO1/MAT2[2]
9
VSS
10
VDD(3V3)
11
-
12
-
Row D
1
P0[24]/AD0[1]/
I2SRX_WS/CAP3[1]
2
P0[25]/AD0[2]/
I2SRX_SDA/TXD3
3
P0[26]/AD0[3]/
AOUT/RXD3
4
n.c.
5
P1[0]/ENET_TXD0
6
P1[14]/ENET_RX_ER
7
P0[5]/I2SRX_WS/
TD2/CAP2[1]
8
P2[2]/PWM1[3]/
CTS1/TRACEDATA[3]
9
P2[4]/PWM1[5]/
DSR1/TRACEDATA[1]
10
P2[5]/PWM1[6]/
DTR1/TRACEDATA[0]
11
-
12
-
Row E
1
VSSA
2
VDDA
3
VREFP
4
n.c.
5
P0[23]/AD0[0]/
I2SRX_CLK/CAP3[0]
6
P4[29]/TX_MCLK/
MAT2[1]/RXD3
7
P2[3]/PWM1[4]/
DCD1/TRACEDATA[2]
8
P2[6]/PCAP1[0]/
RI1/TRACECLK
9
P2[7]/RD2/RTS1
10
P2[8]/TD2/TXD2
11
-
12
-
Row F
1
VREFN
2
RTCX1
3
RESET
4
P1[31]/SCK1/
AD0[5]
5
P1[21]/MCABORT/
PWM1[3]/SSEL0
6
P0[18]/DCD1/
MOSI0/MOSI
7
P2[9]/USB_CONNECT/
RXD2
8
P0[16]/RXD1/
SSEL0/SSEL
9
P0[17]/CTS1/
MISO0/MISO
10
P0[15]/TXD1/
SCK0/SCK
11
-
12
-
Row G
1
RTCX2
2
VBAT
3
XTAL2
4
P0[30]/USB_D
5
P1[25]/MCOA1/
MAT1[1]
6
P1[29]/MCOB2/
PCAP1[1]/MAT0[1]
7
VSS
8
P0[21]/RI1/RD1
9
P0[20]/DTR1/SCL1
10
P0[19]/DSR1/SDA1
11
-
12
-
Row H
1
P1[30]/VBUS/
AD0[4]
2
XTAL1
3
P3[25]/MAT0[0]/
PWM1[2]
4
P1[18]/USB_UP_LED/
PWM1[1]/CAP1[0]
5
P1[24]/MCI2/
PWM1[5]/MOSI0
6
VDD(REG)(3V3)
7
P0[10]/TXD2/
SDA2/MAT3[0]
8
P2[11]/EINT1/
I2STX_CLK
9
VDD(3V3)
10
P0[22]/RTS1/TD1
11
-
12
-
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
94 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 72.
Pin allocation table TFBGA100 package …continued
Pin Symbol
Pin Symbol
Pin Symbol
Pin Symbol
Row J
1
P0[28]/SCL0/
USB_SCL
2
P0[27]/SDA0/
USB_SDA
3
P0[29]/USB_D+
4
P1[19]/MCOA0/
USB_PPWR/
CAP1[1]
5
P1[22]/MCOB0/
USB_PWRD/
MAT1[0]
6
VSS
7
P1[28]/MCOA2/
PCAP1[0]/
MAT0[0]
8
P0[1]/TD1/RXD3/SCL1
9
P2[13]/EINT3/
I2STX_SDA
10
P2[10]/EINT0/NMI
11
-
12
-
Row K
1
P3[26]/STCLK/
MAT0[1]/PWM1[3]
2
VDD(3V3)
3
VSS
4
P1[20]/MCI0/
PWM1[2]/SCK0
5
P1[23]/MCI1/
PWM1[4]/MISO0
6
P1[26]/MCOB1/
PWM1[6]/CAP0[0]
7
P1[27]/CLKOUT
/USB_OVRCR/
CAP0[1]
8
P0[0]/RD1/TXD3/SDA1
9
P0[11]/RXD2/
SCL2/MAT3[1]
10
P2[12]/EINT2/
I2STX_WS
11
-
12
-
7.1.1 LPC176x/5x pin description
I/O pins on the LPC176x/5x are 5V tolerant and have input hysteresis unless indicated in
the table below. Crystal pins, power pins, and reference voltage pins are not 5V tolerant.
In addition, when pins are selected to be A to D converter inputs, they are no longer 5V
tolerant and must be limited to the voltage at the ADC positive reference pin (VREFP).
Table 73.
Pin description (LPC175x)
Symbol
Pin
P0[0] to P0[31]
P0[0]/RD1/TXD3/
SDA1
P0[1]/TD1/RXD3/
SCL1
37[1]
38[1]
P0[2]/TXD0/AD0[7] 79[2]
P0[3]/RXD0/AD0[6]
UM10360
User manual
80[2]
Type
Description
I/O
Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The
operation of Port 0 pins depends upon the pin function selected via the pin
connect block. Some port pins are not available on the LQFP80 package.
I/O
P0[0] — General purpose digital input/output pin.
I
RD1 — CAN1 receiver input.
O
TXD3 — Transmitter output for UART3.
I/O
SDA1 — I2C1 data input/output (this is not an I2C-bus compliant open-drain pin).
I/O
P0[1] — General purpose digital input/output pin.
O
TD1 — CAN1 transmitter output.
I
RXD3 — Receiver input for UART3.
I/O
SCL1 — I2C1 clock input/output (this is not an I2C-bus compliant open-drain pin).
I/O
P0[2] — General purpose digital input/output pin.
O
TXD0 — Transmitter output for UART0.
I
AD0[7] — A/D converter 0, input 7.
I/O
P0[3] — General purpose digital input/output pin.
I
RXD0 — Receiver input for UART0.
I
AD0[6] — A/D converter 0, input 6.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
95 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 73.
Pin description (LPC175x) …continued
Symbol
Pin
Type
Description
P0[6]/
I2SRX_SDA/
SSEL1/MAT2[0]
64[1]
I/O
P0[6] — General purpose digital input/output pin.
I/O
I2SRX_SDA — Receive data. It is driven by the transmitter and read by the
receiver. Corresponds to the signal SD in the I2S-bus specification.
(LPC1759/58/56 only).
I/O
SSEL1 — Slave Select for SSP1.
O
MAT2[0] — Match output for Timer 2, channel 0.
I/O
P0[7] — General purpose digital input/output pin.
I/O
I2STX_CLK — Transmit Clock. It is driven by the master and received by the
slave. Corresponds to the signal SCK in the I2S-bus specification.
(LPC1759/58/56 only).
I/O
SCK1 — Serial Clock for SSP1.
O
MAT2[1] — Match output for Timer 2, channel 1.
I/O
P0[8] — General purpose digital input/output pin.
I/O
I2STX_WS — Transmit Word Select. It is driven by the master and received by the
slave. Corresponds to the signal WS in the I2S-bus specification. (LPC1759/58/56
only).
I/O
MISO1 — Master In Slave Out for SSP1.
O
MAT2[2] — Match output for Timer 2, channel 2.
I/O
P0[9] — General purpose digital input/output pin.
I/O
I2STX_SDA — Transmit data. It is driven by the transmitter and read by the
receiver. Corresponds to the signal SD in the I2S-bus specification.
(LPC1759/58/56 only).
I/O
MOSI1 — Master Out Slave In for SSP1.
O
MAT2[3] — Match output for Timer 2, channel 3.
I/O
P0[10] — General purpose digital input/output pin.
O
TXD2 — Transmitter output for UART2.
I/O
SDA2 — I2C2 data input/output (this is not an open-drain pin).
O
MAT3[0] — Match output for Timer 3, channel 0.
I/O
P0[11] — General purpose digital input/output pin.
I
RXD2 — Receiver input for UART2.
I/O
SCL2 — I2C2 clock input/output (this is not an open-drain pin).
O
MAT3[1] — Match output for Timer 3, channel 1.
I/O
P0[15] — General purpose digital input/output pin.
O
TXD1 — Transmitter output for UART1.
I/O
SCK0 — Serial clock for SSP0.
I/O
SCK — Serial clock for SPI.
I/O
P0[16] — General purpose digital input/output pin.
I
RXD1 — Receiver input for UART1.
I/O
SSEL0 — Slave Select for SSP0.
I/O
SSEL — Slave Select for SPI.
P0[7]/I2STX_CLK/
SCK1/MAT2[1]
P0[8]/I2STX_WS/
MISO1/MAT2[2]
P0[9]/I2STX_SDA/
MOSI1/MAT2[3]
P0[10]/TXD2/
SDA2/MAT3[0]
P0[11]/RXD2/
SCL2/MAT3[1]
P0[15]/TXD1/
SCK0/SCK
P0[16]/RXD1/
SSEL0/SSEL
UM10360
User manual
63[1]
62[1]
61[1]
39[1]
40[1]
47[1]
48[1]
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
96 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 73.
Pin description (LPC175x) …continued
Symbol
Pin
Type
Description
P0[17]/CTS1/
MISO0/MISO
46[1]
I/O
P0[17] — General purpose digital input/output pin.
I
CTS1 — Clear to Send input for UART1.
P0[18]/DCD1/
MOSI0/MOSI
P0[22]/RTS1/TD1
45[1]
44[1]
P0[25]/AD0[2]/
I2SRX _SDA/
TXD3
7[2]
P0[26]/AD0[3]/
AOUT/RXD3
6[3]
P0[29]/USB_D+
P0[30]/USB_D
22[4]
23[4]
P1[0] to P1[31]
I/O
MISO0 — Master In Slave Out for SSP0.
I/O
MISO — Master In Slave Out for SPI.
I/O
P0[18] — General purpose digital input/output pin.
I
DCD1 — Data Carrier Detect input for UART1.
I/O
MOSI0 — Master Out Slave In for SSP0.
I/O
MOSI — Master Out Slave In for SPI.
I/O
P0[22] — General purpose digital input/output pin.
O
RTS1 — Request to Send output for UART1. Can also be configured to be an
RS-485/EIA-485 output enable signal.
O
TD1 — CAN1 transmitter output.
I/O
P0[25] — General purpose digital input/output pin.
I
AD0[2] — A/D converter 0, input 2.
I/O
I2SRX_SDA — Receive data. It is driven by the transmitter and read by the
receiver. Corresponds to the signal SD in the I2S-bus specification.
(LPC1759/58/56 only).
O
TXD3 — Transmitter output for UART3.
I/O
P0[26] — General purpose digital input/output pin.
I
AD0[3] — A/D converter 0, input 3.
O
AOUT — DAC output. (LPC1759/58/56/54 only).
I
RXD3 — Receiver input for UART3.
I/O
P0[29] — General purpose digital input/output pin.
I/O
USB_D+ — USB bidirectional D+ line.
I/O
P0[30] — General purpose digital input/output pin.
I/O
USB_D — USB bidirectional D line.
I/O
Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 1 pins depends upon the pin function selected via the pin connect
block. Some port pins are not available on the LQFP80 package.
P1[0]/
ENET_TXD0
76[1]
I/O
P1[0] — General purpose digital input/output pin.
O
ENET_TXD0 — Ethernet transmit data 0. (LPC1758 only).
P1[1]/
ENET_TXD1
75[1]
I/O
P1[1] — General purpose digital input/output pin.
O
ENET_TXD1 — Ethernet transmit data 1. (LPC1758 only).
P1[4]/
ENET_TX_EN
74[1]
I/O
P1[4] — General purpose digital input/output pin.
O
ENET_TX_EN — Ethernet transmit data enable. (LPC1758 only).
P1[8]/
ENET_CRS
73[1]
I/O
P1[8] — General purpose digital input/output pin.
I
ENET_CRS — Ethernet carrier sense. (LPC1758 only).
P1[9]/
ENET_RXD0
72[1]
I/O
P1[9] — General purpose digital input/output pin.
I
ENET_RXD0 — Ethernet receive data. (LPC1758 only).
P1[10]/
ENET_RXD1
71[1]
I/O
P1[10] — General purpose digital input/output pin.
I
ENET_RXD1 — Ethernet receive data. (LPC1758 only).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
97 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 73.
Pin description (LPC175x) …continued
Symbol
Pin
Type
Description
P1[14]/
ENET_RX_ER
70[1]
I/O
P1[14] — General purpose digital input/output pin.
I
ENET_RX_ER — Ethernet receive error. (LPC1758 only).
P1[15]/
ENET_REF_CLK
69[1]
I/O
P1[15] — General purpose digital input/output pin.
I
ENET_REF_CLK — Ethernet reference clock. (LPC1758 only).
P1[18]/
USB_UP_LED/
PWM1[1]/
CAP1[0]
25[1]
I/O
P1[18] — General purpose digital input/output pin.
O
USB_UP_LED — USB GoodLink LED indicator. It is LOW when the device is
configured (non-control endpoints enabled), or when the host is enabled and has
detected a device on the bus. It is HIGH when the device is not configured, or
when host is enabled and has not detected a device on the bus, or during global
suspend. It transitions between LOW and HIGH (flashes) when the host is enabled
and detects activity on the bus.
O
PWM1[1] — Pulse Width Modulator 1, channel 1 output.
I
CAP1[0] — Capture input for Timer 1, channel 0.
I/O
P1[19] — General purpose digital input/output pin.
P1[19]/MCOA0/
USB_PPWR
CAP1[1]
26[1]
P1[20]/MCI0/
PWM1[2]/SCK0
27[1]
P1[22]/MCOB0/
USB_PWRD/
MAT1[0]
28[1]
P1[23]/MCI1/
PWM1[4]/MISO0
29[1]
P1[24]/MCI2/
PWM1[5]/MOSI0
P1[25]/MCOA1/
MAT1[1]
UM10360
User manual
30[1]
31[1]
O
MCOA0 — Motor control PWM channel 0, output A.
O
USB_PPWR — Port Power enable signal for USB port. (LPC1759/58/56/54 only).
I
CAP1[1] — Capture input for Timer 1, channel 1.
I/O
P1[20] — General purpose digital input/output pin.
I
MCI0 — Motor control PWM channel 0, input. Also Quadrature Encoder Interface
PHA input.
O
PWM1[2] — Pulse Width Modulator 1, channel 2 output.
I/O
SCK0 — Serial clock for SSP0.
I/O
P1[22] — General purpose digital input/output pin.
O
MCOB0 — Motor control PWM channel 0, output B.
I
USB_PWRD — Power Status for USB port (host power switch).
(LPC1759/58/56/54 only).
O
MAT1[0] — Match output for Timer 1, channel 0.
I/O
P1[23] — General purpose digital input/output pin.
I
MCI1 — Motor control PWM channel 1, input. Also Quadrature Encoder Interface
PHB input.
O
PWM1[4] — Pulse Width Modulator 1, channel 4 output.
I/O
MISO0 — Master In Slave Out for SSP0.
I/O
P1[24] — General purpose digital input/output pin.
I
MCI2 — Motor control PWM channel 2, input. Also Quadrature Encoder Interface
INDEX input.
O
PWM1[5] — Pulse Width Modulator 1, channel 5 output.
I/O
MOSI0 — Master Out Slave in for SSP0.
I/O
P1[25] — General purpose digital input/output pin.
O
MCOA1 — Motor control PWM channel 1, output A.
O
MAT1[1] — Match output for Timer 1, channel 1.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
98 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 73.
Pin description (LPC175x) …continued
Symbol
Pin
Type
Description
P1[26]/MCOB1/
PWM1[6]/CAP0[0]
32[1]
I/O
P1[26] — General purpose digital input/output pin.
O
MCOB1 — Motor control PWM channel 1, output B.
O
PWM1[6] — Pulse Width Modulator 1, channel 6 output.
I
CAP0[0] — Capture input for Timer 0, channel 0.
I/O
P1[28] — General purpose digital input/output pin.
O
MCOA2 — Motor control PWM channel 2, output A.
I
PCAP1[0] — Capture input for PWM1, channel 0.
O
MAT0[0] — Match output for Timer 0, channel 0.
I/O
P1[29] — General purpose digital input/output pin.
O
MCOB2 — Motor control PWM channel 2, output B.
I
PCAP1[1] — Capture input for PWM1, channel 1.
O
MAT0[1] — Match output for Timer 0, channel 1.
I/O
P1[30] — General purpose digital input/output pin.
I
VBUS — Monitors the presence of USB bus power.
P1[28]/MCOA2/
PCAP1[0]/
MAT0[0]
P1[29]/MCOB2/
PCAP1[1]/
MAT0[1]
P1[30]/VBUS/
AD0[4]
35[1]
36[1]
18[2]
Note: This signal must be HIGH for USB reset to occur.
P1[31]/SCK1/
AD0[5]
17[2]
P2[0] to P2[31]
P2[0]/PWM1[1]/
TXD1
60[1]
P2[1]/PWM1[2]/
RXD1
59[1]
P2[2]/PWM1[3]/
CTS1/
TRACEDATA[3]
58[1]
P2[3]/PWM1[4]/
DCD1/
TRACEDATA[2]
55[1]
P2[4]/PWM1[5]/
DSR1/
TRACEDATA[1]
54[1]
UM10360
User manual
I
AD0[4] — A/D converter 0, input 4.
I/O
P1[31] — General purpose digital input/output pin.
I/O
SCK1 — Serial Clock for SSP1.
I
AD0[5] — A/D converter 0, input 5.
I/O
Port 2: Port 2 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 2 pins depends upon the pin function selected via the pin connect
block. Some port pins are not available on the LQFP80 package.
I/O
P2[0] — General purpose digital input/output pin.
O
PWM1[1] — Pulse Width Modulator 1, channel 1 output.
O
TXD1 — Transmitter output for UART1.
I/O
P2[1] — General purpose digital input/output pin.
O
PWM1[2] — Pulse Width Modulator 1, channel 2 output.
I
RXD1 — Receiver input for UART1.
I/O
P2[2] — General purpose digital input/output pin.
O
PWM1[3] — Pulse Width Modulator 1, channel 3 output.
I
CTS1 — Clear to Send input for UART1.
O
TRACEDATA[3] — Trace data, bit 3.
I/O
P2[3] — General purpose digital input/output pin.
O
PWM1[4] — Pulse Width Modulator 1, channel 4 output.
I
DCD1 — Data Carrier Detect input for UART1.
O
TRACEDATA[2] — Trace data, bit 2.
I/O
P2[4] — General purpose digital input/output pin.
O
PWM1[5] — Pulse Width Modulator 1, channel 5 output.
I
DSR1 — Data Set Ready input for UART1.
O
TRACEDATA[1] — Trace data, bit 1.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
99 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 73.
Pin description (LPC175x) …continued
Symbol
Pin
Type
Description
P2[5]/PWM1[6]/
DTR1/
TRACEDATA[0]
53[1]
I/O
P2[5] — General purpose digital input/output pin.
O
PWM1[6] — Pulse Width Modulator 1, channel 6 output.
O
DTR1 — Data Terminal Ready output for UART1. Can also be configured to be an
RS-485/EIA-485 output enable signal.
O
TRACEDATA[0] — Trace data, bit 0.
P2[6]/PCAP1[0]/
RI1/TRACECLK
52[1]
I/O
P2[6] — General purpose digital input/output pin.
P2[7]/RD2/
RTS1
P2[8]/TD2/
TXD2
51[1]
50[1]
P2[9]/
USB_CONNECT/
RXD2
49[1]
P2[10]/EINT0/NMI
41[5]
P4[0] to P4[31]
P4[28]/RX_MCLK/
MAT2[0]/TXD3
P4[29]/TX_MCLK/
MAT2[1]/RXD3
65[1]
68[1]
I
PCAP1[0] — Capture input for PWM1, channel 0.
I
RI1 — Ring Indicator input for UART1.
O
TRACECLK — Trace Clock.
I/O
P2[7] — General purpose digital input/output pin.
I
RD2 — CAN2 receiver input. (LPC1759/58/56 only).
O
RTS1 — Request to Send output for UART1. Can also be configured to be an
RS-485/EIA-485 output enable signal.
I/O
P2[8] — General purpose digital input/output pin.
O
TD2 — CAN2 transmitter output. (LPC1759/58/56 only).
O
TXD2 — Transmitter output for UART2.
I/O
P2[9] — General purpose digital input/output pin.
O
USB_CONNECT — Signal used to switch an external 1.5 k
software control. Used with the SoftConnect USB feature.
I
RXD2 — Receiver input for UART2.
I/O
P2[10] — General purpose digital input/output pin. A LOW level on this pin during
reset starts the ISP command handler.
I
EINT0 — External interrupt 0 input.
I
NMI — Non-maskable interrupt input.
I/O
Port 4: Port 4 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 4 pins depends upon the pin function selected via the pin connect
block. Some port pins are not available on the LQFP80 package.
I/O
P4[28] — General purpose digital input/output pin.
O
RX_MCLK — I2S receive master clock. (LPC1759/58/56 only).
O
MAT2[0] — Match output for Timer 2, channel 0.
O
TXD3 — Transmitter output for UART3.
I/O
P4[29] — General purpose digital input/output pin.
O
TX_MCLK — I2S transmit master clock. (LPC1759/58/56 only).
O
MAT2[1] — Match output for Timer 2, channel 1.
I
RXD3 — Receiver input for UART3.
O
TDO — Test Data out for JTAG interface.
TDO/SWO
1[6]
O
SWO — Serial wire trace output.
TDI
2[7]
I
TDI — Test Data in for JTAG interface.
TMS/SWDIO
3[7]
I
TMS — Test Mode Select for JTAG interface.
I/O
SWDIO — Serial wire debug data input/output.
I
TRST — Test Reset for JTAG interface.
TRST
UM10360
User manual
4[7]
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
resistor under
© NXP B.V. 2014. All rights reserved.
100 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 73.
Pin description (LPC175x) …continued
Symbol
Pin
Type
Description
TCK/SWDCLK
5[6]
I
TCK — Test Clock for JTAG interface.
I
SWDCLK — Serial wire clock.
RSTOUT
11
O
RSTOUT — This is a 3.3 V pin. LOW on this pin indicates UM10360 being in
Reset state.
RESET
14[8]
I
External reset input: A LOW-going pulse as short as 50 ns on this pin resets the
device, causing I/O ports and peripherals to take on their default states, and
processor execution to begin at address 0. TTL with hysteresis, 5 V tolerant.
XTAL1
19[9][10]
I
Input to the oscillator circuit and internal clock generator circuits.
XTAL2
20[9][10]
O
Output from the oscillator amplifier.
RTCX1
13[9][11]
I
Input to the RTC oscillator circuit.
RTCX2
15[9]
O
Output from the RTC oscillator circuit.
VSS
24, 33,
43, 57,
66, 78
I
ground: 0 V reference.
VSSA
9
I
analog ground: 0 V reference. This should nominally be the same voltage as VSS,
but should be isolated to minimize noise and error.
VDD(3V3)
21, 42,
56, 77
I
3.3 V supply voltage: This is the power supply voltage for the I/O ports.
VDD(REG)(3V3)
34, 67
I
3.3 V voltage regulator supply voltage: This is the supply voltage for the on-chip
voltage regulator only.
VDDA
8
I
analog 3.3 V pad supply voltage: This should be nominally the same voltage as
VDD(3V3) but should be isolated to minimize noise and error. This voltage is used to
power the ADC and DAC. This pin should be tied to 3.3 V if the ADC and DAC are
not used.
VREFP
10
I
ADC positive reference voltage: This should be nominally the same voltage as
VDDA but should be isolated to minimize noise and error. Level on this pin is used
as a reference for ADC and DAC. This pin should be tied to 3.3 V if the ADC and
DAC are not used.
VREFN
12
I
ADC negative reference voltage: This should be nominally the same voltage as
VSS but should be isolated to minimize noise and error. Level on this pin is used as
a reference for ADC and DAC.
VBAT
16[11]
I
RTC pin power supply: 3.3 V on this pin supplies the power to the RTC
peripheral.
[1]
5 V tolerant pad providing digital I/O functions with TTL levels and hysteresis. This pin is pulled up to a voltage level of 2.3 V to 2.6 V.
[2]
5 V tolerant pad providing digital I/O functions (with TTL levels and hysteresis) and analog input. When configured as a ADC input,
digital section of the pad is disabled and the pin is not 5 V tolerant. This pin is pulled up to a voltage level of 2.3 V to 2.6 V.
[3]
5 V tolerant pad providing digital I/O with TTL levels and hysteresis and analog output function. When configured as the DAC output,
digital section of the pad is disabled. This pin is pulled up to a voltage level of 2.3 V to 2.6 V.
[4]
Pad provides digital I/O and USB functions. It is designed in accordance with the USB specification, revision 2.0 (Full-speed and
Low-speed mode only). This pad is not 5 V tolerant.
[5]
5 V tolerant pad with 10 ns glitch filter providing digital I/O functions with TTL levels and hysteresis. This pin is pulled up to a voltage
level of 2.3 V to 2.6 V.
[6]
5 V tolerant pad with TTL levels and hysteresis. Internal pull-up and pull-down resistors disabled.
[7]
5 V tolerant pad with TTL levels and hysteresis and internal pull-up resistor.
[8]
5 V tolerant pad with 20 ns glitch filter providing digital I/O function with TTL levels and hysteresis.
[9]
Pad provides special analog functionality. 32 kHz crystal oscillator must be used with the RTC.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
101 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
[10] When the system oscillator is not used, connect XTAL1 and XTAL2 as follows: XTAL1 can be left floating or can be grounded (grounding
is preferred to reduce susceptibility to noise). XTAL2 should be left floating.
[11] When the RTC is not used, connect VBAT to VDD(REG)(3V3) and leave RTCX1 floating.
P0[0] to P0[31]
P0[0]/RD1/TXD3/
SDA1
P0[1]/TD1/RXD3/
SCL1
46
47
P0[2]/TXD0/AD0[7] 98
P0[3]/RXD0/AD0[6] 99
P0[4]/
I2SRX_CLK/
RD2/CAP2[0]
P0[5]/
I2SRX_WS/
TD2/CAP2[1]
UM10360
User manual
81
80
K8
J8
C4
A2
A8
D7
Type
Description
I/O
Port 0: Port 0 is a 32-bit I/O port with individual direction controls for
each bit. The operation of port 0 pins depends upon the pin function
selected via the pin connect block. Pins 12, 13, 14, and 31 of this
port are not available.
WLCSP100
Pin/ball
TFBGA100
Pin description (LPC176x)
Symbol
LQFP100
Table 74.
H10
H9
B1
C3
G2
H1
[1]
[1]
[2]
[2]
[1]
[1]
I/O
P0[0] — General purpose digital input/output pin.
I
RD1 — CAN1 receiver input. (LPC1769/68/66/65/64 only).
O
TXD3 — Transmitter output for UART3.
I/O
SDA1 — I2C1 data input/output. (This is not an I2C-bus compliant
open-drain pin).
I/O
P0[1] — General purpose digital input/output pin.
O
TD1 — CAN1 transmitter output. (LPC1769/68/66/65/64 only).
I
RXD3 — Receiver input for UART3.
I/O
SCL1 — I2C1 clock input/output. (This is not an I2C-bus compliant
open-drain pin).
I/O
P0[2] — General purpose digital input/output pin.
O
TXD0 — Transmitter output for UART0.
I
AD0[7] — A/D converter 0, input 7.
I/O
P0[3] — General purpose digital input/output pin.
I
RXD0 — Receiver input for UART0.
I
AD0[6] — A/D converter 0, input 6.
I/O
P0[4] — General purpose digital input/output pin.
I/O
I2SRX_CLK — Receive Clock. It is driven by the master and
received by the slave. Corresponds to the signal SCK in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I
RD2 — CAN2 receiver input. (LPC1769/68/66/65/64 only).
I
CAP2[0] — Capture input for Timer 2, channel 0.
I/O
P0[5] — General purpose digital input/output pin.
I/O
I2SRX_WS — Receive Word Select. It is driven by the master and
received by the slave. Corresponds to the signal WS in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
O
TD2 — CAN2 transmitter output. (LPC1769/68/66/65/64 only).
I
CAP2[1] — Capture input for Timer 2, channel 1.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
102 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
P0[7]/
I2STX_CLK/
SCK1/MAT2[1]
P0[8]/
I2STX_WS/
MISO1/MAT2[2]
P0[9]/
I2STX_SDA/
MOSI1/MAT2[3]
P0[10]/TXD2/
SDA2/MAT3[0]
P0[11]/RXD2/
SCL2/MAT3[1]
P0[15]/TXD1/
SCK0/SCK
UM10360
User manual
WLCSP100
P0[6]/
I2SRX_SDA/
SSEL1/MAT2[0]
Pin/ball
TFBGA100
Symbol
LQFP100
Table 74.
79
B8
G3
78
77
76
48
49
62
A9
C8
J1
H2
A10 H3
H7
K9
H8
J10
F10 H6
[1]
[1]
[1]
[1]
[1]
[1]
[1]
Type
Description
I/O
P0[6] — General purpose digital input/output pin.
I/O
I2SRX_SDA — Receive data. It is driven by the transmitter and read
by the receiver. Corresponds to the signal SD in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I/O
SSEL1 — Slave Select for SSP1.
O
MAT2[0] — Match output for Timer 2, channel 0.
I/O
P0[7] — General purpose digital input/output pin.
I/O
I2STX_CLK — Transmit Clock. It is driven by the master and
received by the slave. Corresponds to the signal SCK in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I/O
SCK1 — Serial Clock for SSP1.
O
MAT2[1] — Match output for Timer 2, channel 1.
I/O
P0[8] — General purpose digital input/output pin.
I/O
I2STX_WS — Transmit Word Select. It is driven by the master and
received by the slave. Corresponds to the signal WS in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I/O
MISO1 — Master In Slave Out for SSP1.
O
MAT2[2] — Match output for Timer 2, channel 2.
I/O
P0[9] — General purpose digital input/output pin.
I/O
I2STX_SDA — Transmit data. It is driven by the transmitter and
read by the receiver. Corresponds to the signal SD in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I/O
MOSI1 — Master Out Slave In for SSP1.
O
MAT2[3] — Match output for Timer 2, channel 3.
I/O
P0[10] — General purpose digital input/output pin.
O
TXD2 — Transmitter output for UART2.
I/O
SDA2 — I2C2 data input/output (this is not an open-drain pin).
O
MAT3[0] — Match output for Timer 3, channel 0.
I/O
P0[11] — General purpose digital input/output pin.
I
RXD2 — Receiver input for UART2.
I/O
SCL2 — I2C2 clock input/output (this is not an open-drain pin).
O
MAT3[1] — Match output for Timer 3, channel 1.
I/O
P0[15] — General purpose digital input/output pin.
O
TXD1 — Transmitter output for UART1.
I/O
SCK0 — Serial clock for SSP0.
I/O
SCK — Serial clock for SPI.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
103 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
P0[17]/CTS1/
MISO0/MISO
P0[18]/DCD1/
MOSI0/MOSI
P0[19]/DSR1/
SDA1
WLCSP100
P0[16]/RXD1/
SSEL0/SSEL
Pin/ball
TFBGA100
Symbol
LQFP100
Table 74.
63
F8
J5
61
60
59
P0[20]/DTR1/SCL1 58
P0[21]/RI1/RD1
P0[22]/RTS1/TD1
P0[23]/AD0[0]/
I2SRX_CLK/
CAP3[0]
UM10360
User manual
57
56
9
F9
F6
K6
J6
G10 K7
G9
G8
J7
H7
H10 K8
E5
D5
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[2]
Type
Description
I/O
P0[16] — General purpose digital input/output pin.
I
RXD1 — Receiver input for UART1.
I/O
SSEL0 — Slave Select for SSP0.
I/O
SSEL — Slave Select for SPI.
I/O
P0[17] — General purpose digital input/output pin.
I
CTS1 — Clear to Send input for UART1.
I/O
MISO0 — Master In Slave Out for SSP0.
I/O
MISO — Master In Slave Out for SPI.
I/O
P0[18] — General purpose digital input/output pin.
I
DCD1 — Data Carrier Detect input for UART1.
I/O
MOSI0 — Master Out Slave In for SSP0.
I/O
MOSI — Master Out Slave In for SPI.
I/O
P0[19] — General purpose digital input/output pin.
I
DSR1 — Data Set Ready input for UART1.
I/O
SDA1 — I2C1 data input/output (this is not an I2C-bus compliant
open-drain pin).
I/O
P0[20] — General purpose digital input/output pin.
O
DTR1 — Data Terminal Ready output for UART1. Can also be
configured to be an RS-485/EIA-485 output enable signal.
I/O
SCL1 — I2C1 clock input/output (this is not an I2C-bus compliant
open-drain pin).
I/O
P0[21] — General purpose digital input/output pin.
I
RI1 — Ring Indicator input for UART1.
I
RD1 — CAN1 receiver input. (LPC1769/68/66/65/64 only).
I/O
P0[22] — General purpose digital input/output pin.
O
RTS1 — Request to Send output for UART1. Can also be
configured to be an RS-485/EIA-485 output enable signal.
O
TD1 — CAN1 transmitter output. (LPC1769/68/66/65/64 only).
I/O
P0[23] — General purpose digital input/output pin.
I
AD0[0] — A/D converter 0, input 0.
I/O
I2SRX_CLK — Receive Clock. It is driven by the master and
received by the slave. Corresponds to the signal SCK in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I
CAP3[0] — Capture input for Timer 3, channel 0.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
104 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
P0[25]/AD0[2]/
I2SRX_SDA/
TXD3
P0[26]/AD0[3]/
AOUT/RXD3
P0[27]/SDA0/
USB_SDA
P0[28]/SCL0/
USB_SCL
P0[29]/USB_D+
P0[30]/USB_D
WLCSP100
P0[24]/AD0[1]/
I2SRX_WS/
CAP3[1]
Pin/ball
TFBGA100
Symbol
LQFP100
Table 74.
8
D1
B4
7
6
25
24
29
30
D2
D3
J2
J1
J3
G4
A3
C5
C8
B9
B10
C9
[2]
[2]
[3]
[4]
[4]
[5]
[5]
P1[0] to P1[31]
P1[0]/
ENET_TXD0
UM10360
User manual
95
D5
C1
[1]
Type
Description
I/O
P0[24] — General purpose digital input/output pin.
I
AD0[1] — A/D converter 0, input 1.
I/O
I2SRX_WS — Receive Word Select. It is driven by the master and
received by the slave. Corresponds to the signal WS in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I
CAP3[1] — Capture input for Timer 3, channel 1.
I/O
P0[25] — General purpose digital input/output pin.
I
AD0[2] — A/D converter 0, input 2.
I/O
I2SRX_SDA — Receive data. It is driven by the transmitter and read
by the receiver. Corresponds to the signal SD in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
O
TXD3 — Transmitter output for UART3.
I/O
P0[26] — General purpose digital input/output pin.
I
AD0[3] — A/D converter 0, input 3.
O
AOUT — DAC output (LPC1769/68/67/66/65/63 only).
I
RXD3 — Receiver input for UART3.
I/O
P0[27] — General purpose digital input/output pin. Output is
open-drain.
I/O
SDA0 — I2C0 data input/output. Open-drain output (for I2C-bus
compliance).
I/O
USB_SDA — USB port I2C serial data (OTG transceiver,
LPC1769/68/66/65 only).
I/O
P0[28] — General purpose digital input/output pin. Output is
open-drain.
I/O
SCL0 — I2C0 clock input/output. Open-drain output (for I2C-bus
compliance).
I/O
USB_SCL — USB port I2C serial clock (OTG transceiver,
LPC1769/68/66/65 only).
I/O
P0[29] — General purpose digital input/output pin.
I/O
USB_D+ — USB bidirectional D+ line. (LPC1769/68/66/65/64 only).
I/O
P0[30] — General purpose digital input/output pin.
I/O
USB_D — USB bidirectional D line. (LPC1769/68/66/65/64 only).
I/O
Port 1: Port 1 is a 32-bit I/O port with individual direction controls for
each bit. The operation of port 1 pins depends upon the pin function
selected via the pin connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13
of this port are not available.
I/O
P1[0] — General purpose digital input/output pin.
O
ENET_TXD0 — Ethernet transmit data 0. (LPC1769/68/67/66/64
only).
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
105 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 74.
Pin description (LPC176x) …continued
TFBGA100
WLCSP100
Pin/ball
LQFP100
Symbol
P1[1]/
ENET_TXD1
94
B4
C2
P1[4]/
ENET_TX_EN
93
P1[8]/
ENET_CRS
92
P1[9]/
ENET_RXD0
91
P1[10]/
ENET_RXD1
90
P1[14]/
ENET_RX_ER
89
P1[15]/
ENET_REF_CLK
88
P1[16]/
ENET_MDC
87
P1[17]/
ENET_MDIO
86
P1[18]/
USB_UP_LED/
PWM1[1]/
CAP1[0]
32
P1[19]/MCOA0/
USB_PPWR/
CAP1[1]
UM10360
User manual
33
A4
C5
B5
A5
D6
C6
A6
B6
H4
J4
D2
[1]
[1]
D1
[1]
D3
[1]
E3
E2
E1
F3
F2
D9
C10
[1]
[1]
[1]
[1]
[1]
[1]
[1]
Type
Description
I/O
P1[1] — General purpose digital input/output pin.
O
ENET_TXD1 — Ethernet transmit data 1. (LPC1769/68/67/66/64
only).
I/O
P1[4] — General purpose digital input/output pin.
O
ENET_TX_EN — Ethernet transmit data enable.
(LPC1769/68/67/66/64 only).
I/O
P1[8] — General purpose digital input/output pin.
I
ENET_CRS — Ethernet carrier sense. (LPC1769/68/67/66/64 only).
I/O
P1[9] — General purpose digital input/output pin.
I
ENET_RXD0 — Ethernet receive data. (LPC1769/68/67/66/64
only).
I/O
P1[10] — General purpose digital input/output pin.
I
ENET_RXD1 — Ethernet receive data. (LPC1769/68/67/66/64
only).
I/O
P1[14] — General purpose digital input/output pin.
I
ENET_RX_ER — Ethernet receive error. (LPC1769/68/67/66/64
only).
I/O
P1[15] — General purpose digital input/output pin.
I
ENET_REF_CLK — Ethernet reference clock.
(LPC1769/68/67/66/64 only).
I/O
P1[16] — General purpose digital input/output pin.
O
ENET_MDC — Ethernet MIIM clock (LPC1769/68/67/66/64 only).
I/O
P1[17] — General purpose digital input/output pin.
I/O
ENET_MDIO — Ethernet MIIM data input and output.
(LPC1769/68/67/66/64 only).
I/O
P1[18] — General purpose digital input/output pin.
O
USB_UP_LED — USB GoodLink LED indicator. It is LOW when the
device is configured (non-control endpoints enabled), or when the
host is enabled and has detected a device on the bus. It is HIGH
when the device is not configured, or when host is enabled and has
not detected a device on the bus, or during global suspend. It
transitions between LOW and HIGH (flashes) when the host is
enabled and detects activity on the bus. (LPC1769/68/66/65/64
only).
O
PWM1[1] — Pulse Width Modulator 1, channel 1 output.
I
CAP1[0] — Capture input for Timer 1, channel 0.
I/O
P1[19] — General purpose digital input/output pin.
O
MCOA0 — Motor control PWM channel 0, output A.
O
USB_PPWR — Port Power enable signal for USB port.
(LPC1769/68/66/65 only).
I
CAP1[1] — Capture input for Timer 1, channel 1.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
106 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
WLCSP100
P1[20]/MCI0/
PWM1[2]/SCK0
Pin/ball
TFBGA100
Symbol
LQFP100
Table 74.
34
K4
E8
P1[21]/MCABORT/ 35
PWM1[3]/
SSEL0
F5
P1[22]/MCOB0/
USB_PWRD/
MAT1[0]
J5
P1[23]/MCI1/
PWM1[4]/MISO0
P1[24]/MCI2/
PWM1[5]/MOSI0
P1[25]/MCOA1/
MAT1[1]
P1[26]/MCOB1/
PWM1[6]/CAP0[0]
P1[27]/CLKOUT
/USB_OVRCR/
CAP0[1]
UM10360
User manual
36
37
38
39
40
43
K5
H5
G5
K6
K7
E9
D10
E7
F8
F9
E10
G9
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
Type
Description
I/O
P1[20] — General purpose digital input/output pin.
I
MCI0 — Motor control PWM channel 0, input. Also Quadrature
Encoder Interface PHA input.
O
PWM1[2] — Pulse Width Modulator 1, channel 2 output.
I/O
SCK0 — Serial clock for SSP0.
I/O
P1[21] — General purpose digital input/output pin.
O
MCABORT — Motor control PWM, LOW-active fast abort.
O
PWM1[3] — Pulse Width Modulator 1, channel 3 output.
I/O
SSEL0 — Slave Select for SSP0.
I/O
P1[22] — General purpose digital input/output pin.
O
MCOB0 — Motor control PWM channel 0, output B.
I
USB_PWRD — Power Status for USB port (host power switch,
LPC1769/68/66/65 only).
O
MAT1[0] — Match output for Timer 1, channel 0.
I/O
P1[23] — General purpose digital input/output pin.
I
MCI1 — Motor control PWM channel 1, input. Also Quadrature
Encoder Interface PHB input.
O
PWM1[4] — Pulse Width Modulator 1, channel 4 output.
I/O
MISO0 — Master In Slave Out for SSP0.
I/O
P1[24] — General purpose digital input/output pin.
I
MCI2 — Motor control PWM channel 2, input. Also Quadrature
Encoder Interface INDEX input.
O
PWM1[5] — Pulse Width Modulator 1, channel 5 output.
I/O
MOSI0 — Master Out Slave in for SSP0.
I/O
P1[25] — General purpose digital input/output pin.
O
MCOA1 — Motor control PWM channel 1, output A.
O
MAT1[1] — Match output for Timer 1, channel 1.
I/O
P1[26] — General purpose digital input/output pin.
O
MCOB1 — Motor control PWM channel 1, output B.
O
PWM1[6] — Pulse Width Modulator 1, channel 6 output.
I
CAP0[0] — Capture input for Timer 0, channel 0.
I/O
P1[27] — General purpose digital input/output pin.
O
CLKOUT — Clock output pin.
I
USB_OVRCR — USB port Over-Current status. (LPC1769/68/66/65
only).
I
CAP0[1] — Capture input for Timer 0, channel 1.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
107 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
P1[29]/MCOB2/
PCAP1[1]/
MAT0[1]
P1[30]/VBUS/
AD0[4]
WLCSP100
P1[28]/MCOA2/
PCAP1[0]/
MAT0[0]
Pin/ball
TFBGA100
Symbol
LQFP100
Table 74.
44
J7
G10
45
21
G6
H1
G8
B8
[1]
[1]
[2]
Type
Description
I/O
P1[28] — General purpose digital input/output pin.
O
MCOA2 — Motor control PWM channel 2, output A.
I
PCAP1[0] — Capture input for PWM1, channel 0.
O
MAT0[0] — Match output for Timer 0, channel 0.
I/O
P1[29] — General purpose digital input/output pin.
O
MCOB2 — Motor control PWM channel 2, output B.
I
PCAP1[1] — Capture input for PWM1, channel 1.
O
MAT0[1] — Match output for Timer 0, channel 1.
I/O
P1[30] — General purpose digital input/output pin.
I
VBUS — Monitors the presence of USB bus power.
(LPC1769/68/66/65/64 only).
Note: This signal must be HIGH for USB reset to occur.
P1[31]/SCK1/
AD0[5]
20
F4
C7
[2]
P2[0] to P2[31]
P2[0]/PWM1[1]/
TXD1
P2[1]/PWM1[2]/
RXD1
P2[2]/PWM1[3]/
CTS1/
TRACEDATA[3]
P2[3]/PWM1[4]/
DCD1/
TRACEDATA[2]
P2[4]/PWM1[5]/
DSR1/
TRACEDATA[1]
UM10360
User manual
75
74
73
70
69
B9
K1
B10 J2
D8
E7
D9
K2
K3
J3
[1]
[1]
[1]
[1]
[1]
I
AD0[4] — A/D converter 0, input 4.
I/O
P1[31] — General purpose digital input/output pin.
I/O
SCK1 — Serial Clock for SSP1.
I
AD0[5] — A/D converter 0, input 5.
I/O
Port 2: Port 2 is a 32-bit I/O port with individual direction controls for
each bit. The operation of port 2 pins depends upon the pin function
selected via the pin connect block. Pins 14 through 31 of this port
are not available.
I/O
P2[0] — General purpose digital input/output pin.
O
PWM1[1] — Pulse Width Modulator 1, channel 1 output.
O
TXD1 — Transmitter output for UART1.
I/O
P2[1] — General purpose digital input/output pin.
O
PWM1[2] — Pulse Width Modulator 1, channel 2 output.
I
RXD1 — Receiver input for UART1.
I/O
P2[2] — General purpose digital input/output pin.
O
PWM1[3] — Pulse Width Modulator 1, channel 3 output.
I
CTS1 — Clear to Send input for UART1.
O
TRACEDATA[3] — Trace data, bit 3.
I/O
P2[3] — General purpose digital input/output pin.
O
PWM1[4] — Pulse Width Modulator 1, channel 4 output.
I
DCD1 — Data Carrier Detect input for UART1.
O
TRACEDATA[2] — Trace data, bit 2.
I/O
P2[4] — General purpose digital input/output pin.
O
PWM1[5] — Pulse Width Modulator 1, channel 5 output.
I
DSR1 — Data Set Ready input for UART1.
O
TRACEDATA[1] — Trace data, bit 1.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
108 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
Pin/ball
LQFP100
TFBGA100
Symbol
P2[5]/PWM1[6]/
DTR1/
TRACEDATA[0]
68
D10 H4
P2[6]/PCAP1[0]/
RI1/TRACECLK
67
P2[7]/RD2/
RTS1
P2[8]/TD2/
TXD2
66
65
P2[9]/
USB_CONNECT/
RXD2
64
P2[10]/EINT0/NMI
53
P2[11]/EINT1/
I2STX_CLK
P2[12]/EINT2/
I2STX_WS
P2[13]/EINT3/
I2STX_SDA
UM10360
User manual
52
51
50
E8
E9
K4
J4
E10 H5
F7
K5
J10 K9
H8
J8
K10 K10
J9
Type
Description
WLCSP100
Table 74.
J9
[1]
[1]
[1]
[1]
[1]
[6]
[6]
[6]
[6]
I/O
P2[5] — General purpose digital input/output pin.
O
PWM1[6] — Pulse Width Modulator 1, channel 6 output.
O
DTR1 — Data Terminal Ready output for UART1. Can also be
configured to be an RS-485/EIA-485 output enable signal.
O
TRACEDATA[0] — Trace data, bit 0.
I/O
P2[6] — General purpose digital input/output pin.
I
PCAP1[0] — Capture input for PWM1, channel 0.
I
RI1 — Ring Indicator input for UART1.
O
TRACECLK — Trace Clock.
I/O
P2[7] — General purpose digital input/output pin.
I
RD2 — CAN2 receiver input. (LPC1769/68/66/65/64 only).
O
RTS1 — Request to Send output for UART1. Can also be
configured to be an RS-485/EIA-485 output enable signal.
I/O
P2[8] — General purpose digital input/output pin.
O
TD2 — CAN2 transmitter output. (LPC1769/68/66/65/64 only).
O
TXD2 — Transmitter output for UART2.
I/O
P2[9] — General purpose digital input/output pin.
O
USB_CONNECT — Signal used to switch an external 1.5 k
resistor under software control. Used with the SoftConnect USB
feature. (LPC1769/68/66/65/64 only).
I
RXD2 — Receiver input for UART2.
I/O
P2[10] — General purpose digital input/output pin. A LOW level on
this pin during reset starts the ISP command handler.
I
EINT0 — External interrupt 0 input.
I
NMI — Non-maskable interrupt input.
I/O
P2[11] — General purpose digital input/output pin.
I
EINT1 — External interrupt 1 input.
I/O
I2STX_CLK — Transmit Clock. It is driven by the master and
received by the slave. Corresponds to the signal SCK in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I/O
P2[12] — General purpose digital input/output pin.
I
EINT2 — External interrupt 2 input.
I/O
I2STX_WS — Transmit Word Select. It is driven by the master and
received by the slave. Corresponds to the signal WS in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
I/O
P2[13] — General purpose digital input/output pin.
I
EINT3 — External interrupt 3 input.
I/O
I2STX_SDA — Transmit data. It is driven by the transmitter and
read by the receiver. Corresponds to the signal SD in the I2S-bus
specification. (LPC1769/68/67/66/65/63 only).
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
109 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Pin description (LPC176x) …continued
P3[0] to P3[31]
P3[25]/MAT0[0]/
PWM1[2]
P3[26]/STCLK/
MAT0[1]/PWM1[3]
27
26
H3
K1
D8
A10
[1]
[1]
P4[0] to P4[31]
P4[28]/RX_MCLK/
MAT2[0]/TXD3
P4[29]/TX_MCLK/
MAT2[1]/RXD3
TDO/SWO
82
85
1
C7
E6
A1
G1
F1
[1]
[1]
MAT0[0] — Match output for Timer 0, channel 0.
O
PWM1[2] — Pulse Width Modulator 1, output 2.
I/O
P3[26] — General purpose digital input/output pin.
I
STCLK — System tick timer clock input. The maximum STCLK
frequency is 1/4 of the ARM processor clock frequency CCLK.
O
MAT0[1] — Match output for Timer 0, channel 1.
O
PWM1[3] — Pulse Width Modulator 1, output 3.
I/O
Port 4: Port 4 is a 32-bit I/O port with individual direction controls for
each bit. The operation of port 4 pins depends upon the pin function
selected via the pin connect block. Pins 0 through 27, 30, and 31 of
this port are not available.
I/O
P4[28] — General purpose digital input/output pin.
O
RX_MCLK — I2S receive master clock. (LPC1769/68/67/66/65
only).
O
MAT2[0] — Match output for Timer 2, channel 0.
O
TXD3 — Transmitter output for UART3.
I/O
P4[29] — General purpose digital input/output pin.
O
TX_MCLK — I2S transmit master clock. (LPC1769/68/67/66/65
only).
O
MAT2[1] — Match output for Timer 2, channel 1.
I
RXD3 — Receiver input for UART3.
O
TDO — Test Data out for JTAG interface.
TDI — Test Data in for JTAG interface.
I
TMS — Test Mode Select for JTAG interface.
I/O
SWDIO — Serial wire debug data input/output.
I
TRST — Test Reset for JTAG interface.
C4
B1
B3
[1][8]
A2
[1][8]
D4
[1][7]
C1
P3[25] — General purpose digital input/output pin.
I
C3
3
5
I/O
O
SWO — Serial wire trace output.
2
TCK/SWDCLK
Port 3: Port 3 is a 32-bit I/O port with individual direction controls for
each bit. The operation of port 3 pins depends upon the pin function
selected via the pin connect block. Pins 0 through 24, and 27
through 31 of this port are not available.
O
TDI
C2
I/O
A1
TMS/SWDIO
4
Description
[1][7]
[1][8]
TRST
Type
WLCSP100
Pin/ball
LQFP100
Symbol
TFBGA100
Table 74.
I
TCK — Test Clock for JTAG interface.
I
SWDCLK — Serial wire clock.
O
RTCK — JTAG interface control signal.
RTCK
100 B2
B2
[1][7]
RSTOUT
14
-
-
-
O
RSTOUT — This is a 3.3 V pin. LOW on this pin indicates the
microcontroller being in Reset state.
RESET
17
F3
C6
[9]
I
External reset input: A LOW-going pulse as short as 50 ns on this
pin resets the device, causing I/O ports and peripherals to take on
their default states, and processor execution to begin at address 0.
TTL with hysteresis, 5 V tolerant.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
110 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
Table 74.
Pin description (LPC176x) …continued
Description
WLCSP100
Type
TFBGA100
Pin/ball
LQFP100
Symbol
XTAL1
22
H2
D7
[10][11]
I
Input to the oscillator circuit and internal clock generator circuits.
XTAL2
23
G3
A9
[10][11]
O
Output from the oscillator amplifier.
A7
[10][11]
I
Input to the RTC oscillator circuit.
B7
[10]
O
Output from the RTC oscillator circuit.
I
ground: 0 V reference.
RTCX1
RTCX2
16
18
F2
G1
VSS
31,
41,
55,
72,
83,
97
B3,
B7,
C9,
G7,
J6,
K3
E5,
F5,
F6,
G5,
G6,
G7
[10]
VSSA
11
E1
B5
[10]
I
analog ground: 0 V reference. This should nominally be the same
voltage as VSS, but should be isolated to minimize noise and error.
VDD(3V3)
28,
54,
71,
96
K2,
H9,
C10
, A3
E4,
E6,
F7,
G4
[10]
I
3.3 V supply voltage: This is the power supply voltage for the I/O
ports.
VDD(REG)(3V3)
42, H6,
84 A7
F4,
F0
[10]
I
3.3 V voltage regulator supply voltage: This is the supply voltage
for the on-chip voltage regulator only.
VDDA
10
E2
A4
[10]
I
analog 3.3 V pad supply voltage: This should be nominally the
same voltage as VDD(3V3) but should be isolated to minimize noise
and error. This voltage is used to power the ADC and DAC. This pin
should be tied to 3.3 V if the ADC and DAC are not used.
VREFP
12
E3
A5
[10]
I
ADC positive reference voltage: This should be nominally the
same voltage as VDDA but should be isolated to minimize noise and
error. Level on this pin is used as a reference for ADC and DAC.
This pin should be tied to 3.3 V if the ADC and DAC are not used.
VREFN
15
F1
A6
I
ADC negative reference voltage: This should be nominally the
same voltage as VSS but should be isolated to minimize noise and
error. Level on this pin is used as a reference for ADC and DAC.
VBAT
19
G2
A8
I
RTC pin power supply: 3.3 V on this pin supplies the power to the
RTC peripheral.
n.c.
13
D4,
E4
B6,
D6
-
not connected.
[10]
[1]
5 V tolerant pad providing digital I/O functions with TTL levels and hysteresis. This pin is pulled up to a voltage level of 2.3 V to 2.6 V.
[2]
5 V tolerant pad providing digital I/O functions (with TTL levels and hysteresis) and analog input. When configured as a ADC input,
digital section of the pad is disabled and the pin is not 5 V tolerant. This pin is pulled up to a voltage level of 2.3 V to 2.6 V.
[3]
5 V tolerant pad providing digital I/O with TTL levels and hysteresis and analog output function. When configured as the DAC output,
digital section of the pad is disabled. This pin is pulled up to a voltage level of 2.3 V to 2.6 V.
[4]
Open-drain 5 V tolerant digital I/O pad, compatible with I2C-bus 400 kHz specification. This pad requires an external pull-up to provide
output functionality. When power is switched off, this pin connected to the I2C-bus is floating and does not disturb the I2C lines.
Open-drain configuration applies to all functions on this pin.
[5]
Pad provides digital I/O and USB functions. It is designed in accordance with the USB specification, revision 2.0 (Full-speed and
Low-speed mode only). This pad is not 5 V tolerant.
[6]
5 V tolerant pad with 10 ns glitch filter providing digital I/O functions with TTL levels and hysteresis. This pin is pulled up to a voltage
level of 2.3 V to 2.6 V.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
111 of 849
UM10360
NXP Semiconductors
Chapter 7: LPC176x/5x Pin configuration
[7]
5 V tolerant pad with TTL levels and hysteresis. Internal pull-up and pull-down resistors disabled.
[8]
5 V tolerant pad with TTL levels and hysteresis and internal pull-up resistor.
[9]
5 V tolerant pad with 20 ns glitch filter providing digital I/O function with TTL levels and hysteresis.
[10] Pad provides special analog functionality. A 32 kHz crystal oscillator must be used with the RTC.
[11] When the system oscillator is not used, connect XTAL1 and XTAL2 as follows: XTAL1 can be left floating or can be grounded (grounding
is preferred to reduce susceptibility to noise). XTAL2 should be left floating.
[12] When the RTC is not used, connect VBAT to VDD(REG)(3V3) and leave RTCX1 floating.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
112 of 849
UM10360
Chapter 8: LPC176x/5x Pin connect block
Rev. 3.1 — 2 April 2014
User manual
8.1 How to read this chapter
Table 75 shows the functions of the PINSEL registers in the LPC176x/5x.
Table 75.
Summary of PINSEL registers
Register
Controls
Table
PINSEL0
P0[15:0]
Table 80
PINSEL1
P0 [31:16]
Table 81
PINSEL2
P1 [15:0] (Ethernet)
Table 82
PINSEL3
P1 [31:16]
Table 83
PINSEL4
P2 [15:0]
Table 84
PINSEL5
P2 [31:16]
not used
PINSEL6
P3 [15:0]
not used
PINSEL7
P3 [31:16]
Table 85
PINSEL8
P4 [15:0]
not used
PINSEL9
P4 [31:16]
Table 86
PINSEL10
Trace port enable
Table 87
8.2 Description
The pin connect block allows most pins of the microcontroller to have more than one
potential function. Configuration registers control the multiplexers to allow connection
between the pin and the on chip peripherals.
Peripherals should be connected to the appropriate pins prior to being activated and prior
to any related interrupt(s) being enabled. Activity of any enabled peripheral function that is
not mapped to a related pin should be considered undefined.
Selection of a single function on a port pin excludes other peripheral functions available
on the same pin. However, the GPIO input stays connected and may be read by software
or used to contribute to the GPIO interrupt feature.
8.3 Pin function select register values
The PINSEL registers control the functions of device pins as shown below. Pairs of bits in
these registers correspond to specific device pins.
Table 76.
UM10360
User manual
Pin function select register bits
PINSEL0 to
Function
PINSEL9 Values
Value after Reset
00
00
Primary (default) function, typically GPIO port
01
First alternate function
10
Second alternate function
11
Third alternate function
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
113 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
The direction control bit in the GPIO registers is effective only when the GPIO function is
selected for a pin. For other functions, direction is controlled automatically. Each
derivative typically has a different pinout and therefore a different set of functions possible
for each pin. Details for a specific derivative may be found in the appropriate data sheet.
Multiple connections
Since a particular peripheral function may be allowed on more than one pin, it is in
principle possible to configure more than one pin to perform the same function. If a
peripheral output function is configured to appear on more than one pin, it will in fact be
routed to those pins. If a peripheral input function is configured to appear on more than
one pin for some reason, the peripheral will receive its input from the lowest port number.
For instance, any pin of port 0 will take precedence over any pin of a higher numbered
port, and pin 0 of any port will take precedence over a higher numbered pin of the same
port.
8.4 Pin mode select register values
The PINMODE registers control the input mode of all ports. This includes the use of the
on-chip pull-up/pull-down resistor feature and a special open drain operating mode. The
on-chip pull-up/pull-down resistor can be selected for every port pin regardless of the
function on this pin with the exception of the I2C pins for the I2C0 interface and the USB
pins (see Section 8.5.10). Three bits are used to control the mode of a port pin, two in a
PINMODE register, and an additional one in a PINMODE_OD register. Bits are reserved
for unused pins as in the PINSEL registers.
Table 77.
Pin Mode Select register Bits
PINMODE0 to
Function
PINMODE9 Values
Value after
Reset
00
Pin has an on-chip pull-up resistor enabled.
00
01
Repeater mode (see text below).
10
Pin has neither pull-up nor pull-down resistor enabled.
11
Pin has an on-chip pull-down resistor enabled.
Repeater mode enables the pull-up resistor if the pin is at a logic high and enables the
pull-down resistor if the pin is at a logic low. This causes the pin to retain its last known
state if it is configured as an input and is not driven externally. The state retention is not
applicable to the Deep Power-down mode. Repeater mode may typically be used to
prevent a pin from floating (and potentially using significant power if it floats to an
indeterminate state) if it is temporarily not driven.
The PINMODE_OD registers control the open drain mode for ports. The open drain mode
causes the pin to be pulled low normally if it is configured as an output and the data value
is 0. If the data value is 1, the output drive of the pin is turned off, equivalent to changing
the pin direction. This combination simulates an open drain output.
Table 78.
UM10360
User manual
Open Drain Pin Mode Select register Bits
PINMODE_OD0 to Function
PINMODE_OD4
Values
Value after
Reset
0
Pin is in the normal (not open drain) mode.
00
1
Pin is in the open drain mode.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
114 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Function of PINMODE in open drain mode
Normally the value of PINMODE applies to a pin only when it is in the input mode. When a
pin is in the open drain mode, caused by a 1 in the corresponding bit of one of the
PINMODE_OD registers, the input mode still does not apply when the pin is outputting a
0. However, when the pin value is 1, PINMODE applies since this state turns off the pin’s
output driver. For example, this allows for the possibility of configuring a pin to be open
drain with an on-chip pullup. A pullup in this case which is only on when the pin is not
being pulled low by the pin’s own output.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
115 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
8.5 Register description
The Pin Control Module contains 11 registers as shown in Table 79 below.
Table 79.
Pin Connect Block Register Map
Name
Description
Access
Reset
Value[1]
Address
PINSEL0
Pin function select register 0.
R/W
0
0x4002 C000
PINSEL1
Pin function select register 1.
R/W
0
0x4002 C004
PINSEL2
Pin function select register 2.
R/W
0
0x4002 C008
PINSEL3
Pin function select register 3.
R/W
0
0x4002 C00C
PINSEL4
Pin function select register 4
R/W
0
0x4002 C010
PINSEL7
Pin function select register 7
R/W
0
0x4002 C01C
PINSEL8
Pin function select register 8
R/W
0
0x4002 C020
PINSEL9
Pin function select register 9
R/W
0
0x4002 C024
PINSEL10
Pin function select register 10
R/W
0
0x4002 C028
PINMODE0
Pin mode select register 0
R/W
0
0x4002 C040
PINMODE1
Pin mode select register 1
R/W
0
0x4002 C044
PINMODE2
Pin mode select register 2
R/W
0
0x4002 C048
PINMODE3
Pin mode select register 3.
R/W
0
0x4002 C04C
PINMODE4
Pin mode select register 4
R/W
0
0x4002 C050
PINMODE5
Pin mode select register 5
R/W
0
0x4002 C054
PINMODE6
Pin mode select register 6
R/W
0
0x4002 C058
PINMODE7
Pin mode select register 7
R/W
0
0x4002 C05C
PINMODE9
Pin mode select register 9
R/W
0
0x4002 C064
PINMODE_OD0
Open drain mode control register 0
R/W
0
0x4002 C068
PINMODE_OD1
Open drain mode control register 1
R/W
0
0x4002 C06C
PINMODE_OD2
Open drain mode control register 2
R/W
0
0x4002 C070
PINMODE_OD3
Open drain mode control register 3
R/W
0
0x4002 C074
PINMODE_OD4
Open drain mode control register 4
R/W
0
0x4002 C078
I2CPADCFG
I2C
R/W
0
0x4002 C07C
[1]
Pin Configuration register
Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
Pin control module register reset values
On external reset, watchdog reset, power-on-reset (POR), and BOD reset, all registers in
this module are reset to '0'.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
116 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
8.5.1 Pin Function Select register 0 (PINSEL0 - 0x4002 C000)
The PINSEL0 register controls the functions of the lower half of Port 0. The direction
control bit in FIO0DIR register is effective only when the GPIO function is selected for a
pin. For other functions, the direction is controlled automatically.
Table 80.
Pin function select register 0 (PINSEL0 - address 0x4002 C000) bit description
PINSEL0 Pin
name
Function when Function when 01
00
Function
when 10
Function
when 11
Reset
value
1:0
P0.0
GPIO Port 0.0
RD1
TXD3
SDA1
00
3:2
P0.1
GPIO Port 0.1
TD1
RXD3
SCL1
00
5:4
P0.2
GPIO Port 0.2
TXD0
AD0.7
Reserved
00
7:6
P0.3
GPIO Port 0.3
RXD0
AD0.6
Reserved
00
9:8
P0.4[1]
GPIO Port 0.4
I2SRX_CLK
RD2
CAP2.0
00
11:10
P0.5[1]
GPIO Port 0.5
I2SRX_WS
TD2
CAP2.1
00
13:12
P0.6
GPIO Port 0.6
I2SRX_SDA
SSEL1
MAT2.0
00
15:14
P0.7
GPIO Port 0.7
I2STX_CLK
SCK1
MAT2.1
00
17:16
P0.8
GPIO Port 0.8
I2STX_WS
MISO1
MAT2.2
00
19:18
P0.9
GPIO Port 0.9
I2STX_SDA
MOSI1
MAT2.3
00
21:20
P0.10
GPIO Port 0.10
TXD2
SDA2
MAT3.0
00
23:22
P0.11
GPIO Port 0.11
RXD2
SCL2
MAT3.1
00
29:24
-
Reserved
Reserved
Reserved
Reserved
0
31:30
P0.15
GPIO Port 0.15
TXD1
SCK0
SCK
00
[1]
Not available on 80-pin package.
8.5.2 Pin Function Select Register 1 (PINSEL1 - 0x4002 C004)
The PINSEL1 register controls the functions of the upper half of Port 0. The direction
control bit in the FIO0DIR register is effective only when the GPIO function is selected for
a pin. For other functions the direction is controlled automatically.
Table 81.
UM10360
User manual
Pin function select register 1 (PINSEL1 - address 0x4002 C004) bit
description
PINSEL1 Pin name Function when Function
00
when 01
Function
when 10
Function
when 11
Reset
value
1:0
P0.16
GPIO Port 0.16
RXD1
SSEL0
SSEL
00
3:2
P0.17
GPIO Port 0.17
CTS1
MISO0
MISO
00
5:4
P0.18
GPIO Port 0.18
DCD1
MOSI0
MOSI
00
7:6
P0.19[1]
GPIO Port 0.19
DSR1
Reserved
SDA1
00
9:8
P0.20[1]
GPIO Port 0.20
DTR1
Reserved
SCL1
00
11:10
P0.21[1]
GPIO Port 0.21
RI1
Reserved
RD1
00
13:12
P0.22
GPIO Port 0.22
RTS1
Reserved
TD1
00
15:14
P0.23[1]
GPIO Port 0.23
AD0.0
I2SRX_CLK
CAP3.0
00
17:16
P0.24[1]
GPIO Port 0.24
AD0.1
I2SRX_WS
CAP3.1
00
19:18
P0.25
GPIO Port 0.25
AD0.2
I2SRX_SDA
TXD3
00
21:20
P0.26
GPIO Port 0.26
AD0.3
AOUT
RXD3
00
23:22
P0.27[1][2]
GPIO Port 0.27
SDA0
USB_SDA
Reserved
00
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
117 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 81.
Pin function select register 1 (PINSEL1 - address 0x4002 C004) bit
description …continued
PINSEL1 Pin name Function when Function
00
when 01
Function
when 10
Function
when 11
Reset
value
25:24
P0.28[1][2] GPIO Port 0.28
SCL0
USB_SCL
Reserved
00
27:26
P0.29
GPIO Port 0.29
USB_D
Reserved
Reserved
00
29:28
P0.30
GPIO Port 0.30
USB_D
Reserved
Reserved
00
31:30
-
Reserved
Reserved
Reserved
Reserved
00
[1]
Not available on 80-pin package.
[2]
Pins P0[27] and P0[28] are open-drain for I2C-bus compliance.
8.5.3 Pin Function Select register 2 (PINSEL2 - 0x4002 C008)
The PINSEL2 register controls the functions of the lower half of Port 1, which contains the
Ethernet related pins. The direction control bit in the FIO1DIR register is effective only
when the GPIO function is selected for a pin. For other functions, the direction is
controlled automatically.
Table 82.
Pin function select register 2 (PINSEL2 - address 0x4002 C008) bit description
PINSEL2 Pin
name
Function when Function when
00
01
Function
when 10
Function
when 11
Reset
value
1:0
P1.0
GPIO Port 1.0
ENET_TXD0
Reserved
Reserved
00
3:2
P1.1
GPIO Port 1.1
ENET_TXD1
Reserved
Reserved
00
7:4
-
Reserved
Reserved
Reserved
Reserved
0
9:8
P1.4
GPIO Port 1.4
ENET_TX_EN
Reserved
Reserved
00
15:10
-
Reserved
Reserved
Reserved
Reserved
0
17:16
P1.8
GPIO Port 1.8
ENET_CRS
Reserved
Reserved
00
19:18
P1.9
GPIO Port 1.9
ENET_RXD0
Reserved
Reserved
00
21:20
P1.10
GPIO Port 1.10
ENET_RXD1
Reserved
Reserved
00
27:22
-
Reserved
Reserved
Reserved
Reserved
0
29:28
P1.14
GPIO Port 1.14
ENET_RX_ER
Reserved
Reserved
00
31:30
P1.15
GPIO Port 1.15
ENET_REF_CLK Reserved
Reserved
00
8.5.4 Pin Function Select Register 3 (PINSEL3 - 0x4002 C00C)
The PINSEL3 register controls the functions of the upper half of Port 1. The direction
control bit in the FIO1DIR register is effective only when the GPIO function is selected for
a pin. For other functions, direction is controlled automatically.
Table 83.
Pin function select register 3 (PINSEL3 - address 0x4002 C00C) bit
description
PINSEL3 Pin
name
UM10360
User manual
Function when Function when
00
01
Function
when 10
Function
when 11
Reset
value
1:0
P1.16[1]
GPIO Port 1.16 ENET_MDC
Reserved
Reserved
00
3:2
P1.17[1]
GPIO Port 1.17 ENET_MDIO
Reserved
Reserved
00
5:4
P1.18
GPIO Port 1.18 USB_UP_LED
PWM1.1
CAP1.0
00
7:6
P1.19
GPIO Port 1.19 MCOA0
USB_PPWR
CAP1.1
00
9:8
P1.20
GPIO Port 1.20 MCI0
PWM1.2
SCK0
00
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
118 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 83.
Pin function select register 3 (PINSEL3 - address 0x4002 C00C) bit
description …continued
PINSEL3 Pin
name
Function when Function when
00
01
Function
when 10
Function
when 11
Reset
value
11:10
P1.21[1]
GPIO Port 1.21 MCABORT
PWM1.3
SSEL0
00
13:12
P1.22
GPIO Port 1.22 MCOB0
USB_PWRD
MAT1.0
00
15:14
P1.23
GPIO Port 1.23 MCI1
PWM1.4
MISO0
00
17:16
P1.24
GPIO Port 1.24 MCI2
PWM1.5
MOSI0
00
19:18
P1.25
GPIO Port 1.25 MCOA1
Reserved
MAT1.1
00
21:20
P1.26
GPIO Port 1.26 MCOB1
PWM1.6
CAP0.0
00
23:22
P1.27[1]
GPIO Port 1.27 CLKOUT
USB_OVRCR CAP0.1
00
25:24
P1.28
GPIO Port 1.28 MCOA2
PCAP1.0
MAT0.0
00
27:26
P1.29
GPIO Port 1.29 MCOB2
PCAP1.1
MAT0.1
00
29:28
P1.30
GPIO Port 1.30 Reserved
VBUS
AD0.4
00
31:30
P1.31
GPIO Port 1.31 Reserved
SCK1
AD0.5
00
[1]
Not available on 80-pin package.
8.5.5 Pin Function Select Register 4 (PINSEL4 - 0x4002 C010)
The PINSEL4 register controls the functions of the lower half of Port 2. The direction
control bit in the FIO2DIR register is effective only when the GPIO function is selected for
a pin. For other functions, direction is controlled automatically.
Table 84.
PINSEL4 Pin
name
Function when Function when 01 Function
00
when 10
Function when Reset
11
value
1:0
P2.0
GPIO Port 2.0
PWM1.1
TXD1
Reserved
3:2
P2.1
GPIO Port 2.1
PWM1.2
RXD1
Reserved
User manual
00
00
[2]
00
5:4
P2.2
GPIO Port 2.2
PWM1.3
CTS1
Reserved
7:6
P2.3
GPIO Port 2.3
PWM1.4
DCD1
Reserved [2]
00
9:8
P2.4
GPIO Port 2.4
PWM1.5
DSR1
Reserved [2]
00
DTR1
Reserved
[2]
00
[2]
11:10
UM10360
Pin function select register 4 (PINSEL4 - address 0x4002 C010) bit description
P2.5
GPIO Port 2.5
PWM1.6
13:12
P2.6
GPIO Port 2.6
PCAP1.0
RI1
Reserved
15:14
P2.7
GPIO Port 2.7
RD2
RTS1
Reserved
00
17:16
P2.8
GPIO Port 2.8
TD2
TXD2
ENET_MDC
00
19:18
P2.9
GPIO Port 2.9
USB_CONNECT
RXD2
ENET_MDIO
00
00
21:20
P2.10
GPIO Port 2.10
EINT0
NMI
Reserved
00
23:22
P2.11[1]
GPIO Port 2.11
EINT1
Reserved
I2STX_CLK
00
25:24
P2.12[1]
GPIO Port 2.12
EINT2
Reserved
I2STX_WS
00
27:26
P2.13[1]
GPIO Port 2.13
EINT3
Reserved
I2STX_SDA
00
31:28
-
Reserved
Reserved
Reserved
Reserved
0
[1]
Not available on 80-pin package.
[2]
These pins support a debug trace function when selected via a development tool or by writing to the
PINSEL10 register. See Section 8.5.8 “Pin Function Select Register 10 (PINSEL10 - 0x4002 C028)” for
details.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
119 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
8.5.6 Pin Function Select Register 7 (PINSEL7 - 0x4002 C01C)
The PINSEL7 register controls the functions of the upper half of Port 3. The direction
control bit in the FIO3DIR register is effective only when the GPIO function is selected for
a pin. For other functions, direction is controlled automatically.
Table 85.
Pin function select register 7 (PINSEL7 - address 0x4002 C01C) bit description
PINSEL7 Pin
name
Function when Function
00
when 01
Function
when 10
Function
when 11
Reset
value
17:0
-
Reserved
Reserved
Reserved
Reserved
0
19:18
P3.25[1]
GPIO Port 3.25
Reserved
MAT0.0
PWM1.2
00
21:20
P3.26[1]
GPIO Port 3.26
STCLK
MAT0.1
PWM1.3
00
31:22
-
Reserved
Reserved
Reserved
Reserved
0
[1]
Not available on 80-pin package.
8.5.7 Pin Function Select Register 9 (PINSEL9 - 0x4002 C024)
The PINSEL9 register controls the functions of the upper half of Port 4. The direction
control bit in the FIO4DIR register is effective only when the GPIO function is selected for
a pin. For other functions, direction is controlled automatically.
Table 86.
Pin function select register 9 (PINSEL9 - address 0x4002 C024) bit description
PINSEL9 Pin
name
Function when Function
00
when 01
Function
when 10
Function
when 11
Reset
value
23:0
-
Reserved
Reserved
Reserved
Reserved
00
25:24
P4.28
GPIO Port 4.28
RX_MCLK
MAT2.0
TXD3
00
27:26
P4.29
GPIO Port 4.29
TX_MCLK
MAT2.1
RXD3
00
31:28
-
Reserved
Reserved
Reserved
Reserved
00
8.5.8 Pin Function Select Register 10 (PINSEL10 - 0x4002 C028)
Only bit 3 of this register is used to control the Trace function on pins P2.2 through P2.6.
Table 87.
Bit
Symbol
Value Description
2:0
-
-
3
GPIO/TRACE
31:4
UM10360
User manual
Pin function select register 10 (PINSEL10 - address 0x4002 C028) bit description
-
Reset
value
Reserved. Software should not write 1 to these bits. NA
TPIU interface pins control.
0
0
TPIU interface is disabled.
1
TPIU interface is enabled. TPIU signals are
available on the pins hosting them regardless of the
PINSEL4 content.
-
Reserved. Software should not write 1 to these bits. NA
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
120 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
8.5.9 Pin Mode select register 0 (PINMODE0 - 0x4002 C040)
This register controls pull-up/pull-down resistor configuration for Port 0 pins 0 to 15.
Table 88.
Pin Mode select register 0 (PINMODE0 - address 0x4002 C040) bit description
PINMODE0 Symbol
1:0
Value
P0.00MODE
Description
Reset
value
Port 0 pin 0 on-chip pull-up/down resistor control.
00
00
P0.0 pin has a pull-up resistor enabled.
01
P0.0 pin has repeater mode enabled.
10
P0.0 pin has neither pull-up nor pull-down.
11
P0.0 has a pull-down resistor enabled.
3:2
P0.01MODE
Port 0 pin 1 control, see P0.00MODE.
00
5:4
P0.02MODE
Port 0 pin 2 control, see P0.00MODE.
00
7:6
P0.03MODE
Port 0 pin 3 control, see P0.00MODE.
00
9:8
P0.04MODE[1]
Port 0 pin 4 control, see P0.00MODE.
00
11:10
P0.05MODE[1]
Port 0 pin 5 control, see P0.00MODE.
00
13:12
P0.06MODE
Port 0 pin 6 control, see P0.00MODE.
00
15:14
P0.07MODE
Port 0 pin 7 control, see P0.00MODE.
00
17:16
P0.08MODE
Port 0 pin 8 control, see P0.00MODE.
00
19:18
P0.09MODE
Port 0 pin 9control, see P0.00MODE.
00
21:20
P0.10MODE
Port 0 pin 10 control, see P0.00MODE.
00
23:22
P0.11MODE
Port 0 pin 11 control, see P0.00MODE.
00
29:24
-
Reserved.
NA
31:30
P0.15MODE
Port 0 pin 15 control, see P0.00MODE.
00
[1]
Not available on 80-pin package.
8.5.10 Pin Mode select register 1 (PINMODE1 - 0x4002 C044)
This register controls pull-up/pull-down resistor configuration for Port 1 pins 16 to 26. For
details see Section 8.4 “Pin mode select register values”.
Table 89.
UM10360
User manual
Pin Mode select register 1 (PINMODE1 - address 0x4002 C044) bit description
PINMODE1 Symbol
Description
Reset
value
1:0
P0.16MODE
Port 1 pin 16 control, see P0.00MODE.
00
3:2
P0.17MODE
Port 1 pin 17 control, see P0.00MODE.
00
5:4
P0.18MODE
Port 1 pin 18 control, see P0.00MODE.
00
7:6
P0.19MODE[1]
Port 1 pin 19 control, see P0.00MODE.
00
9:8
P0.20MODE[1]
Port 1 pin 20control, see P0.00MODE.
00
11:10
P0.21MODE[1]
Port 1 pin 21 control, see P0.00MODE.
00
13:12
P0.22MODE
Port 1 pin 22 control, see P0.00MODE.
00
15:14
P0.23MODE[1]
Port 1 pin 23 control, see P0.00MODE.
00
17:16
P0.24MODE[1]
Port 1 pin 24 control, see P0.00MODE.
00
19:18
P0.25MODE
Port 1 pin 25 control, see P0.00MODE.
00
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
121 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 89.
Pin Mode select register 1 (PINMODE1 - address 0x4002 C044) bit description
PINMODE1 Symbol
Description
Reset
value
21:20
Port 1 pin 26 control, see P0.00MODE.
00
P0.26MODE
29:22
-
Reserved.
31:30
-
Reserved.
[2]
NA
NA
[1]
Not available on 80-pin package.
[2]
The pin mode cannot be selected for pins P0[27] to P0[30]. Pins P0[27] and P0[28] are dedicated I2C
open-drain pins without pull-up/down. Pins P0[29] and P0[30] are USB specific pins without configurable
pull-up or pull-down resistors. Pins P0[29] and P0[30] also must have the same direction since they operate
as a unit for the USB function, see Section 9.5.1 “GPIO port Direction register FIOxDIR (FIO0DIR to
FIO4DIR- 0x2009 C000 to 0x2009 C080)”.
8.5.11 Pin Mode select register 2 (PINMODE2 - 0x4002 C048)
This register controls pull-up/pull-down resistor configuration for Port 1 pins 0 to 15. For
details see Section 8.4 “Pin mode select register values”.
Table 90.
Pin Mode select register 2 (PINMODE2 - address 0x4002 C048) bit description
PINMODE2 Symbol
Description
Reset
value
1:0
P1.00MODE
Port 1 pin 0 control, see P0.00MODE.
00
3:2
P1.01MODE
Port 1 pin 1 control, see P0.00MODE.
00
7:4
-
Reserved.
NA
9:8
P1.04MODE
Port 1 pin 4 control, see P0.00MODE.
00
15:10
-
Reserved.
NA
17:16
P1.08MODE
Port 1 pin 8 control, see P0.00MODE.
00
19:18
P1.09MODE
Port 1 pin 9 control, see P0.00MODE.
00
21:20
P1.10MODE
Port 1 pin 10 control, see P0.00MODE.
00
27:22
-
Reserved.
NA
29:28
P1.14MODE
Port 1 pin 14 control, see P0.00MODE.
00
31:30
P1.15MODE
Port 1 pin 15 control, see P0.00MODE.
00
8.5.12 Pin Mode select register 3 (PINMODE3 - 0x4002 C04C)
This register controls pull-up/pull-down resistor configuration for Port 1 pins 16 to 31. For
details see Section 8.4 “Pin mode select register values”.
Table 91.
Pin Mode select register 3 (PINMODE3 - address 0x4002 C04C) bit description
PINMODE3 Symbol
UM10360
User manual
Description
Reset
value
00
1:0
P1.16MODE[1]
Port 1 pin 16 control, see P0.00MODE.
3:2
P1.17MODE[1]
Port 1 pin 17 control, see P0.00MODE.
00
5:4
P1.18MODE
Port 1 pin 18 control, see P0.00MODE.
00
7:6
P1.19MODE
Port 1 pin 19 control, see P0.00MODE.
00
9:8
P1.20MODE
Port 1 pin 20 control, see P0.00MODE.
00
11:10
P1.21MODE[1]
Port 1 pin 21 control, see P0.00MODE.
00
13:12
P1.22MODE
Port 1 pin 22 control, see P0.00MODE.
00
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
122 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 91.
Pin Mode select register 3 (PINMODE3 - address 0x4002 C04C) bit description
PINMODE3 Symbol
Description
Reset
value
15:14
P1.23MODE
Port 1 pin 23 control, see P0.00MODE.
00
17:16
P1.24MODE
Port 1 pin 24 control, see P0.00MODE.
00
19:18
P1.25MODE
Port 1 pin 25 control, see P0.00MODE.
00
21:20
P1.26MODE
Port 1 pin 26 control, see P0.00MODE.
00
23:22
P1.27MODE[1]
Port 1 pin 27 control, see P0.00MODE.
00
25:24
P1.28MODE
Port 1 pin 28 control, see P0.00MODE.
00
27:26
P1.29MODE
Port 1 pin 29 control, see P0.00MODE.
00
29:28
P1.30MODE
Port 1 pin 30 control, see P0.00MODE.
00
31:30
P1.31MODE
Port 1 pin 31 control, see P0.00MODE.
00
[1]
Not available on 80-pin package.
8.5.13 Pin Mode select register 4 (PINMODE4 - 0x4002 C050)
This register controls pull-up/pull-down resistor configuration for Port 2 pins 0 to 15. For
details see Section 8.4 “Pin mode select register values”.
Table 92.
Symbol
Description
Reset
value
1:0
P2.00MODE
Port 2 pin 0 control, see P0.00MODE.
00
3:2
P2.01MODE
Port 2 pin 1 control, see P0.00MODE.
00
5:4
P2.02MODE
Port 2 pin 2 control, see P0.00MODE.
00
7:6
P2.03MODE
Port 2 pin 3 control, see P0.00MODE.
00
9:8
P2.04MODE
Port 2 pin 4 control, see P0.00MODE.
00
11:10
P2.05MODE
Port 2 pin 5 control, see P0.00MODE.
00
13:12
P2.06MODE
Port 2 pin 6 control, see P0.00MODE.
00
15:14
P2.07MODE
Port 2 pin 7 control, see P0.00MODE.
00
17:16
P2.08MODE
Port 2 pin 8 control, see P0.00MODE.
00
19:18
P2.09MODE
Port 2 pin 9 control, see P0.00MODE.
00
21:20
P2.10MODE
Port 2 pin 10 control, see P0.00MODE.
00
23:22
P2.11MODE[1]
Port 2 pin 11 control, see P0.00MODE.
00
25:24
P2.12MODE[1]
Port 2 pin 12 control, see P0.00MODE.
00
27:26
P2.13MODE[1]
Port 2 pin 13 control, see P0.00MODE.
00
31:28
-
Reserved.
NA
[1]
UM10360
User manual
Pin Mode select register 4 (PINMODE4 - address 0x4002 C050) bit description
PINMODE4
Not available on 80-pin package.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
123 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
8.5.14 Pin Mode select register 7 (PINMODE7 - 0x4002 C05C)
This register controls pull-up/pull-down resistor configuration for Port 3 pins 16 to 31. For
details see Section 8.4 “Pin mode select register values”.
Table 93.
Pin Mode select register 7 (PINMODE7 - address 0x4002 C05C) bit description
PINMODE7 Symbol
Description
Reset
value
17:0
-
Reserved
NA
19:18
P3.25MODE[1]
Port 3 pin 25 control, see P0.00MODE.
00
21:20
P3.26MODE[1]
Port 3 pin 26 control, see P0.00MODE.
00
31:22
-
Reserved.
NA
[1]
Not available on 80-pin package.
8.5.15 Pin Mode select register 9 (PINMODE9 - 0x4002 C064)
This register controls pull-up/pull-down resistor configuration for Port 4 pins 16 to 31. For
details see Section 8.4 “Pin mode select register values”.
Table 94.
Pin Mode select register 9 (PINMODE9 - address 0x4002 C064) bit description
PINMODE9 Symbol
Description
Reset
value
23:0
-
Reserved.
NA
25:24
P4.28MODE
Port 4 pin 28 control, see P0.00MODE.
00
27:26
P4.29MODE
Port 4 pin 29 control, see P0.00MODE.
00
31:28
-
Reserved.
NA
8.5.16 Open Drain Pin Mode select register 0 (PINMODE_OD0 - 0x4002 C068)
This register controls the open drain mode for Port 0 pins. For details see Section 8.4 “Pin
mode select register values”.
Table 95.
Open Drain Pin Mode select register 0 (PINMODE_OD0 - address 0x4002 C068) bit
description
PINMODE Symbol
_OD0
0
UM10360
User manual
Value Description
P0.00OD[3]
Reset
value
Port 0 pin 0 open drain mode control.
0
0
P0.0 pin is in the normal (not open drain) mode.
1
P0.0 pin is in the open drain mode.
1
P0.01OD[3]
Port 0 pin 1 open drain mode control, see P0.00OD
0
2
P0.02OD
Port 0 pin 2 open drain mode control, see P0.00OD
0
3
P0.03OD
Port 0 pin 3 open drain mode control, see P0.00OD
0
4
P0.04OD
Port 0 pin 4 open drain mode control, see P0.00OD
0
5
P0.05OD
Port 0 pin 5 open drain mode control, see P0.00OD
0
6
P0.06OD
Port 0 pin 6 open drain mode control, see P0.00OD
0
7
P0.07OD
Port 0 pin 7 open drain mode control, see P0.00OD
0
8
P0.08OD
Port 0 pin 8 open drain mode control, see P0.00OD
0
9
P0.09OD
Port 0 pin 9 open drain mode control, see P0.00OD
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
124 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 95.
Open Drain Pin Mode select register 0 (PINMODE_OD0 - address 0x4002 C068) bit
description …continued
PINMODE Symbol
_OD0
Value Description
Reset
value
10
P0.10OD[3]
Port 0 pin 10 open drain mode control, see P0.00OD
0
11
P0.11OD[3]
Port 0 pin 11 open drain mode control, see P0.00OD
0
14:12
-
Reserved.
NA
15
P0.15OD
Port 0 pin 15 open drain mode control, see P0.00OD
0
16
P0.16OD
Port 0 pin 16 open drain mode control, see P0.00OD
0
17
P0.17OD
Port 0 pin 17 open drain mode control, see P0.00OD
0
18
P0.18OD
Port 0 pin 18 open drain mode control, see P0.00OD
0
19
P0.19OD[3]
Port 0 pin 19 open drain mode control, see P0.00OD
0
20
P0.20OD[3]
Port 0 pin 20open drain mode control, see P0.00OD
0
21
P0.21OD
Port 0 pin 21 open drain mode control, see P0.00OD
0
22
P0.22OD
Port 0 pin 22 open drain mode control, see P0.00OD
0
23
P0.23OD
Port 0 pin 23 open drain mode control, see P0.00OD
0
24
P0.24OD
Port 0 pin 24open drain mode control, see P0.00OD
0
25
P0.25OD
Port 0 pin 25 open drain mode control, see P0.00OD
0
26
P0.26OD
Port 0 pin 26 open drain mode control, see P0.00OD
0
Reserved.
NA
[2]
28:27
-
29
P0.29OD
Port 0 pin 29 open drain mode control, see P0.00OD
0
30
P0.30OD
Port 0 pin 30 open drain mode control, see P0.00OD
0
31
-
Reserved.
NA
[1]
Not available on 80-pin package.
[2]
Port 0 pins 27 and 28 should be set up using the I2CPADCFG register if they are used for an I2C-bus. Bits
27 and 28 of PINMODE_OD0 do not have any affect on these pins, they are special open drain I2C-bus
compatible pins.
[3]
Port 0 bits 1:0, 11:10, and 20:19 may potentially be used for I2C-buses using standard port pins. If so, they
should be configured for open drain mode via the related bits in PINMODE_OD0.
8.5.17 Open Drain Pin Mode select register 1 (PINMODE_OD1 0x4002 C06C)
This register controls the open drain mode for Port 1 pins. For details see Section 8.4 “Pin
mode select register values”.
Table 96.
Open Drain Pin Mode select register 1 (PINMODE_OD1 - address 0x4002 C06C) bit
description
PINMODE Symbol
_OD1
0
UM10360
User manual
Value Description
P1.00OD
Reset
value
Port 1 pin 0 open drain mode control.
0
0
P1.0 pin is in the normal (not open drain) mode.
1
P1.0 pin is in the open drain mode.
1
P1.01OD
Port 1 pin 1 open drain mode control, see P1.00OD
0
3:2
-
Reserved.
NA
4
P1.04OD
Port 1 pin 4 open drain mode control, see P1.00OD
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
125 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 96.
Open Drain Pin Mode select register 1 (PINMODE_OD1 - address 0x4002 C06C) bit
description …continued
PINMODE Symbol
_OD1
Value Description
Reset
value
7:5
-
Reserved.
NA
8
P1.08OD
Port 1 pin 8 open drain mode control, see P1.00OD
0
9
P1.09OD
Port 1 pin 9 open drain mode control, see P1.00OD
0
10
P1.10OD
Port 1 pin 10 open drain mode control, see P1.00OD
0
13:11
-
Reserved.
NA
14
P1.14OD
Port 1 pin 14 open drain mode control, see P1.00OD
0
15
P1.15OD
Port 1 pin 15 open drain mode control, see P1.00OD
0
16
P1.16OD[1]
Port 1 pin 16 open drain mode control, see P1.00OD
0
17
P1.17OD[1]
Port 1 pin 17 open drain mode control, see P1.00OD
0
18
P1.18OD
Port 1 pin 18 open drain mode control, see P1.00OD
0
19
P1.19OD
Port 1 pin 19 open drain mode control, see P1.00OD
0
20
P1.20OD
Port 1 pin 20open drain mode control, see P1.00OD
0
21
P1.21OD[1]
Port 1 pin 21 open drain mode control, see P1.00OD
0
22
P1.22OD
Port 1 pin 22 open drain mode control, see P1.00OD
0
23
P1.23OD
Port 1 pin 23 open drain mode control, see P1.00OD
0
24
P1.24OD
Port 1 pin 24open drain mode control, see P1.00OD
0
25
P1.25OD
Port 1 pin 25 open drain mode control, see P1.00OD
0
26
P1.26OD
Port 1 pin 26 open drain mode control, see P1.00OD
0
27
P1.27OD[1]
Port 1 pin 27 open drain mode control, see P1.00OD
0
28
P1.28OD
Port 1 pin 28 open drain mode control, see P1.00OD
0
29
P1.29OD
Port 1 pin 29 open drain mode control, see P1.00OD
0
30
P1.30OD
Port 1 pin 30 open drain mode control, see P1.00OD
0
31
P1.31OD
Port 1 pin 31 open drain mode control.
0
[1]
Not available on 80-pin package.
8.5.18 Open Drain Pin Mode select register 2 (PINMODE_OD2 - 0x4002 C070)
This register controls the open drain mode for Port 2 pins. For details see Section 8.4 “Pin
mode select register values”.
Table 97.
Open Drain Pin Mode select register 2 (PINMODE_OD2 - address 0x4002 C070) bit
description
PINMODE Symbol
_OD2
0
UM10360
User manual
Value Description
P2.00OD
Reset
value
Port 2 pin 0 open drain mode control.
0
0
P2.0 pin is in the normal (not open drain) mode.
1
P2.0 pin is in the open drain mode.
1
P2.01OD
Port 2 pin 1 open drain mode control, see P2.00OD
0
2
P2.02OD
Port 2 pin 2 open drain mode control, see P2.00OD
0
3
P2.03OD
Port 2 pin 3 open drain mode control, see P2.00OD
0
4
P2.04OD
Port 2 pin 4 open drain mode control, see P2.00OD
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
126 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 97.
Open Drain Pin Mode select register 2 (PINMODE_OD2 - address 0x4002 C070) bit
description …continued
PINMODE Symbol
_OD2
Value Description
Reset
value
5
P2.05OD
Port 2 pin 5 open drain mode control, see P2.00OD
0
6
P2.06OD
Port 2 pin 6 open drain mode control, see P2.00OD
0
7
P2.07OD
Port 2 pin 7 open drain mode control, see P2.00OD
0
8
P2.08OD
Port 2 pin 8 open drain mode control, see P2.00OD
0
9
P2.09OD
Port 2 pin 9 open drain mode control, see P2.00OD
0
10
P2.10OD
Port 2 pin 10 open drain mode control, see P2.00OD
0
11
P2.11OD[1]
Port 2 pin 11 open drain mode control, see P2.00OD
0
12
P2.12OD[1]
Port 2 pin 12 open drain mode control, see P2.00OD
0
13
P2.13OD[1]
Port 2 pin 13 open drain mode control, see P2.00OD
0
31:14
-
Reserved.
NA
[1]
Not available on 80-pin package.
8.5.19 Open Drain Pin Mode select register 3 (PINMODE_OD3 - 0x4002 C074)
This register controls the open drain mode for Port 3 pins. For details see Section 8.4 “Pin
mode select register values”.
Table 98.
Open Drain Pin Mode select register 3 (PINMODE_OD3 - address 0x4002 C074) bit
description
PINMODE Symbol
_OD3
Value Description
Reset
value
24:0
-
Reserved.
NA
25
P3.25OD[1]
Port 3 pin 25 open drain mode control.
0
0
P3.25 pin is in the normal (not open drain) mode.
1
P3.25 pin is in the open drain mode.
26
P3.26OD[1]
Port 3 pin 26 open drain mode control, see P3.25OD
0
31:27
-
Reserved.
NA
[1]
Not available on 80-pin package.
8.5.20 Open Drain Pin Mode select register 4 (PINMODE_OD4 - 0x4002 C078)
This register controls the open drain mode for Port 4 pins. For details see Section 8.4 “Pin
mode select register values”.
Table 99.
Open Drain Pin Mode select register 4 (PINMODE_OD4 - address 0x4002 C078) bit
description
PINMODE Symbol
_OD4
27:0
UM10360
User manual
-
Value Description
Reserved.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Reset
value
NA
© NXP B.V. 2014. All rights reserved.
127 of 849
UM10360
NXP Semiconductors
Chapter 8: LPC176x/5x Pin connect block
Table 99.
Open Drain Pin Mode select register 4 (PINMODE_OD4 - address 0x4002 C078) bit
description …continued
PINMODE Symbol
_OD4
28
Value Description
P4.28OD
Reset
value
Port 4 pin 28 open drain mode control.
0
0
P4.28 pin is in the normal (not open drain) mode.
1
P4.28 pin is in the open drain mode.
29
P4.28OD
Port 4 pin 29 open drain mode control, see P4.28OD
0
31:30
-
Reserved.
NA
8.5.21 I2C Pin Configuration register (I2CPADCFG - 0x4002 C07C)
The I2CPADCFG register allows configuration of the I2C pins for the I2C0 interface only, in
order to support various I2C-bus operating modes. For use in standard or Fast Mode I2C,
the 4 bits in I2CPADCFG should be 0, the default value for this register. For Fast Mode
Plus, the SDADRV0 and SCLDRV0 bits should be 1. For non-I2C use of these pins, it may
be desirable to turn off I2C filtering and slew rate control by setting SDAI2C0 and SCLI2C0
to 1. See Table 100 below.
Table 100. I2C Pin Configuration register (I2CPADCFG - address 0x4002 C07C) bit
description
I2CPADCFG Symbol
0
1
2
3
31:4
UM10360
User manual
Value Description
SDADRV0
Drive mode control for the SDA0 pin, P0.27.
0
The SDA0 pin is in the standard drive mode.
1
The SDA0 pin is in Fast Mode Plus drive mode.
I2C mode control for the SDA0 pin, P0.27.
SDAI2C0
The SDA0 pin has I2C glitch filtering and slew rate
control enabled.
1
The SDA0 pin has I2C glitch filtering and slew rate
control disabled.
Drive mode control for the SCL0 pin, P0.28.
0
The SCL0 pin is in the standard drive mode.
1
The SCL0 pin is in Fast Mode Plus drive mode.
I2C mode control for the SCL0 pin, P0.28.
SCLI2C0
The SCL0 pin has I2C glitch filtering and slew rate
control enabled.
1
The SCL0 pin has I2C glitch filtering and slew rate
control disabled.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
0
0
0
Reserved.
0
0
0
SCLDRV0
-
Reset
value
NA
© NXP B.V. 2014. All rights reserved.
128 of 849
UM10360
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Rev. 3.1 — 2 April 2014
User manual
9.1 Basic configuration
GPIOs are configured using the following registers:
1. Power: always enabled.
2. Pins: See Section 8.3 for GPIO pins and their modes.
3. Wake-up: GPIO ports 0 and 2 can be used for wake-up if needed, see (Section 4.8.8).
4. Interrupts: Enable GPIO interrupts in IO0/2IntEnR (Table 115) or IO0/2IntEnF
(Table 117). Interrupts are enabled in the NVIC using the appropriate Interrupt Set
Enable register.
9.2 Features
9.2.1 Digital I/O ports
• Accelerated GPIO functions:
– GPIO registers are located on a peripheral AHB bus for fast I/O timing.
– Mask registers allow treating sets of port bits as a group, leaving other bits
unchanged.
– All GPIO registers are byte, half-word, and word addressable.
– Entire port value can be written in one instruction.
– GPIO registers are accessible by the GPDMA.
• Bit-level set and clear registers allow a single instruction set or clear of any number of
bits in one port.
• All GPIO registers support Cortex-M3 bit-banding.
• GPIO registers are accessible by the GPDMA controller to allow DMA of data to or
from GPIOs, synchronized to any DMA request.
• Direction control of individual port bits.
• All I/Os default to input with pullup after reset.
9.2.2 Interrupt generating digital ports
• Port 0 and Port 2 can provide a single interrupt for any combination of port pins.
• Each port pin can be programmed to generate an interrupt on a rising edge, a falling
edge, or both.
• Edge detection is asynchronous, so it may operate when clocks are not present, such
as during Power-down mode. With this feature, level triggered interrupts are not
needed.
• Each enabled interrupt contributes to a wake-up signal that can be used to bring the
part out of Power-down mode.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
129 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
• Registers provide a software view of pending rising edge interrupts, pending falling
edge interrupts, and overall pending GPIO interrupts.
• GPIO0 and GPIO2 interrupts share the same position in the NVIC with External
Interrupt 3.
9.3 Applications
•
•
•
•
•
General purpose I/O
Driving LEDs or other indicators
Controlling off-chip devices
Sensing digital inputs, detecting edges
Bringing the part out of Power-down mode
9.4 Pin description
Table 101. GPIO pin description
Pin Name
Type
Description
P0[30:0][1];
Input/
Output
General purpose input/output. These are typically shared with other
peripherals functions and will therefore not all be available in an
application. Packaging options may affect the number of GPIOs
available in a particular device.
P1[31:0][2];
P2[13:0];
P3[26:25];
P4[29:28]
UM10360
User manual
Some pins may be limited by requirements of the alternate functions of
the pin. For example, the pins containing the I2C0 functions are
open-drain for any function selected on that pin. Details may be found
in Section 7.1.1.
[1]
P0[14:12] are not available.
[2]
P1[2], P1[3], P1[7:5], P1[13:11] are not available.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
130 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
9.5 Register description
Due to compatibility requirements with the LPC2300 series ARM7-based products, the
LPC176x/5x implements portions of five 32-bit General Purpose I/O ports. Details on a
specific GPIO port usage can be found in Section 8.3.
The registers in Table 102 represent the enhanced GPIO features available on all of the
GPIO ports. These registers are located on an AHB bus for fast read and write timing.
They can all be accessed in byte, half-word, and word sizes. A mask register allows
access to a group of bits in a single GPIO port independently from other bits in the same
port.
Table 102. GPIO register map (local bus accessible registers - enhanced GPIO features)
Generic
Name
Description
Access Reset
PORTn Register
value[1] Name & Address
FIODIR
Fast GPIO Port Direction control register. This register
individually controls the direction of each port pin.
R/W
0
FIO0DIR - 0x2009 C000
FIO1DIR - 0x2009 C020
FIO2DIR - 0x2009 C040
FIO3DIR - 0x2009 C060
FIO4DIR - 0x2009 C080
FIOMASK Fast Mask register for port. Writes, sets, clears, and reads to R/W
port (done via writes to FIOPIN, FIOSET, and FIOCLR, and
reads of FIOPIN) alter or return only the bits enabled by zeros
in this register.
0
FIO0MASK - 0x2009 C010
FIO1MASK - 0x2009 C030
FIO2MASK - 0x2009 C050
FIO3MASK - 0x2009 C070
FIO4MASK - 0x2009 C090
Fast Port Pin value register using FIOMASK. The current state R/W
of digital port pins can be read from this register, regardless of
pin direction or alternate function selection (as long as pins are
not configured as an input to ADC). The value read is masked
by ANDing with inverted FIOMASK. Writing to this register
places corresponding values in all bits enabled by zeros in
FIOMASK.
0
FIO0PIN - 0x2009 C014
FIO1PIN - 0x2009 C034
FIO2PIN - 0x2009 C054
FIO3PIN - 0x2009 C074
FIO4PIN - 0x2009 C094
FIOPIN
Important: if an FIOPIN register is read, its bit(s) masked with
1 in the FIOMASK register will be read as 0 regardless of the
physical pin state.
FIOSET
Fast Port Output Set register using FIOMASK. This register
R/W
controls the state of output pins. Writing 1s produces highs at
the corresponding port pins. Writing 0s has no effect. Reading
this register returns the current contents of the port output
register. Only bits enabled by 0 in FIOMASK can be altered.
0
FIO0SET - 0x2009 C018
FIO1SET - 0x2009 C038
FIO2SET - 0x2009 C058
FIO3SET - 0x2009 C078
FIO4SET - 0x2009 C098
FIOCLR
Fast Port Output Clear register using FIOMASK. This register WO
controls the state of output pins. Writing 1s produces lows at
the corresponding port pins. Writing 0s has no effect. Only bits
enabled by 0 in FIOMASK can be altered.
0
FIO0CLR - 0x2009 C01C
FIO1CLR - 0x2009 C03C
FIO2CLR - 0x2009 C05C
FIO3CLR - 0x2009 C07C
FIO4CLR - 0x2009 C09C
[1]
Reset value reflects the data stored in used bits only. It does not include reserved bits content.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
131 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 103. GPIO interrupt register map
Generic
Name
Description
Access Reset
value[1]
PORTn Register
Name & Address
IntEnR
GPIO Interrupt Enable for Rising edge.
R/W
0
IO0IntEnR - 0x4002 8090
IO2IntEnR - 0x4002 80B0
IntEnF
GPIO Interrupt Enable for Falling edge.
R/W
0
IO0IntEnR - 0x4002 8094
IO2IntEnR - 0x4002 80B4
IntStatR
GPIO Interrupt Status for Rising edge.
RO
0
IO0IntStatR - 0x4002 8084
IO2IntStatR - 0x4002 80A4
IntStatF
GPIO Interrupt Status for Falling edge.
RO
0
IO0IntStatF - 0x4002 8088
IO2IntStatF - 0x4002 80A8
IntClr
GPIO Interrupt Clear.
WO
0
IO0IntClr - 0x4002 808C
IO2IntClr - 0x4002 80AC
IntStatus
GPIO overall Interrupt Status.
RO
0
IOIntStatus - 0x4002 8080
[1]
Reset value reflects the data stored in used bits only. It does not include reserved bits content.
9.5.1 GPIO port Direction register FIOxDIR (FIO0DIR to FIO4DIR- 0x2009
C000 to 0x2009 C080)
This word accessible register is used to control the direction of the pins when they are
configured as GPIO port pins. Direction bit for any pin must be set according to the pin
functionality.
Note that GPIO pins P0.29 and P0.30 are shared with the USB_D+ and USB_D- pins and
must have the same direction. If either FIO0DIR bit 29 or 30 are configured as zero, both
P0.29 and P0.30 will be inputs. If both FIO0DIR bits 29 and 30 are ones, both P0.29 and
P0.30 will be outputs.
Table 104. Fast GPIO port Direction register FIO0DIR to FIO4DIR - addresses 0x2009 C000 to
0x2009 C080) bit description
Bit
Symbol
31:0
FIO0DIR
FIO1DIR
FIO2DIR
FIO3DIR
FIO4DIR
Value Description
Reset
value
Fast GPIO Direction PORTx control bits. Bit 0 in FIOxDIR
controls pin Px.0, bit 31 in FIOxDIR controls pin Px.31.
0
Controlled pin is input.
1
Controlled pin is output.
0x0
Aside from the 32-bit long and word only accessible FIODIR register, every fast GPIO port
can also be controlled via several byte and half-word accessible registers listed in
Table 105, too. Next to providing the same functions as the FIODIR register, these
additional registers allow easier and faster access to the physical port pins.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
132 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 105. Fast GPIO port Direction control byte and half-word accessible register
description
Generic
Register
name
Description
FIOxDIR0
Register
length (bits)
& access
Reset
value
PORTn Register
Address & Name
Fast GPIO Port x Direction
8 (byte)
control register 0. Bit 0 in
R/W
FIOxDIR0 register corresponds
to pin Px.0 … bit 7 to pin Px.7.
0x00
FIO0DIR0 - 0x2009 C000
FIO1DIR0 - 0x2009 C020
FIO2DIR0 - 0x2009 C040
FIO3DIR0 - 0x2009 C060
FIO4DIR0 - 0x2009 C080
FIOxDIR1
Fast GPIO Port x Direction
8 (byte)
control register 1. Bit 0 in
R/W
FIOxDIR1 register corresponds
to pin Px.8 … bit 7 to pin Px.15.
0x00
FIO0DIR1 - 0x2009 C001
FIO1DIR1 - 0x2009 C021
FIO2DIR1 - 0x2009 C041
FIO3DIR1 - 0x2009 C061
FIO4DIR1 - 0x2009 C081
FIOxDIR2
Fast GPIO Port x Direction
8 (byte)
control register 2. Bit 0 in
R/W
FIOxDIR2 register corresponds
to pin Px.16 … bit 7 to pin
Px.23.
0x00
FIO0DIR2 - 0x2009 C002
FIO1DIR2 - 0x2009 C022
FIO2DIR2 - 0x2009 C042
FIO3DIR2 - 0x2009 C062
FIO4DIR2 - 0x2009 C082
FIOxDIR3
Fast GPIO Port x Direction
8 (byte)
control register 3. Bit 0 in
R/W
FIOxDIR3 register corresponds
to pin Px.24 … bit 7 to pin
Px.31.
0x00
FIO0DIR3 - 0x2009 C003
FIO1DIR3 - 0x2009 C023
FIO2DIR3 - 0x2009 C043
FIO3DIR3 - 0x2009 C063
FIO4DIR3 - 0x2009 C083
FIOxDIRL
Fast GPIO Port x Direction
control Lower half-word
register. Bit 0 in FIOxDIRL
register corresponds to pin
Px.0 … bit 15 to pin Px.15.
16 (half-word) 0x0000 FIO0DIRL - 0x2009 C000
R/W
FIO1DIRL - 0x2009 C020
FIO2DIRL - 0x2009 C040
FIO3DIRL - 0x2009 C060
FIO4DIRL - 0x2009 C080
FIOxDIRU
Fast GPIO Port x Direction
control Upper half-word
register. Bit 0 in FIOxDIRU
register corresponds to Px.16
… bit 15 to Px.31.
16 (half-word) 0x0000 FIO0DIRU - 0x2009 C002
R/W
FIO1DIRU - 0x2009 C022
FIO2DIRU - 0x2009 C042
FIO3DIRU - 0x2009 C062
FIO4DIRU - 0x2009 C082
9.5.2 GPIO port output Set register FIOxSET (FIO0SET to FIO4SET - 0x2009
C018 to 0x2009 C098)
This register is used to produce a HIGH level output at the port pins configured as GPIO in
an OUTPUT mode. Writing 1 produces a HIGH level at the corresponding port pins.
Writing 0 has no effect. If any pin is configured as an input or a secondary function, writing
1 to the corresponding bit in the FIOxSET has no effect.
Reading the FIOxSET register returns the value of this register, as determined by
previous writes to FIOxSET and FIOxCLR (or FIOxPIN as noted above). This value does
not reflect the effect of any outside world influence on the I/O pins.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
133 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Access to a port pin via the FIOxSET register is conditioned by the corresponding bit of
the FIOxMASK register (see Section 9.5.5).
Table 106. Fast GPIO port output Set register (FIO0SET to FIO4SET - addresses 0x2009 C018
to 0x2009 C098) bit description
Bit
Symbol
Value Description
31:0
FIO0SET
FIO1SET
FIO2SET 0
FIO3SET
FIO4SET 1
Reset
value
Fast GPIO output value Set bits. Bit 0 in FIOxSET controls pin
Px.0, bit 31 in FIOxSET controls pin Px.31.
0x0
Controlled pin output is unchanged.
Controlled pin output is set to HIGH.
Aside from the 32-bit long and word only accessible FIOxSET register, every fast GPIO
port can also be controlled via several byte and half-word accessible registers listed in
Table 107, too. Next to providing the same functions as the FIOxSET register, these
additional registers allow easier and faster access to the physical port pins.
Table 107. Fast GPIO port output Set byte and half-word accessible register description
UM10360
User manual
Generic
Register
name
Description
Register
length (bits)
& access
Reset
value
PORTn Register
Address & Name
FIOxSET0
Fast GPIO Port x output Set
register 0. Bit 0 in FIOxSET0
register corresponds to pin
Px.0 … bit 7 to pin Px.7.
8 (byte)
R/W
0x00
FIO0SET0 - 0x2009 C018
FIO1SET0 - 0x2009 C038
FIO2SET0 - 0x2009 C058
FIO3SET0 - 0x2009 C078
FIO4SET0 - 0x2009 C098
FIOxSET1
Fast GPIO Port x output Set
register 1. Bit 0 in FIOxSET1
register corresponds to pin
Px.8 … bit 7 to pin Px.15.
8 (byte)
R/W
0x00
FIO0SET1 - 0x2009 C019
FIO1SET1 - 0x2009 C039
FIO2SET1 - 0x2009 C059
FIO3SET1 - 0x2009 C079
FIO4SET1 - 0x2009 C099
FIOxSET2
Fast GPIO Port x output Set
register 2. Bit 0 in FIOxSET2
register corresponds to pin
Px.16 … bit 7 to pin Px.23.
8 (byte)
R/W
0x00
FIO0SET2 - 0x2009 C01A
FIO1SET2 - 0x2009 C03A
FIO2SET2 - 0x2009 C05A
FIO3SET2 - 0x2009 C07A
FIO4SET2 - 0x2009 C09A
FIOxSET3
Fast GPIO Port x output Set
register 3. Bit 0 in FIOxSET3
register corresponds to pin
Px.24 … bit 7 to pin Px.31.
8 (byte)
R/W
0x00
FIO0SET3 - 0x2009 C01B
FIO1SET3 - 0x2009 C03B
FIO2SET3 - 0x2009 C05B
FIO3SET3 - 0x2009 C07B
FIO4SET3 - 0x2009 C09B
FIOxSETL
Fast GPIO Port x output Set 16 (half-word) 0x0000 FIO0SETL - 0x2009 C018
Lower half-word register. Bit 0 R/W
FIO1SETL - 0x2009 C038
in FIOxSETL register
FIO2SETL - 0x2009 C058
corresponds to pin Px.0 … bit
FIO3SETL - 0x2009 C078
15 to pin Px.15.
FIO4SETL - 0x2009 C098
FIOxSETU
Fast GPIO Port x output Set 16 (half-word) 0x0000 FIO0SETU - 0x2009 C01A
Upper half-word register. Bit 0 R/W
FIO1SETU - 0x2009 C03A
in FIOxSETU register
FIO2SETU - 0x2009 C05A
corresponds to Px.16 … bit
FIO3SETU - 0x2009 C07A
15 to Px.31.
FIO4SETU - 0x2009 C09A
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
134 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
9.5.3 GPIO port output Clear register FIOxCLR (FIO0CLR to FIO4CLR0x2009 C01C to 0x2009 C09C)
This register is used to produce a LOW level output at port pins configured as GPIO in an
OUTPUT mode. Writing 1 produces a LOW level at the corresponding port pin and clears
the corresponding bit in the FIOxSET register. Writing 0 has no effect. If any pin is
configured as an input or a secondary function, writing to FIOxCLR has no effect.
Access to a port pin via the FIOxCLR register is conditioned by the corresponding bit of
the FIOxMASK register (see Section 9.5.5).
Table 108. Fast GPIO port output Clear register (FIO0CLR to FIO4CLR- addresses 0x2009
C01C to 0x2009 C09C) bit description
Bit
Symbol
Value Description
31:0
FIO0CLR
FIO1CLR
FIO2CLR 0
FIO3CLR
FIO4CLR 1
Reset
value
Fast GPIO output value Clear bits. Bit 0 in FIOxCLR controls pin 0x0
Px.0, bit 31 controls pin Px.31.
Controlled pin output is unchanged.
Controlled pin output is set to LOW.
Aside from the 32-bit long and word only accessible FIOxCLR register, every fast GPIO
port can also be controlled via several byte and half-word accessible registers listed in
Table 109, too. Next to providing the same functions as the FIOxCLR register, these
additional registers allow easier and faster access to the physical port pins.
Table 109. Fast GPIO port output Clear byte and half-word accessible register
description
UM10360
User manual
Generic
Register
name
Description
Register
length (bits)
& access
Reset
value
PORTn Register
Address & Name
FIOxCLR0
Fast GPIO Port x output
Clear register 0. Bit 0 in
FIOxCLR0 register
corresponds to pin Px.0 …
bit 7 to pin Px.7.
8 (byte)
WO
0x00
FIO0CLR0 - 0x2009 C01C
FIO1CLR0 - 0x2009 C03C
FIO2CLR0 - 0x2009 C05C
FIO3CLR0 - 0x2009 C07C
FIO4CLR0 - 0x2009 C09C
FIOxCLR1
Fast GPIO Port x output
Clear register 1. Bit 0 in
FIOxCLR1 register
corresponds to pin Px.8 …
bit 7 to pin Px.15.
8 (byte)
WO
0x00
FIO0CLR1 - 0x2009 C01D
FIO1CLR1 - 0x2009 C03D
FIO2CLR1 - 0x2009 C05D
FIO3CLR1 - 0x2009 C07D
FIO4CLR1 - 0x2009 C09D
FIOxCLR2
Fast GPIO Port x output
Clear register 2. Bit 0 in
FIOxCLR2 register
corresponds to pin Px.16 …
bit 7 to pin Px.23.
8 (byte)
WO
0x00
FIO0CLR2 - 0x2009 C01E
FIO1CLR2 - 0x2009 C03E
FIO2CLR2 - 0x2009 C05E
FIO3CLR2 - 0x2009 C07E
FIO4CLR2 - 0x2009 C09E
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
135 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 109. Fast GPIO port output Clear byte and half-word accessible register
description …continued
Generic
Register
name
Description
Register
length (bits)
& access
Reset
value
PORTn Register
Address & Name
FIOxCLR3
Fast GPIO Port x output
Clear register 3. Bit 0 in
FIOxCLR3 register
corresponds to pin Px.24 …
bit 7 to pin Px.31.
8 (byte)
WO
0x00
FIO0CLR3 - 0x2009 C01F
FIO1CLR3 - 0x2009 C03F
FIO2CLR3 - 0x2009 C05F
FIO3CLR3 - 0x2009 C07F
FIO4CLR3 - 0x2009 C09F
FIOxCLRL
Fast GPIO Port x output
Clear Lower half-word
register. Bit 0 in FIOxCLRL
register corresponds to pin
Px.0 … bit 15 to pin Px.15.
16 (half-word)
WO
0x0000 FIO0CLRL - 0x2009 C01C
FIO1CLRL - 0x2009 C03C
FIO2CLRL - 0x2009 C05C
FIO3CLRL - 0x2009 C07C
FIO4CLRL - 0x2009 C09C
FIOxCLRU Fast GPIO Port x output
Clear Upper half-word
register. Bit 0 in FIOxCLRU
register corresponds to pin
Px.16 … bit 15 to Px.31.
16 (half-word)
WO
0x0000 FIO0CLRU - 0x2009 C01E
FIO1CLRU - 0x2009 C03E
FIO2CLRU - 0x2009 C05E
FIO3CLRU - 0x2009 C07E
FIO4CLRU - 0x2009 C09E
9.5.4 GPIO port Pin value register FIOxPIN (FIO0PIN to FIO4PIN- 0x2009
C014 to 0x2009 C094)
This register provides the value of port pins that are configured to perform only digital
functions. The register will give the logic value of the pin regardless of whether the pin is
configured for input or output, or as GPIO or an alternate digital function. As an example,
a particular port pin may have GPIO input, GPIO output, UART receive, and PWM output
as selectable functions. Any configuration of that pin will allow its current logic state to be
read from the corresponding FIOxPIN register.
If a pin has an analog function as one of its options, the pin state cannot be read if the
analog configuration is selected. Selecting the pin as an A/D input disconnects the digital
features of the pin. In that case, the pin value read in the FIOxPIN register is not valid.
Writing to the FIOxPIN register stores the value in the port output register, bypassing the
need to use both the FIOxSET and FIOxCLR registers to obtain the entire written value.
This feature should be used carefully in an application since it affects the entire port.
Access to a port pin via the FIOxPIN register is conditioned by the corresponding bit of
the FIOxMASK register (see Section 9.5.5).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
136 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Only pins masked with zeros in the Mask register (see Section 9.5.5) will be correlated to
the current content of the Fast GPIO port pin value register.
Table 110. Fast GPIO port Pin value register (FIO0PIN to FIO4PIN- addresses 0x2009 C014 to
0x2009 C094) bit description
Bit
Symbol
31:0
FIO0VAL
FIO1VAL
FIO2VAL
FIO3VAL
FIO4VAL
Value Description
Reset
value
Fast GPIO output value bits. Bit 0 corresponds to pin Px.0, bit 31 0x0
corresponds to pin Px.31. Only bits also set to 0 in the
FIOxMASK register are affected by a write or show the pin’s
actual logic state.
0
Reading a 0 indicates that the port pin’s current state is LOW.
Writing a 0 sets the output register value to LOW.
1
Reading a 1 indicates that the port pin’s current state is HIGH.
Writing a 1 sets the output register value to HIGH.
Aside from the 32-bit long and word only accessible FIOxPIN register, every fast GPIO
port can also be controlled via several byte and half-word accessible register listed in
Table 111, too. Next to providing the same functions as the FIOxPIN register, these
additional registers allow easier and faster access to the physical port pins.
Table 111. Fast GPIO port Pin value byte and half-word accessible register
description
UM10360
User manual
Generic
Register
name
Description
Register
length (bits)
& access
Reset
value
PORTn Register
Address & Name
FIOxPIN0
Fast GPIO Port x Pin value
register 0. Bit 0 in FIOxPIN0
register corresponds to pin
Px.0 … bit 7 to pin Px.7.
8 (byte)
R/W
0x00
FIO0PIN0 - 0x2009 C014
FIO1PIN0 - 0x2009 C034
FIO2PIN0 - 0x2009 C054
FIO3PIN0 - 0x2009 C074
FIO4PIN0 - 0x2009 C094
FIOxPIN1
Fast GPIO Port x Pin value
register 1. Bit 0 in FIOxPIN1
register corresponds to pin
Px.8 … bit 7 to pin Px.15.
8 (byte)
R/W
0x00
FIO0PIN1 - 0x2009 C015
FIO1PIN1 - 0x2009 C035
FIO2PIN1 - 0x2009 C055
FIO3PIN1 - 0x2009 C075
FIO4PIN1 - 0x2009 C095
FIOxPIN2
Fast GPIO Port x Pin value
register 2. Bit 0 in FIOxPIN2
register corresponds to pin
Px.16 … bit 7 to pin Px.23.
8 (byte)
R/W
0x00
FIO0PIN2 - 0x2009 C016
FIO1PIN2 - 0x2009 C036
FIO2PIN2 - 0x2009 C056
FIO3PIN2 - 0x2009 C076
FIO4PIN2 - 0x2009 C096
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
137 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 111. Fast GPIO port Pin value byte and half-word accessible register
description …continued
Generic
Register
name
Description
Register
length (bits)
& access
Reset
value
PORTn Register
Address & Name
FIOxPIN3
Fast GPIO Port x Pin value
register 3. Bit 0 in FIOxPIN3
register corresponds to pin
Px.24 … bit 7 to pin Px.31.
8 (byte)
R/W
0x00
FIO0PIN3 - 0x2009 C017
FIO1PIN3 - 0x2009 C037
FIO2PIN3 - 0x2009 C057
FIO3PIN3 - 0x2009 C077
FIO4PIN3 - 0x2009 C097
FIOxPINL
Fast GPIO Port x Pin value
Lower half-word register. Bit 0
in FIOxPINL register
corresponds to pin Px.0 … bit
15 to pin Px.15.
16 (half-word) 0x0000 FIO0PINL - 0x2009 C014
R/W
FIO1PINL - 0x2009 C034
FIO2PINL - 0x2009 C054
FIO3PINL - 0x2009 C074
FIO4PINL - 0x2009 C094
FIOxPINU
Fast GPIO Port x Pin value
16 (half-word) 0x0000 FIO0PINU - 0x2009 C016
Upper half-word register. Bit 0 R/W
FIO1PINU - 0x2009 C036
in FIOxPINU register
FIO2PINU - 0x2009 C056
corresponds to pin Px.16 … bit
FIO3PINU - 0x2009 C076
15 to Px.31.
FIO4PINU - 0x2009 C096
9.5.5 Fast GPIO port Mask register FIOxMASK (FIO0MASK to FIO4MASK 0x2009 C010 to 0x2009 C090)
This register is used to select port pins that will and will not be affected by write accesses
to the FIOxPIN, FIOxSET or FIOxCLR register. Mask register also filters out port’s content
when the FIOxPIN register is read.
A zero in this register’s bit enables an access to the corresponding physical pin via a read
or write access. If a bit in this register is one, corresponding pin will not be changed with
write access and if read, will not be reflected in the updated FIOxPIN register. For
software examples, see Section 9.6.
Table 112. Fast GPIO port Mask register (FIO0MASK to FIO4MASK - addresses 0x2009 C010
to 0x2009 C090) bit description
Bit
Symbol
Value Description
31:0 FIO0MASK
FIO1MASK
FIO2MASK
FIO3MASK
FIO4MASK
UM10360
User manual
Reset
value
Fast GPIO physical pin access control.
0x0
0
Controlled pin is affected by writes to the port’s FIOxSET,
FIOxCLR, and FIOxPIN register(s). Current state of the pin
can be read from the FIOxPIN register.
1
Controlled pin is not affected by writes into the port’s
FIOxSET, FIOxCLR and FIOxPIN register(s). When the
FIOxPIN register is read, this bit will not be updated with the
state of the physical pin.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
138 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Aside from the 32-bit long and word only accessible FIOxMASK register, every fast GPIO
port can also be controlled via several byte and half-word accessible registers listed in
Table 113, too. Next to providing the same functions as the FIOxMASK register, these
additional registers allow easier and faster access to the physical port pins.
Table 113. Fast GPIO port Mask byte and half-word accessible register description
UM10360
User manual
Generic
Register
name
Description
Register
length (bits)
& access
Reset PORTn Register
value Address & Name
FIOxMASK0
Fast GPIO Port x Mask
register 0. Bit 0 in
FIOxMASK0 register
corresponds to pin Px.0 …
bit 7 to pin Px.7.
8 (byte)
R/W
0x0
FIO0MASK0 - 0x2009 C010
FIO1MASK0 - 0x2009 C030
FIO2MASK0 - 0x2009 C050
FIO3MASK0 - 0x2009 C070
FIO4MASK0 - 0x2009 C090
FIOxMASK1
Fast GPIO Port x Mask
register 1. Bit 0 in
FIOxMASK1 register
corresponds to pin Px.8 …
bit 7 to pin Px.15.
8 (byte)
R/W
0x0
FIO0MASK1 - 0x2009 C011
FIO1MASK1 - 0x2009 C031
FIO2MASK1 - 0x2009 C051
FIO3MASK1 - 0x2009 C071
FIO4MASK1 - 0x2009 C091
FIOxMASK2
Fast GPIO Port x Mask
8 (byte)
register 2. Bit 0 in
R/W
FIOxMASK2 register
corresponds to pin Px.16 …
bit 7 to pin Px.23.
0x0
FIO0MASK2 - 0x2009 C012
FIO1MASK2 - 0x2009 C032
FIO2MASK2 - 0x2009 C052
FIO3MASK2 - 0x2009 C072
FIO4MASK2 - 0x2009 C092
FIOxMASK3
Fast GPIO Port x Mask
8 (byte)
register 3. Bit 0 in
R/W
FIOxMASK3 register
corresponds to pin Px.24 …
bit 7 to pin Px.31.
0x0
FIO0MASK3 - 0x2009 C013
FIO1MASK3 - 0x2009 C033
FIO2MASK3 - 0x2009 C053
FIO3MASK3 - 0x2009 C073
FIO4MASK3 - 0x2009 C093
FIOxMASKL
Fast GPIO Port x Mask
Lower half-word register.
Bit 0 in FIOxMASKL
register corresponds to pin
Px.0 … bit 15 to pin Px.15.
16
(half-word)
R/W
0x0
FIO0MASKL - 0x2009 C010
FIO1MASKL - 0x2009 C030
FIO2MASKL - 0x2009 C050
FIO3MASKL - 0x2009 C070
FIO4MASKL - 0x2009 C090
FIOxMASKU
Fast GPIO Port x Mask
Upper half-word register.
Bit 0 in FIOxMASKU
register corresponds to pin
Px.16 … bit 15 to Px.31.
16
(half-word)
R/W
0x0
FIO0MASKU - 0x2009 C012
FIO1MASKU - 0x2009 C032
FIO2MASKU - 0x2009 C052
FIO3MASKU - 0x2009 C072
FIO4MASKU - 0x2009 C092
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
139 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
9.5.6 GPIO interrupt registers
The following registers configure the pins of Port 0 and Port 2 to generate interrupts.
9.5.6.1 GPIO overall Interrupt Status register (IOIntStatus - 0x4002 8080)
This read-only register indicates the presence of interrupt pending on all of the GPIO ports
that support GPIO interrupts. Only status one bit per port is required.
Table 114. GPIO overall Interrupt Status register (IOIntStatus - address 0x4002 8080) bit
description
Bit
Symbol
0
P0Int
1
-
2
P2Int
31:2
Value Description
Reset
value
Port 0 GPIO interrupt pending.
-
0
0
There are no pending interrupts on Port 0.
1
There is at least one pending interrupt on Port 0.
-
Reserved. The value read from a reserved bit is not defined.
NA
Port 2 GPIO interrupt pending.
0
0
There are no pending interrupts on Port 2.
1
There is at least one pending interrupt on Port 2.
-
Reserved. The value read from a reserved bit is not defined.
NA
9.5.6.2 GPIO Interrupt Enable for port 0 Rising Edge (IO0IntEnR - 0x4002 8090)
Each bit in these read-write registers enables the rising edge interrupt for the
corresponding port 0 pin.
Table 115. GPIO Interrupt Enable for port 0 Rising Edge (IO0IntEnR - 0x4002 8090) bit
description
Bit
Symbol
0
P0.0ER
Value Description
Enable rising edge interrupt for P0.0.
User manual
Rising edge interrupt is disabled on P0.0.
1
Rising edge interrupt is enabled on P0.0.
0
1
P0.1ER
Enable rising edge interrupt for P0.1.
0
2
P0.2ER
Enable rising edge interrupt for P0.2.
0
3
P0.3ER
Enable rising edge interrupt for P0.3.
0
4
P0.4ER[1]
Enable rising edge interrupt for P0.4.
0
5
P0.5ER[1]
Enable rising edge interrupt for P0.5.
0
6
P0.6ER
Enable rising edge interrupt for P0.6.
0
7
P0.7ER
Enable rising edge interrupt for P0.7.
0
8
P0.8ER
Enable rising edge interrupt for P0.8.
0
9
P0.9ER
Enable rising edge interrupt for P0.9.
0
10
P0.10ER
Enable rising edge interrupt for P0.10.
0
11
P0.11ER
Enable rising edge interrupt for P0.11.
0
Reserved
NA
14:12 -
UM10360
0
Reset
value
15
P0.15ER
Enable rising edge interrupt for P0.15.
0
16
P0.16ER
Enable rising edge interrupt for P0.16.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
140 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 115. GPIO Interrupt Enable for port 0 Rising Edge (IO0IntEnR - 0x4002 8090) bit
description …continued
Bit
Symbol
17
P0.17ER
Enable rising edge interrupt for P0.17.
0
18
P0.18ER
Enable rising edge interrupt for P0.18.
0
19
P0.19ER[1]
Enable rising edge interrupt for P0.19.
0
20
P0.20ER[1]
Enable rising edge interrupt for P0.20.
0
21
P0.21ER[1]
Enable rising edge interrupt for P0.21.
0
22
P0.22ER
Enable rising edge interrupt for P0.22.
0
23
P0.23ER[1]
Enable rising edge interrupt for P0.23.
0
24
P0.24ER[1]
Enable rising edge interrupt for P0.24.
0
25
P0.25ER
Enable rising edge interrupt for P0.25.
0
26
P0.26ER
Enable rising edge interrupt for P0.26.
0
27
P0.27ER[1]
Enable rising edge interrupt for P0.27.
0
28
P0.28ER[1]
Enable rising edge interrupt for P0.28.
0
29
P0.29ER
Enable rising edge interrupt for P0.29.
0
30
P0.30ER
Enable rising edge interrupt for P0.30.
0
31
-
Reserved.
NA
[1]
Value Description
Reset
value
Not available on 80-pin package.
9.5.6.3 GPIO Interrupt Enable for port 2 Rising Edge (IO2IntEnR - 0x4002 80B0)
Each bit in these read-write registers enables the rising edge interrupt for the
corresponding port 2 pin.
Table 116. GPIO Interrupt Enable for port 2 Rising Edge (IO2IntEnR - 0x4002 80B0) bit
description
UM10360
User manual
Bit
Symbol
0
P2.0ER
Value Description
Enable rising edge interrupt for P2.0.
0
Rising edge interrupt is disabled on P2.0.
1
Rising edge interrupt is enabled on P2.0.
Reset
value
0
1
P2.1ER
Enable rising edge interrupt for P2.1.
0
2
P2.2ER
Enable rising edge interrupt for P2.2.
0
3
P2.3ER
Enable rising edge interrupt for P2.3.
0
4
P2.4ER
Enable rising edge interrupt for P2.4.
0
5
P2.5ER
Enable rising edge interrupt for P2.5.
0
6
P2.6ER
Enable rising edge interrupt for P2.6.
0
7
P2.7ER
Enable rising edge interrupt for P2.7.
0
8
P2.8ER
Enable rising edge interrupt for P2.8.
0
9
P2.9ER
Enable rising edge interrupt for P2.9.
0
10
P2.10ER
Enable rising edge interrupt for P2.10.
0
11
P2.11ER[1]
Enable rising edge interrupt for P2.11.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
141 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 116. GPIO Interrupt Enable for port 2 Rising Edge (IO2IntEnR - 0x4002 80B0) bit
description …continued
Bit
Symbol
Value Description
12
P2.12ER[1]
Enable rising edge interrupt for P2.12.
0
13
P2.13ER[1]
Enable rising edge interrupt for P2.13.
0
Reserved.
NA
31:14 [1]
Reset
value
Not available on 80-pin package.
9.5.6.4 GPIO Interrupt Enable for port 0 Falling Edge (IO0IntEnF - 0x4002 8094)
Each bit in these read-write registers enables the falling edge interrupt for the
corresponding GPIO port 0 pin.
Table 117. GPIO Interrupt Enable for port 0 Falling Edge (IO0IntEnF - address 0x4002 8094)
bit description
UM10360
User manual
Bit
Symbol
0
P0.0EF
Value Description
Enable falling edge interrupt for P0.0
0
Falling edge interrupt is disabled on P0.0.
1
Falling edge interrupt is enabled on P0.0.
Reset
value
0
1
P0.1EF
Enable falling edge interrupt for P0.1.
0
2
P0.2EF
Enable falling edge interrupt for P0.2.
0
3
P0.3EF
Enable falling edge interrupt for P0.3.
0
4
P0.4EF[1]
Enable falling edge interrupt for P0.4.
0
5
P0.5EF[1]
Enable falling edge interrupt for P0.5.
0
6
P0.6EF
Enable falling edge interrupt for P0.6.
0
7
P0.7EF
Enable falling edge interrupt for P0.7.
0
8
P0.8EF
Enable falling edge interrupt for P0.8.
0
9
P0.9EF
Enable falling edge interrupt for P0.9.
0
10
P0.10EF
Enable falling edge interrupt for P0.10.
0
11
P0.11EF
Enable falling edge interrupt for P0.11.
0
14:12 -
Reserved.
NA
15
P0.15EF
Enable falling edge interrupt for P0.15.
0
16
P0.16EF
Enable falling edge interrupt for P0.16.
0
17
P0.17EF
Enable falling edge interrupt for P0.17.
0
18
P0.18EF
Enable falling edge interrupt for P0.18.
0
19
P0.19EF[1]
Enable falling edge interrupt for P0.19.
0
20
P0.20EF[1]
Enable falling edge interrupt for P0.20.
0
21
P0.21EF[1]
Enable falling edge interrupt for P0.21.
0
22
P0.22EF
Enable falling edge interrupt for P0.22.
0
23
P0.23EF[1]
Enable falling edge interrupt for P0.23.
0
24
P0.24EF[1]
Enable falling edge interrupt for P0.24.
0
25
P0.25EF
Enable falling edge interrupt for P0.25.
0
26
P0.26EF
Enable falling edge interrupt for P0.26.
0
27
P0.27EF[1]
Enable falling edge interrupt for P0.27.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
142 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 117. GPIO Interrupt Enable for port 0 Falling Edge (IO0IntEnF - address 0x4002 8094)
bit description …continued
Bit
Symbol
28
P0.28EF[1]
Enable falling edge interrupt for P0.28.
0
29
P0.29EF
Enable falling edge interrupt for P0.29.
0
30
P0.30EF
Enable falling edge interrupt for P0.30.
0
31
-
Reserved.
NA
[1]
Value Description
Reset
value
Not available on 80-pin package.
9.5.6.5 GPIO Interrupt Enable for port 2 Falling Edge (IO2IntEnF - 0x4002 80B4)
Each bit in these read-write registers enables the falling edge interrupt for the
corresponding GPIO port 2 pin.
Table 118. GPIO Interrupt Enable for port 2 Falling Edge (IO2IntEnF - 0x4002 80B4) bit
description
Bit
Symbol
0
P2.0EF
0
Falling edge interrupt is disabled on P2.0.
1
Falling edge interrupt is enabled on P2.0.
0
P2.1EF
Enable falling edge interrupt for P2.1.
0
2
P2.2EF
Enable falling edge interrupt for P2.2.
0
3
P2.3EF
Enable falling edge interrupt for P2.3.
0
4
P2.4EF
Enable falling edge interrupt for P2.4.
0
5
P2.5EF
Enable falling edge interrupt for P2.5.
0
6
P2.6EF
Enable falling edge interrupt for P2.6.
0
7
P2.7EF
Enable falling edge interrupt for P2.7.
0
8
P2.8EF
Enable falling edge interrupt for P2.8.
0
9
P2.9EF
Enable falling edge interrupt for P2.9.
0
10
P2.10EF
Enable falling edge interrupt for P2.10.
0
11
P2.11EF[1]
Enable falling edge interrupt for P2.11.
0
12
P2.12EF[1]
Enable falling edge interrupt for P2.12.
0
13
P2.13EF[1]
Enable falling edge interrupt for P2.13.
0
Reserved.
NA
[1]
User manual
Enable falling edge interrupt for P2.0
Reset
value
1
31:14 -
UM10360
Value Description
Not available on 80-pin package.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
143 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
9.5.6.6 GPIO Interrupt Status for port 0 Rising Edge Interrupt (IO0IntStatR 0x4002 8084)
Each bit in these read-only registers indicates the rising edge interrupt status for port 0.
Table 119. GPIO Interrupt Status for port 0 Rising Edge Interrupt (IO0IntStatR - 0x4002 8084)
bit description
Bit
Symbol
0
P0.0REI
User manual
Reset
value
Status of Rising Edge Interrupt for P0.0
0
0
A rising edge has not been detected on P0.0.
1
Interrupt has been generated due to a rising edge on P0.0.
1
P0.1REI
Status of Rising Edge Interrupt for P0.1.
0
2
P0.2REI
Status of Rising Edge Interrupt for P0.2.
0
3
P0.3REI
Status of Rising Edge Interrupt for P0.3.
0
4
P0.4REI[1]
Status of Rising Edge Interrupt for P0.4.
0
5
P0.5REI[1]
Status of Rising Edge Interrupt for P0.5.
0
6
P0.6REI
Status of Rising Edge Interrupt for P0.6.
0
7
P0.7REI
Status of Rising Edge Interrupt for P0.7.
0
8
P0.8REI
Status of Rising Edge Interrupt for P0.8.
0
9
P0.9REI
Status of Rising Edge Interrupt for P0.9.
0
10
P0.10REI
Status of Rising Edge Interrupt for P0.10.
0
11
P0.11REI
Status of Rising Edge Interrupt for P0.11.
0
14:12 -
Reserved.
NA
15
P0.15REI
Status of Rising Edge Interrupt for P0.15.
0
16
P0.16REI
Status of Rising Edge Interrupt for P0.16.
0
17
P0.17REI
Status of Rising Edge Interrupt for P0.17.
0
18
P0.18REI
Status of Rising Edge Interrupt for P0.18.
0
19
P0.19REI[1]
Status of Rising Edge Interrupt for P0.19.
0
20
P0.20REI[1]
Status of Rising Edge Interrupt for P0.20.
0
21
P0.21REI[1]
Status of Rising Edge Interrupt for P0.21.
0
22
P0.22REI
Status of Rising Edge Interrupt for P0.22.
0
23
P0.23REI[1]
Status of Rising Edge Interrupt for P0.23.
0
24
P0.24REI[1]
Status of Rising Edge Interrupt for P0.24.
0
25
P0.25REI
Status of Rising Edge Interrupt for P0.25.
0
26
P0.26REI
Status of Rising Edge Interrupt for P0.26.
0
27
P0.27REI[1]
Status of Rising Edge Interrupt for P0.27.
0
28
P0.28REI[1]
Status of Rising Edge Interrupt for P0.28.
0
29
P0.29REI
Status of Rising Edge Interrupt for P0.29.
0
30
P0.30REI
Status of Rising Edge Interrupt for P0.30.
0
31
-
Reserved.
NA
[1]
UM10360
Value Description
Not available on 80-pin package.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
144 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
9.5.6.7 GPIO Interrupt Status for port 2 Rising Edge Interrupt (IO2IntStatR 0x4002 80A4)
Each bit in these read-only registers indicates the rising edge interrupt status for port 2.
Table 120. GPIO Interrupt Status for port 2 Rising Edge Interrupt (IO2IntStatR - 0x4002 80A4)
bit description
Bit
Symbol
0
P2.0REI
Value Description
Reset
value
Status of Rising Edge Interrupt for P2.0
0
0
A rising edge has not been detected on P2.0.
1
Interrupt has been generated due to a rising edge on P2.0.
1
P2.1REI
Status of Rising Edge Interrupt for P2.1.
0
2
P2.2REI
Status of Rising Edge Interrupt for P2.2.
0
3
P2.3REI
Status of Rising Edge Interrupt for P2.3.
0
4
P2.4REI
Status of Rising Edge Interrupt for P2.4.
0
5
P2.5REI
Status of Rising Edge Interrupt for P2.5.
0
6
P2.6REI
Status of Rising Edge Interrupt for P2.6.
0
7
P2.7REI
Status of Rising Edge Interrupt for P2.7.
0
8
P2.8REI
Status of Rising Edge Interrupt for P2.8.
0
9
P2.9REI
Status of Rising Edge Interrupt for P2.9.
0
10
P2.10REI
Status of Rising Edge Interrupt for P2.10.
0
11
P2.11REI[1]
Status of Rising Edge Interrupt for P2.11.
0
12
P2.12REI[1]
Status of Rising Edge Interrupt for P2.12.
0
13
P2.13REI[1]
Status of Rising Edge Interrupt for P2.13.
0
Reserved.
NA
31:14 [1]
Not available on 80-pin package.
9.5.6.8 GPIO Interrupt Status for port 0 Falling Edge Interrupt (IO0IntStatF 0x4002 8088)
Each bit in these read-only registers indicates the falling edge interrupt status for port 0.
Table 121. GPIO Interrupt Status for port 0 Falling Edge Interrupt (IO0IntStatF - 0x4002 8088)
bit description
UM10360
User manual
Bit
Symbol
0
P0.0FEI
Value Description
Reset
value
Status of Falling Edge Interrupt for P0.0
0
0
A falling edge has not been detected on P0.0.
1
Interrupt has been generated due to a falling edge on P0.0.
1
P0.1FEI
Status of Falling Edge Interrupt for P0.1.
0
2
P0.2FEI
Status of Falling Edge Interrupt for P0.2.
0
3
P0.3FEI
Status of Falling Edge Interrupt for P0.3.
0
4
P0.4FEI[1]
Status of Falling Edge Interrupt for P0.4.
0
5
P0.5FEI[1]
Status of Falling Edge Interrupt for P0.5.
0
6
P0.6FEI
Status of Falling Edge Interrupt for P0.6.
0
7
P0.7FEI
Status of Falling Edge Interrupt for P0.7.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
145 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 121. GPIO Interrupt Status for port 0 Falling Edge Interrupt (IO0IntStatF - 0x4002 8088)
bit description …continued
Bit
Symbol
Value Description
Reset
value
8
P0.8FEI
Status of Falling Edge Interrupt for P0.8.
0
9
P0.9FEI
Status of Falling Edge Interrupt for P0.9.
0
10
P0.10FEI
Status of Falling Edge Interrupt for P0.10.
0
11
P0.11FEI
Status of Falling Edge Interrupt for P0.11.
0
14:12 -
Reserved.
NA
15
P0.15FEI
Status of Falling Edge Interrupt for P0.15.
0
16
P0.16FEI
Status of Falling Edge Interrupt for P0.16.
0
17
P0.17FEI
Status of Falling Edge Interrupt for P0.17.
0
18
P0.18FEI
Status of Falling Edge Interrupt for P0.18.
0
19
P0.19FEI[1]
Status of Falling Edge Interrupt for P0.19.
0
20
P0.20FEI[1]
Status of Falling Edge Interrupt for P0.20.
0
21
P0.21FEI[1]
Status of Falling Edge Interrupt for P0.21.
0
22
P0.22FEI
Status of Falling Edge Interrupt for P0.22.
0
23
P0.23FEI[1]
Status of Falling Edge Interrupt for P0.23.
0
24
P0.24FEI[1]
Status of Falling Edge Interrupt for P0.24.
0
25
P0.25FEI
Status of Falling Edge Interrupt for P0.25.
0
26
P0.26FEI
Status of Falling Edge Interrupt for P0.26.
0
27
P0.27FEI[1]
Status of Falling Edge Interrupt for P0.27.
0
28
P0.28FEI[1]
Status of Falling Edge Interrupt for P0.28.
0
29
P0.29FEI
Status of Falling Edge Interrupt for P0.29.
0
30
P0.30FEI
Status of Falling Edge Interrupt for P0.30.
0
31
-
Reserved.
NA
[1]
Not available on 80-pin package.
9.5.6.9 GPIO Interrupt Status for port 2 Falling Edge Interrupt (IO2IntStatF 0x4002 80A8)
Each bit in these read-only registers indicates the falling edge interrupt status for port 2.
Table 122. GPIO Interrupt Status for port 2 Falling Edge Interrupt (IO2IntStatF - 0x4002 80A8)
bit description
UM10360
User manual
Bit
Symbol
0
P2.0FEI
Value Description
Reset
value
Status of Falling Edge Interrupt for P2.0
0
0
A falling edge has not been detected on P2.0.
1
Interrupt has been generated due to a falling edge on P2.0.
1
P2.1FEI
Status of Falling Edge Interrupt for P2.1.
0
2
P2.2FEI
Status of Falling Edge Interrupt for P2.2.
0
3
P2.3FEI
Status of Falling Edge Interrupt for P2.3.
0
4
P2.4FEI
Status of Falling Edge Interrupt for P2.4.
0
5
P2.5FEI
Status of Falling Edge Interrupt for P2.5.
0
6
P2.6FEI
Status of Falling Edge Interrupt for P2.6.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
146 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 122. GPIO Interrupt Status for port 2 Falling Edge Interrupt (IO2IntStatF - 0x4002 80A8)
bit description …continued
Bit
Symbol
Value Description
7
P2.7FEI
Status of Falling Edge Interrupt for P2.7.
0
8
P2.8FEI
Status of Falling Edge Interrupt for P2.8.
0
9
P2.9FEI
Status of Falling Edge Interrupt for P2.9.
0
10
P2.10FEI
Status of Falling Edge Interrupt for P2.10.
0
11
P2.11FEI[1]
Status of Falling Edge Interrupt for P2.11.
0
12
P2.12FEI[1]
Status of Falling Edge Interrupt for P2.12.
0
13
P2.13FEI[1]
Status of Falling Edge Interrupt for P2.13.
0
Reserved.
NA
31:14 [1]
Reset
value
Not available on 80-pin package.
9.5.6.10 GPIO Interrupt Clear register for port 0 (IO0IntClr - 0x4002 808C)
Writing a 1 into a bit in this write-only register clears any interrupts for the corresponding
port 0 pin.
Table 123. GPIO Interrupt Clear register for port 0 (IO0IntClr - 0x4002 808C)) bit
description
UM10360
User manual
Bit
Symbol
0
P0.0CI
Value Description
Reset
value
Clear GPIO port Interrupts for P0.0
0
0
Corresponding bits in IOxIntStatR and IOxIntStatF are
unchanged.
1
Corresponding bits in IOxIntStatR and IOxStatF are cleared.
1
P0.1CI
Clear GPIO port Interrupts for P0.1.
0
2
P0.2CI
Clear GPIO port Interrupts for P0.2.
0
3
P0.3CI
Clear GPIO port Interrupts for P0.3.
0
4
P0.4CI[1]
Clear GPIO port Interrupts for P0.4.
0
5
P0.5CI[1]
Clear GPIO port Interrupts for P0.5.
0
6
P0.6CI
Clear GPIO port Interrupts for P0.6.
0
7
P0.7CI
Clear GPIO port Interrupts for P0.7.
0
8
P0.8CI
Clear GPIO port Interrupts for P0.8.
0
9
P0.9CI
Clear GPIO port Interrupts for P0.9.
0
10
P0.10CI
Clear GPIO port Interrupts for P0.10.
0
11
P0.11CI
Clear GPIO port Interrupts for P0.11.
0
14:12 -
Reserved.
NA
15
P0.15CI
Clear GPIO port Interrupts for P0.15.
0
16
P0.16CI
Clear GPIO port Interrupts for P0.16.
0
17
P0.17CI
Clear GPIO port Interrupts for P0.17.
0
18
P0.18CI
Clear GPIO port Interrupts for P0.18.
0
19
P0.19CI[1]
Clear GPIO port Interrupts for P0.19.
0
20
P0.20CI[1]
Clear GPIO port Interrupts for P0.20.
0
21
P0.21CI[1]
Clear GPIO port Interrupts for P0.21.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
147 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
Table 123. GPIO Interrupt Clear register for port 0 (IO0IntClr - 0x4002 808C)) bit
description …continued
Bit
Symbol
22
P0.22CI
Clear GPIO port Interrupts for P0.22.
0
23
P0.23CI[1]
Clear GPIO port Interrupts for P0.23.
0
24
P0.24CI[1]
Clear GPIO port Interrupts for P0.24.
0
25
P0.25CI
Clear GPIO port Interrupts for P0.25.
0
26
P0.26CI
Clear GPIO port Interrupts for P0.26.
0
27
P0.27CI[1]
Clear GPIO port Interrupts for P0.27.
0
28
P0.28CI[1]
Clear GPIO port Interrupts for P0.28.
0
29
P0.29CI
Clear GPIO port Interrupts for P0.29.
0
30
P0.30CI
Clear GPIO port Interrupts for P0.30.
0
31
-
Reserved.
NA
[1]
Value Description
Reset
value
Not available on 80-pin package.
9.5.6.11 GPIO Interrupt Clear register for port 2 (IO2IntClr - 0x4002 80AC)
Writing a 1 into a bit in this write-only register clears any interrupts for the corresponding
port 2 pin.
Table 124. GPIO Interrupt Clear register for port 2 (IO2IntClr - 0x4002 80AC) bit description
Bit
Symbol
0
P2.0CI
Clear GPIO port Interrupts for P2.0
0
0
Corresponding bits in IOxIntStatR and IOxIntStatF are
unchanged.
1
Corresponding bits in IOxIntStatR and IOxStatF are cleared.
P2.1CI
Clear GPIO port Interrupts for P2.1.
0
2
P2.2CI
Clear GPIO port Interrupts for P2.2.
0
3
P2.3CI
Clear GPIO port Interrupts for P2.3.
0
4
P2.4CI
Clear GPIO port Interrupts for P2.4.
0
5
P2.5CI
Clear GPIO port Interrupts for P2.5.
0
6
P2.6CI
Clear GPIO port Interrupts for P2.6.
0
7
P2.7CI
Clear GPIO port Interrupts for P2.7.
0
8
P2.8CI
Clear GPIO port Interrupts for P2.8.
0
9
P2.9CI
Clear GPIO port Interrupts for P2.9.
0
10
P2.10CI
Clear GPIO port Interrupts for P2.10.
0
11
P2.11CI[1]
Clear GPIO port Interrupts for P2.11.
0
12
P2.12CI[1]
Clear GPIO port Interrupts for P2.12.
0
13
P2.13CI[1]
Clear GPIO port Interrupts for P2.13.
0
Reserved.
NA
[1]
User manual
Reset
value
1
31:14 -
UM10360
Value Description
Not available on 80-pin package.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
148 of 849
UM10360
NXP Semiconductors
Chapter 9: LPC176x/5x General Purpose Input/Output (GPIO)
9.6 GPIO usage notes
9.6.1 Example: An instantaneous output of 0s and 1s on a GPIO port
Solution 1: using 32-bit (word) accessible fast GPIO registers
FIO0MASK = 0xFFFF00FF ;
FIO0PIN = 0x0000A500;
Solution 2: using 16-bit (half-word) accessible fast GPIO registers
FIO0MASKL = 0x00FF;
FIO0PINL = 0xA500;
Solution 3: using 8-bit (byte) accessible fast GPIO registers
FIO0PIN1 = 0xA5;
9.6.2 Writing to FIOSET/FIOCLR vs. FIOPIN
Writing to the FIOSET/FIOCLR registers allow a program to easily change a port’s output
pin(s) to both high and low levels at the same time. When FIOSET or FIOCLR are used,
only pin/bit(s) written with 1 will be changed, while those written as 0 will remain
unaffected.
Writing to the FIOPIN register enables instantaneous output of a desired value on the
parallel GPIO. Data written to the FIOPIN register will affect all pins configured as outputs
on that port: zeroes in the value will produce low level pin outputs and ones in the value
will produce high level pin outputs.
A subset of a port’s pins may be changed by using the FIOMASK register to define which
pins are affected. FIOMASK is set up to contain zeroes in bits corresponding to pins that
will be changed, and ones for all others. Solution 2 from Section 9.6.1 above illustrates
output of 0xA5 on PORT0 pins 15 to 8 while preserving all other PORT0 output pins as
they were before.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
149 of 849
UM10360
Chapter 10: LPC176x/5x Ethernet
Rev. 3.1 — 2 April 2014
User manual
10.1 Basic configuration
The Ethernet controller is configured using the following registers:
1. Power: In the PCONP register (Table 46), set bit PCENET.
Remark: On reset, the Ethernet block is disabled (PCENET = 0).
2. Clock: see Table 38.
3. Pins: Enable Ethernet pins through the PINSEL registers and select their modes
through the PINMODE registers, see Section 8.5.
4. Wake-up: Activity on the Ethernet port can wake up the microcontroller from
Power-down mode, see Section 4.8.8.
5. Interrupts: Interrupts are enabled in the NVIC using the appropriate Interrupt Set
Enable register.
6. Initialization: see Section 10.17.2.
10.2 Introduction
The Ethernet block contains a full featured 10 Mbps or 100 Mbps Ethernet MAC (Media
Access Controller) designed to provide optimized performance through the use of DMA
hardware acceleration. Features include a generous suite of control registers, half or full
duplex operation, flow control, control frames, hardware acceleration for transmit retry,
receive packet filtering and wake-up on LAN activity. Automatic frame transmission and
reception with Scatter-Gather DMA off-loads many operations from the CPU.
The Ethernet block is an AHB master that drives the AHB bus matrix. Through the matrix,
it has access to all on-chip RAM memories. A recommended use of RAM by the Ethernet
is to use one of the RAM blocks exclusively for Ethernet traffic. That RAM would then be
accessed only by the Ethernet and the CPU, and possibly the GPDMA, giving maximum
bandwidth to the Ethernet function.
The Ethernet block interfaces between an off-chip Ethernet PHY using the RMII (Reduced
Media Independent Interface) protocol and the on-chip MIIM (Media Independent
Interface Management) serial bus, also referred to as MDIO (Management Data
Input/Output).
Table 125. Ethernet acronyms, abbreviations, and definitions
UM10360
User manual
Acronym or
Abbreviation
Definition
AHB
Advanced High-performance bus
CRC
Cyclic Redundancy Check
DMA
Direct Memory Access
Double-word
64-bit entity
FCS
Frame Check Sequence (CRC)
Fragment
A (part of an) Ethernet frame; one or multiple fragments can add up to a single
Ethernet frame.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
150 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 125. Ethernet acronyms, abbreviations, and definitions …continued
Acronym or
Abbreviation
Definition
Frame
An Ethernet frame consists of destination address, source address, length
type field, payload and frame check sequence.
Half-word
16-bit entity
LAN
Local Area Network
MAC
Media Access Control sublayer
MII
Media Independent Interface
MIIM
MII management
Octet
An 8-bit data entity, used in lieu of "byte" by IEEE 802.3
Packet
A frame that is transported across Ethernet; a packet consists of a preamble,
a start of frame delimiter and an Ethernet frame.
PHY
Ethernet Physical Layer
RMII
Reduced MII
Rx
Receive
TCP/IP
Transmission Control Protocol / Internet Protocol. The most common
high-level protocol used with Ethernet.
Tx
Transmit
VLAN
Virtual LAN
WoL
Wake-up on LAN
Word
32-bit entity
10.3 Features
• Ethernet standards support:
– Supports 10 or 100 Mbps PHY devices including 10 Base-T, 100 Base-TX,
100 Base-FX, and 100 Base-T4.
– Fully compliant with IEEE standard 802.3.
– Fully compliant with 802.3x Full Duplex Flow Control and Half Duplex back
pressure.
– Flexible transmit and receive frame options.
– VLAN frame support.
• Memory management:
– Independent transmit and receive buffers memory mapped to shared SRAM.
– DMA managers with scatter/gather DMA and arrays of frame descriptors.
– Memory traffic optimized by buffering and prefetching.
• Enhanced Ethernet features:
– Receive filtering.
– Multicast and broadcast frame support for both transmit and receive.
– Optional automatic FCS insertion (CRC) for transmit.
– Selectable automatic transmit frame padding.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
151 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
– Over-length frame support for both transmit and receive allows any length frames.
– Promiscuous receive mode.
– Automatic collision backoff and frame retransmission.
– Includes power management by clock switching.
– Wake-on-LAN power management support allows system wake-up: using the
receive filters or a magic frame detection filter.
• Physical interface:
– Attachment of external PHY chip through a standard Reduced MII (RMII) interface.
– PHY register access is available via the Media Independent Interface Management
(MIIM) interface.
10.4 Architecture and operation
TRANSMIT
DMA
TRANSMIT
RETRY
RECEIVE
DMA
RECEIVE
BUFFER
R MII A DAP TER
TRANSMIT
FLOW
CONTROL
ETH ER N ET MAC
HOST
REGISTERS
ET HE RN ET PHY
DMA interface
(AHB master)
BU S
IN TER F ACE
register
interface (AHB
slave)
BUS IN T ERF AC E
AH B BU S
Figure 18 shows the internal architecture of the Ethernet block.
RMII
MIIM
RECEIVE
FILTER
ETHERNET
BLOCK
Fig 18. Ethernet block diagram
The block diagram for the Ethernet block consists of:
• The host registers module containing the registers in the software view and handling
AHB accesses to the Ethernet block. The host registers connect to the transmit and
receive data path as well as the MAC.
• The DMA to AHB interface. This provides an AHB master connection that allows the
Ethernet block to access on-chip SRAM for reading of descriptors, writing of status,
and reading and writing data buffers.
• The Ethernet MAC, which interfaces to the off-chip PHY via an RMII interface.
• The transmit data path, including:
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
152 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
– The transmit DMA manager which reads descriptors and data from memory and
writes status to memory.
– The transmit retry module handling Ethernet retry and abort situations.
– The transmit flow control module which can insert Ethernet pause frames.
• The receive data path, including:
– The receive DMA manager which reads descriptors from memory and writes data
and status to memory.
– The Ethernet MAC which detects frame types by parsing part of the frame header.
– The receive filter which can filter out certain Ethernet frames by applying different
filtering schemes.
– The receive buffer implementing a delay for receive frames to allow the filter to
filter out certain frames before storing them to memory.
10.5 DMA engine functions
The Ethernet block is designed to provide optimized performance via DMA hardware
acceleration. Independent scatter/gather DMA engines connected to the AHB bus off-load
many data transfers from the CPU.
Descriptors, which are stored in memory, contain information about fragments of incoming
or outgoing Ethernet frames. A fragment may be an entire frame or a much smaller
amount of data. Each descriptor contains a pointer to a memory buffer that holds data
associated with a fragment, the size of the fragment buffer, and details of how the
fragment will be transmitted or received.
Descriptors are stored in arrays in memory, which are located by pointer registers in the
Ethernet block. Other registers determine the size of the arrays, point to the next
descriptor in each array that will be used by the DMA engine, and point to the next
descriptor in each array that will be used by the Ethernet device driver.
10.6 Overview of DMA operation
The DMA engine makes use of a Receive descriptor array and a Transmit descriptor array
in memory. All or part of an Ethernet frame may be contained in a memory buffer
associated with a descriptor. When transmitting, the transmit DMA engine uses as many
descriptors as needed (one or more) to obtain (gather) all of the parts of a frame, and
sends them out in sequence. When receiving, the receive DMA engine also uses as many
descriptors as needed (one or more) to find places to store (scatter) all of the data in the
received frame.
The base address registers for the descriptor array, registers indicating the number of
descriptor array entries, and descriptor array input/output pointers are contained in the
Ethernet block. The descriptor entries and all transmit and receive packet data are stored
in memory which is not a part of the Ethernet block. The descriptor entries tell where
related frame data is stored in memory, certain aspects of how the data is handled, and
the result status of each Ethernet transaction.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
153 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Hardware in the DMA engine controls how data incoming from the Ethernet MAC is saved
to memory, causes fragment related status to be saved, and advances the hardware
receive pointer for incoming data. Driver software must handle the disposition of received
data, changing of descriptor data addresses (to avoid unnecessary data movement), and
advancing the software receive pointer. The two pointers create a circular queue in the
descriptor array and allow both the DMA hardware and the driver software to know which
descriptors (if any) are available for their use, including whether the descriptor array is
empty or full.
Similarly, driver software must set up pointers to data that will be transmitted by the
Ethernet MAC, giving instructions for each fragment of data, and advancing the software
transmit pointer for outgoing data. Hardware in the DMA engine reads this information and
sends the data to the Ethernet MAC interface when possible, updating the status and
advancing the hardware transmit pointer.
10.7 Ethernet Packet
Figure 19 illustrates the different fields in an Ethernet packet.
ethernet packet
PREAMBLE
7 bytes
ETHERNET FRAME
start-of-frame
delimiter
1 byte
DESTINATION
ADDRESS
SOURCE
ADDRESS
OPTIONAL
VLAN
LEN
TYPE
PAYLOAD
DesA
1st
octet
DesA
2nd
octet
DesA
3rd
octet
DesA
4th
octet
DesA
5th
octet
DesA
6th
octet
SrcA
1st
octet
SrcA
2nd
octet
LSB
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
MSB
bit 7
SrcA
3rd
octet
SrcA
4th
octet
FCS
SrcA
5th
octet
SrcA
6th
octet
time
Fig 19. Ethernet packet fields
A packet consists of a preamble, a start-of-frame delimiter and an Ethernet frame.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
154 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The Ethernet frame consists of the destination address, the source address, an optional
VLAN field, the length/type field, the payload and the frame check sequence.
Each address consists of 6 bytes where each byte consists of 8 bits. Bits are transferred
starting with the least significant bit.
10.8 Overview
10.8.1 Partitioning
The Ethernet block and associated device driver software offer the functionality of the
Media Access Control (MAC) sublayer of the data link layer in the OSI reference model
(see IEEE std 802.3). The MAC sublayer offers the service of transmitting and receiving
frames to the next higher protocol level, the MAC client layer, typically the Logical Link
Control sublayer. The device driver software implements the interface to the MAC client
layer. It sets up registers in the Ethernet block, maintains descriptor arrays pointing to
frames in memory and receives results back from the Ethernet block through interrupts.
When a frame is transmitted, the software partially sets up the Ethernet frames by
providing pointers to the destination address field, source address field, the length/type
field, the MAC client data field and optionally the CRC in the frame check sequence field.
Preferably concatenation of frame fields should be done by using the scatter/gather
functionality of the Ethernet core to avoid unnecessary copying of data. The hardware
adds the preamble and start frame delimiter fields and can optionally add the CRC, if
requested by software. When a packet is received the hardware strips the preamble and
start frame delimiter and passes the rest of the packet - the Ethernet frame - to the device
driver, including destination address, source address, length/type field, MAC client data
and frame check sequence (FCS).
Apart from the MAC, the Ethernet block contains receive and transmit DMA managers that
control receive and transmit data streams between the MAC and the AHB interface.
Frames are passed via descriptor arrays located in host memory, so that the hardware
can process many frames without software/CPU support. Frames can consist of multiple
fragments that are accessed with scatter/gather DMA. The DMA managers optimize
memory bandwidth using prefetching and buffering.
A receive filter block is used to identify received frames that are not addressed to this
Ethernet station, so that they can be discarded. The Rx filters include a perfect address
filter and a hash filter.
Wake-on-LAN power management support makes it possible to wake the system up from
a power-down state -a state in which some of the clocks are switched off -when wake-up
frames are received over the LAN. Wake-up frames are recognized by the receive filtering
modules or by a Magic Frame detection technology. System wake-up occurs by triggering
an interrupt.
An interrupt logic block raises and masks interrupts and keeps track of the cause of
interrupts. The interrupt block sends an interrupt request signal to the host system.
Interrupts can be enabled, cleared and set by software.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
155 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Support for IEEE 802.3/clause 31 flow control is implemented in the flow control block.
Receive flow control frames are automatically handled by the MAC. Transmit flow control
frames can be initiated by software. In half duplex mode, the flow control module will
generate back pressure by sending out continuous preamble only, interrupted by pauses
to prevent the jabber limit from being exceeded.
The Ethernet block has a standard Reduced Media Independent Interface (RMII) to
connect to an external Ethernet PHY chip. Registers in the PHY chip are accessed via the
AHB interface through the serial management connection of the MIIM bus, typically
operating at 2.5 MHz.
10.8.2 Example PHY Devices
Some examples of compatible PHY devices are shown in Table 126.
Table 126. Example PHY Devices
Manufacturer
Part Number(s)
Broadcom
BCM5221
ICS
ICS1893
Intel
LXT971A
LSI Logic
L80223, L80225, L80227
Micrel
KS8721
National
DP83847, DP83846, DP83843
SMSC
LAN83C185
10.9 Pin description
Table 127 shows the signals used for connecting the Reduced Media Independent
Interface (RMII) to the external PHY.
Table 127. Ethernet RMII pin descriptions
Pin Name
Type
Pin Description
ENET_TX_EN
Output
Transmit data enable
ENET_TXD[1:0]
Output
Transmit data, 2 bits
ENET_RXD[1:0]
Input
Receive data, 2 bits.
ENET_RX_ER
Input
Receive error.
ENET_CRS
Input
Carrier sense/data valid.
ENET_REF_CLK/
ENET_RX_CLK
Input
Reference clock
Table 128 shows the signals used for Media Independent Interface Management (MIIM) of
the external PHY.
Table 128. Ethernet MIIM pin descriptions
Pin Name
UM10360
User manual
Type
Pin Description
ENET_MDC
Output
MIIM clock.
ENET_MDIO
Input/Output
MI data input and output
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
156 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.10 Registers and software interface
The software interface of the Ethernet block consists of a register view and the format
definitions for the transmit and receive descriptors. These two aspects are addressed in
the next two subsections.
10.10.1 Register map
Table 129 lists the registers, register addresses and other basic information. The total
AHB address space required is 4 kilobytes.
After a hard reset or a soft reset via the RegReset bit of the Command register all bits in
all registers are reset to 0 unless stated otherwise in the following register descriptions.
Some registers will have unused bits which will return a 0 on a read via the AHB interface.
Writing to unused register bits of an otherwise writable register will not have side effects.
The register map consists of registers in the Ethernet MAC and registers around the core
for controlling DMA transfers, flow control and filtering.
Reading from reserved addresses or reserved bits leads to unpredictable data. Writing to
reserved addresses or reserved bits has no effect.
Reading of write-only registers will return a read error on the AHB interface. Writing of
read-only registers will return a write error on the AHB interface.
Table 129. Ethernet register definitions
Name
Description
Access
Reset Value
Address
MAC1
MAC configuration register 1.
R/W
0x8000
0x5000 0000
MAC2
MAC configuration register 2.
R/W
0
0x5000 0004
IPGT
Back-to-Back Inter-Packet-Gap register.
R/W
0
0x5000 0008
IPGR
Non Back-to-Back Inter-Packet-Gap register.
R/W
0
0x5000 000C
CLRT
Collision window / Retry register.
R/W
0x370F
0x5000 0010
MAXF
Maximum Frame register.
R/W
0x0600
0x5000 0014
SUPP
PHY Support register.
R/W
0
0x5000 0018
TEST
Test register.
R/W
0
0x5000 001C
MCFG
MII Mgmt Configuration register.
R/W
0
0x5000 0020
MCMD
MII Mgmt Command register.
R/W
0
0x5000 0024
MADR
MII Mgmt Address register.
R/W
0
0x5000 0028
MWTD
MII Mgmt Write Data register.
WO
0
0x5000 002C
MRDD
MII Mgmt Read Data register.
RO
0
0x5000 0030
MIND
MII Mgmt Indicators register.
RO
0
0x5000 0034
SA0
Station Address 0 register.
R/W
0
0x5000 0040
SA1
Station Address 1 register.
R/W
0
0x5000 0044
SA2
Station Address 2 register.
R/W
0
0x5000 0048
Command register.
R/W
0
0x5000 0100
MAC registers
Control registers
Command
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
157 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 129. Ethernet register definitions …continued
Name
Description
Access
Reset Value
Address
Status
Status register.
RO
0
0x5000 0104
RxDescriptor
Receive descriptor base address register.
R/W
0
0x5000 0108
RxStatus
Receive status base address register.
R/W
0
0x5000 010C
RxDescriptorNumber
Receive number of descriptors register.
R/W
0
0x5000 0110
RxProduceIndex
Receive produce index register.
RO
0
0x5000 0114
RxConsumeIndex
Receive consume index register.
R/W
0
0x5000 0118
TxDescriptor
Transmit descriptor base address register.
R/W
0
0x5000 011C
TxStatus
Transmit status base address register.
R/W
0
0x5000 0120
TxDescriptorNumber
Transmit number of descriptors register.
R/W
0
0x5000 0124
TxProduceIndex
Transmit produce index register.
R/W
0
0x5000 0128
TxConsumeIndex
Transmit consume index register.
RO
0
0x5000 012C
TSV0
Transmit status vector 0 register.
RO
0
0x5000 0158
TSV1
Transmit status vector 1 register.
RO
0
0x5000 015C
RSV
Receive status vector register.
RO
0
0x5000 0160
FlowControlCounter
Flow control counter register.
R/W
0
0x5000 0170
FlowControlStatus
Flow control status register.
RO
0
0x5000 0174
0
0x5000 0200
Rx filter registers
RxFliterCtrl
Receive filter control register.
RxFilterWoLStatus
Receive filter WoL status register.
0
0x5000 0204
RxFilterWoLClear
Receive filter WoL clear register.
0
0x5000 0208
HashFilterL
Hash filter table LSBs register.
0
0x5000 0210
HashFilterH
Hash filter table MSBs register.
0
0x5000 0214
Module control registers
IntStatus
Interrupt status register.
RO
0
0x5000 0FE0
IntEnable
Interrupt enable register.
R/W
0
0x5000 0FE4
IntClear
Interrupt clear register.
WO
0
0x5000 0FE8
IntSet
Interrupt set register.
WO
0
0x5000 0FEC
PowerDown
Power-down register.
R/W
0
0x5000 0FF4
The third column in the table lists the accessibility of the register: read-only, write-only,
read/write.
All AHB register write transactions except for accesses to the interrupt registers are
posted i.e. the AHB transaction will complete before write data is actually committed to the
register. Accesses to the interrupt registers will only be completed by accepting the write
data when the data has been committed to the register.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
158 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.11 Ethernet MAC register definitions
This section defines the bits in the individual registers of the Ethernet block register map.
10.11.1 MAC Configuration Register 1 (MAC1 - 0x5000 0000)
The MAC configuration register 1 (MAC1) has an address of 0x5000 0000. Its bit
definition is shown in Table 130.
Table 130. MAC Configuration register 1 (MAC1 - address 0x5000 0000) bit description
Bit
Symbol
Function
Reset
value
0
RECEIVE ENABLE
Set this to allow receive frames to be received. Internally the MAC synchronizes
this control bit to the incoming receive stream.
0
1
PASS ALL RECEIVE
FRAMES
When enabled (set to ’1’), the MAC will pass all frames regardless of type (normal
vs. Control). When disabled, the MAC does not pass valid Control frames.
0
2
RX FLOW CONTROL When enabled (set to ’1’), the MAC acts upon received PAUSE Flow Control
frames. When disabled, received PAUSE Flow Control frames are ignored.
0
3
TX FLOW CONTROL
When enabled (set to ’1’), PAUSE Flow Control frames are allowed to be
transmitted. When disabled, Flow Control frames are blocked.
0
4
LOOPBACK
Setting this bit will cause the MAC Transmit interface to be looped back to the MAC 0
Receive interface. Clearing this bit results in normal operation.
7:5
-
Unused
0x0
8
RESET TX
Setting this bit will put the Transmit Function logic in reset.
0
9
RESET MCS / TX
Setting this bit resets the MAC Control Sublayer / Transmit logic. The MCS logic
implements flow control.
0
10
RESET RX
Setting this bit will put the Ethernet receive logic in reset.
0
11
RESET MCS / RX
Setting this bit resets the MAC Control Sublayer / Receive logic. The MCS logic
implements flow control.
0x0
Reserved. User software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
0x0
13:12 14
SIMULATION RESET Setting this bit will cause a reset to the random number generator within the
Transmit Function.
0
15
SOFT RESET
Setting this bit will put all modules within the MAC in reset except the Host
Interface.
1
Reserved. User software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
0x0
31:16 -
10.11.2 MAC Configuration Register 2 (MAC2 - 0x5000 0004)
The MAC configuration register 2 (MAC2) has an address of 0x5000 0004. Its bit
definition is shown in Table 131.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
159 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 131. MAC Configuration register 2 (MAC2 - address 0x5000 0004) bit description
Bit
Symbol
Function
Reset
value
0
FULL-DUPLEX
When enabled (set to ’1’), the MAC operates in Full-Duplex mode. When disabled,
the MAC operates in Half-Duplex mode.
0
1
FRAME LENGTH
CHECKING
When enabled (set to ’1’), both transmit and receive frame lengths are compared to 0
the Length/Type field. If the Length/Type field represents a length then the check is
performed. Mismatches are reported in the StatusInfo word for each received frame.
2
HUGE FRAME
ENABLE
When enabled (set to ’1’), frames of any length are transmitted and received.
0
3
DELAYED CRC
This bit determines the number of bytes, if any, of proprietary header information
that exist on the front of IEEE 802.3 frames. When 1, four bytes of header (ignored
by the CRC function) are added. When 0, there is no proprietary header.
0
4
CRC ENABLE
Set this bit to append a CRC to every frame whether padding was required or not.
Must be set if PAD/CRC ENABLE is set. Clear this bit if frames presented to the
MAC contain a CRC.
0
5
PAD / CRC ENABLE
Set this bit to have the MAC pad all short frames. Clear this bit if frames presented 0
to the MAC have a valid length. This bit is used in conjunction with AUTO PAD
ENABLE and VLAN PAD ENABLE. See Table 133 - Pad Operation for details on the
pad function.
6
VLAN PAD ENABLE
Set this bit to cause the MAC to pad all short frames to 64 bytes and append a valid 0
CRC. Consult Table 133 - Pad Operation for more information on the various
padding features.
Note: This bit is ignored if PAD / CRC ENABLE is cleared.
7
AUTO DETECT PAD
ENABLE
Set this bit to cause the MAC to automatically detect the type of frame, either tagged 0
or un-tagged, by comparing the two octets following the source address with
0x8100 (VLAN Protocol ID) and pad accordingly. Table 133 - Pad Operation
provides a description of the pad function based on the configuration of this register.
Note: This bit is ignored if PAD / CRC ENABLE is cleared.
8
PURE PREAMBLE
ENFORCEMENT
When enabled (set to ’1’), the MAC will verify the content of the preamble to ensure 0
it contains 0x55 and is error-free. A packet with an incorrect preamble is discarded.
When disabled, no preamble checking is performed.
9
LONG PREAMBLE
ENFORCEMENT
When enabled (set to ’1’), the MAC only allows receive packets which contain
preamble fields less than 12 bytes in length. When disabled, the MAC allows any
length preamble as per the Standard.
0
11:10
-
Reserved. User software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
0x0
12
NO BACKOFF
When enabled (set to ’1’), the MAC will immediately retransmit following a collision
rather than using the Binary Exponential Backoff algorithm as specified in the
Standard.
0
13
BACK PRESSURE /
NO BACKOFF
When enabled (set to ’1’), after the MAC incidentally causes a collision during back 0
pressure, it will immediately retransmit without backoff, reducing the chance of
further collisions and ensuring transmit packets get sent.
14
EXCESS DEFER
When enabled (set to ’1’) the MAC will defer to carrier indefinitely as per the
Standard. When disabled, the MAC will abort when the excessive deferral limit is
reached.
0
31:15
-
Reserved. User software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
0x0
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
160 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 132. Pad operation
Type
Auto detect VLAN pad
pad enable enable
MAC2 [7]
MAC2 [6]
Pad/CRC
enable
MAC2 [5]
Action
Any
x
x
0
No pad or CRC check
Any
0
0
1
Pad to 60 bytes, append CRC
Any
x
1
1
Pad to 64 bytes, append CRC
Any
1
0
1
If untagged, pad to 60 bytes and append CRC. If VLAN tagged: pad to
64 bytes and append CRC.
10.11.3 Back-to-Back Inter-Packet-Gap Register (IPGT - 0x5000 0008)
The Back-to-Back Inter-Packet-Gap register (IPGT) has an address of 0x5000 0008. Its
bit definition is shown in Table 133.
Table 133. Back-to-back Inter-packet-gap register (IPGT - address 0x5000 0008) bit description
Bit
Symbol
Function
Reset
value
6:0
BACK-TO-BACK
INTER-PACKET-GAP
This is a programmable field representing the nibble time offset of the minimum
0x0
possible period between the end of any transmitted packet to the beginning of the
next. In Full-Duplex mode, the register value should be the desired period in
nibble times minus 3. In Half-Duplex mode, the register value should be the
desired period in nibble times minus 6. In Full-Duplex the recommended setting is
0x15 (21d), which represents the minimum IPG of 960 ns (in 100 Mbps mode) or
9.6 µs (in 10 Mbps mode). In Half-Duplex the recommended setting is 0x12 (18d),
which also represents the minimum IPG of 960 ns (in 100 Mbps mode) or 9.6 µs
(in 10 Mbps mode).
31:7
-
Reserved. User software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
0x0
10.11.4 Non Back-to-Back Inter-Packet-Gap Register (IPGR - 0x5000 000C)
The Non Back-to-Back Inter-Packet-Gap register (IPGR) has an address of 0x5000 000C.
Its bit definition is shown in Table 134.
Table 134. Non Back-to-back Inter-packet-gap register (IPGR - address 0x5000 000C) bit description
Bit
Symbol
Function
Reset
value
6:0
NON-BACK-TO-BACK
INTER-PACKET-GAP PART2
This is a programmable field representing the Non-Back-to-Back
Inter-Packet-Gap. The recommended value is 0x12 (18d), which
represents the minimum IPG of 960 ns (in 100 Mbps mode) or 9.6 µs (in
10 Mbps mode).
0x0
7
-
Reserved. User software should not write ones to reserved bits. The value 0x0
read from a reserved bit is not defined.
14:8
NON-BACK-TO-BACK
INTER-PACKET-GAP PART1
This is a programmable field representing the optional carrierSense
0x0
window referenced in IEEE 802.3/4.2.3.2.1 'Carrier Deference'. If carrier is
detected during the timing of IPGR1, the MAC defers to carrier. If,
however, carrier becomes active after IPGR1, the MAC continues timing
IPGR2 and transmits, knowingly causing a collision, thus ensuring fair
access to medium. Its range of values is 0x0 to IPGR2. The recommended
value is 0xC (12d)
31:15 -
UM10360
User manual
Reserved. User software should not write ones to reserved bits. The value 0x0
read from a reserved bit is not defined.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
161 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.11.5 Collision Window / Retry Register (CLRT - 0x5000 0010)
The Collision window / Retry register (CLRT) has an address of 0x5000 0010. Its bit
definition is shown in Table 135.
Table 135. Collision Window / Retry register (CLRT - address 0x5000 0010) bit description
Bit
Symbol
Function
Reset
value
3:0
RETRANSMISSION
MAXIMUM
This is a programmable field specifying the number of retransmission attempts
following a collision before aborting the packet due to excessive collisions. The
Standard specifies the attemptLimit to be 0xF (15d). See IEEE 802.3/4.2.3.2.5.
0xF
7:4
-
Reserved. User software should not write ones to reserved bits. The value read from 0x0
a reserved bit is not defined.
13:8
COLLISION
WINDOW
This is a programmable field representing the slot time or collision window during
which collisions occur in properly configured networks. The default value of 0x37
(55d) represents a 56 byte window following the preamble and SFD.
31:14
-
Reserved, user software should not write ones to reserved bits. The value read from NA
a reserved bit is not defined.
0x37
10.11.6 Maximum Frame Register (MAXF - 0x5000 0014)
The Maximum Frame register (MAXF) has an address of 0x5000 0014. Its bit definition is
shown in Table 136.
Table 136. Maximum Frame register (MAXF - address 0x5000 0014) bit description
Bit
Symbol
Function
Reset
value
15:0
MAXIMUM FRAME This field resets to the value 0x0600, which represents a maximum receive frame of 0x0600
LENGTH
1536 octets. An untagged maximum size Ethernet frame is 1518 octets. A tagged
frame adds four octets for a total of 1522 octets. If a shorter maximum length
restriction is desired, program this 16-bit field.
31:16
-
Unused
0x0
10.11.7 PHY Support Register (SUPP - 0x5000 0018)
The PHY Support register (SUPP) has an address of 0x5000 0018. The SUPP register
provides additional control over the RMII interface. The bit definition of this register is
shown in Table 137.
Table 137. PHY Support register (SUPP - address 0x5000 0018) bit description
Bit
Symbol
Function
Reset
value
7:0
-
Unused
0x0
8
SPEED
This bit configures the Reduced MII logic for the current operating speed. When set, 0
100 Mbps mode is selected. When cleared, 10 Mbps mode is selected.
31:9
-
Unused
0x0
Unused bits in the PHY support register should be left as zeroes.
10.11.8 Test Register (TEST - 0x5000 001C)
The Test register (TEST) has an address of 0x5000 001C. The bit definition of this register
is shown in Table 138. These bits are used for testing purposes only.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
162 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 138. Test register (TEST - address 0x5000 ) bit description
Bit
Symbol
Function
Reset
value
0
SHORTCUT PAUSE
QUANTA
This bit reduces the effective PAUSE quanta from 64 byte-times to 1 byte-time.
0
1
TEST PAUSE
This bit causes the MAC Control sublayer to inhibit transmissions, just as if a
0
PAUSE Receive Control frame with a nonzero pause time parameter was received.
2
TEST
BACKPRESSURE
Setting this bit will cause the MAC to assert backpressure on the link. Backpressure 0
causes preamble to be transmitted, raising carrier sense. A transmit packet from the
system will be sent during backpressure.
31:3
-
Unused
0x0
10.11.9 MII Mgmt Configuration Register (MCFG - 0x5000 0020)
The MII Mgmt Configuration register (MCFG) has an address of 0x5000 0020. The bit
definition of this register is shown in Table 139.
Table 139. MII Mgmt Configuration register (MCFG - address 0x5000 0020) bit description
Bit
Symbol
Function
Reset
value
0
SCAN INCREMENT
Set this bit to cause the MII Management hardware to perform read cycles across a 0
range of PHYs. When set, the MII Management hardware will perform read cycles
from address 1 through the value set in PHY ADDRESS[4:0]. Clear this bit to allow
continuous reads of the same PHY.
1
SUPPRESS
PREAMBLE
Set this bit to cause the MII Management hardware to perform read/write cycles
without the 32-bit preamble field. Clear this bit to cause normal cycles to be
performed. Some PHYs support suppressed preamble.
5:2
CLOCK SELECT
0
This field is used by the clock divide logic in creating the MII Management Clock
(MDC) which IEEE 802.3u defines to be no faster than 2.5 MHz. Some PHYs
support clock rates up to 12.5 MHz, however. The AHB bus clock (HCLK) is divided
by the specified amount. Refer to Table 140 below for the definition of values for this
field.
0
14:6
-
Unused
0x0
15
RESET MII MGMT
This bit resets the MII Management hardware.
0
31:16
-
Unused
0x0
Table 140. Clock select encoding
UM10360
User manual
Clock Select
Bit 5
Bit 4
Bit 3
Bit 2
Maximum AHB
clock supported
Host Clock divided by 4
0
0
0
x
10
Host Clock divided by 6
0
0
1
0
15
Host Clock divided by 8
0
0
1
1
20
Host Clock divided by 10
0
1
0
0
25
Host Clock divided by 14
0
1
0
1
35
Host Clock divided by 20
0
1
1
0
50
Host Clock divided by 28
0
1
1
1
70
Host Clock divided by 36
1
0
0
0
80[1]
Host Clock divided by 40
1
0
0
1
90[1]
Host Clock divided by 44
1
0
1
0
100[1]
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
163 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 140. Clock select encoding
Clock Select
Bit 5
Bit 4
Bit 3
Bit 2
Maximum AHB
clock supported
Host Clock divided by 48
1
0
1
1
120[1]
Host Clock divided by 52
1
1
0
0
130[1]
Host Clock divided by 56
1
1
0
1
140[1]
Host Clock divided by 60
1
1
1
0
150[1]
Host Clock divided by 64
1
1
1
1
160[1]
[1]
The maximum AHB clock rate allowed is limited to the maximum CPU clock rate for the device.
10.11.10 MII Mgmt Command Register (MCMD - 0x5000 0024)
The MII Mgmt Command register (MCMD) has an address of 0x5000 0024. The bit
definition of this register is shown in Table 141.
Table 141. MII Mgmt Command register (MCMD - address 0x5000 0024) bit description
Bit
Symbol Function
Reset
value
0
READ
This bit causes the MII Management hardware to perform a single Read cycle. The Read data is 0
returned in Register MRDD (MII Mgmt Read Data).
1
SCAN
This bit causes the MII Management hardware to perform Read cycles continuously. This is
useful for monitoring Link Fail for example.
0
31:2
-
Unused
0x0
10.11.11 MII Mgmt Address Register (MADR - 0x5000 0028)
The MII Mgmt Address register (MADR) has an address of 0x5000 0028. The bit definition
of this register is shown in Table 142.
Table 142. MII Mgmt Address register (MADR - address 0x5000 0028) bit description
Bit
Symbol
Function
Reset
value
4:0
REGISTER
ADDRESS
This field represents the 5-bit Register Address field of Mgmt
cycles. Up to 32 registers can be accessed.
0x0
7:5
-
Unused
0x0
12:8
PHY ADDRESS
This field represents the 5-bit PHY Address field of Mgmt
cycles. Up to 31 PHYs can be addressed (0 is reserved).
0x0
31:13
-
Unused
0x0
10.11.12 MII Mgmt Write Data Register (MWTD - 0x5000 002C)
The MII Mgmt Write Data register (MWTD) is a write-only register with an address of
0x5000 002C. The bit definition of this register is shown in Table 143.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
164 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 143. MII Mgmt Write Data register (MWTD - address 0x5000 002C) bit description
Bit
Symbol
Function
Reset
value
15:0
WRITE
DATA
When written, an MII Mgmt write cycle is performed using the 16-bit
data and the pre-configured PHY and Register addresses from the
MII Mgmt Address register (MADR).
0x0
31:16
-
Unused
0x0
10.11.13 MII Mgmt Read Data Register (MRDD - 0x5000 0030)
The MII Mgmt Read Data register (MRDD) is a read-only register with an address of
0x5000 0030. The bit definition of this register is shown in Table 144.
Table 144. MII Mgmt Read Data register (MRDD - address 0x5000 0030) bit description
Bit
Symbol
Function
Reset
value
15:0
READ
DATA
Following an MII Mgmt Read Cycle, the 16-bit data can be read from
this location.
0x0
31:16
-
Unused
0x0
10.11.14 MII Mgmt Indicators Register (MIND - 0x5000 0034)
The MII Mgmt Indicators register (MIND) is a read-only register with an address of
0x5000 0034. The bit definition of this register is shown in Table 145.
Table 145. MII Mgmt Indicators register (MIND - address 0x5000 0034) bit description
Bit
Symbol
Function
Reset
value
0
BUSY
When ’1’ is returned - indicates MII Mgmt is currently performing an 0
MII Mgmt Read or Write cycle.
1
SCANNING When ’1’ is returned - indicates a scan operation (continuous MII
Mgmt Read cycles) is in progress.
0
2
NOT VALID
When ’1’ is returned - indicates MII Mgmt Read cycle has not
completed and the Read Data is not yet valid.
0
3
MII Link Fail When ’1’ is returned - indicates that an MII Mgmt link fail has
occurred.
0
31:4
-
0x0
Unused
Here are two examples to access PHY via the MII Management Controller.
For PHY Write if scan is not used:
1. Write 0 to MCMD
2. Write PHY address and register address to MADR
3. Write data to MWTD
4. Wait for busy bit to be cleared in MIND
For PHY Read if scan is not used:
1. Write 1 to MCMD
2. Write PHY address and register address to MADR
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
165 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
3. Wait for busy bit to be cleared in MIND
4. Write 0 to MCMD
5. Read data from MRDD
10.11.15 Station Address 0 Register (SA0 - 0x5000 0040)
The Station Address 0 register (SA0) has an address of 0x5000 0040. The bit definition of
this register is shown in Table 146.
Table 146. Station Address register (SA0 - address 0x5000 0040) bit description
Bit
Symbol
Function
Reset
value
7:0
STATION ADDRESS, This field holds the second octet of the station address.
2nd octet
0x0
15:8
STATION ADDRESS, This field holds the first octet of the station address.
1st octet
0x0
31:16
-
0x0
Unused
The station address is used for perfect address filtering and for sending pause control
frames. For the ordering of the octets in the packet please refer to Figure 19.
10.11.16 Station Address 1 Register (SA1 - 0x5000 0044)
The Station Address 1 register (SA1) has an address of 0x5000 0044. The bit definition of
this register is shown in Table 147.
Table 147. Station Address register (SA1 - address 0x5000 0044) bit description
Bit
Symbol
Function
Reset
value
7:0
STATION ADDRESS, This field holds the fourth octet of the station address.
4th octet
0x0
15:8
STATION ADDRESS, This field holds the third octet of the station address.
3rd octet
0x0
31:16
-
0x0
Unused
The station address is used for perfect address filtering and for sending pause control
frames. For the ordering of the octets in the packet please refer to Figure 19.
10.11.17 Station Address 2 Register (SA2 - 0x5000 0048)
The Station Address 2 register (SA2) has an address of 0x5000 0048. The bit definition of
this register is shown in Table 148.
Table 148. Station Address register (SA2 - address 0x5000 0048) bit description
UM10360
User manual
Bit
Symbol
Function
7:0
STATION ADDRESS, This field holds the sixth octet of the station address.
6th octet
0x0
15:8
STATION ADDRESS, This field holds the fifth octet of the station address.
5th octet
0x0
31:16
-
0x0
Unused
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Reset
value
© NXP B.V. 2014. All rights reserved.
166 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The station address is used for perfect address filtering and for sending pause control
frames. For the ordering of the octets in the packet please refer to Figure 19.
10.12 Control register definitions
10.12.1 Command Register (Command - 0x5000 0100)
The Command register (Command) register has an address of 0x5000 0100. Its bit
definition is shown in Table 149.
Table 149. Command register (Command - address 0x5000 0100) bit description
Bit
Symbol
Function
Reset
value
0
RxEnable
Enable receive.
0
1
TxEnable
Enable transmit.
0
2
-
Unused
0x0
3
RegReset
When a ’1’ is written, all datapaths and the host registers are
reset. The MAC needs to be reset separately.
0
4
TxReset
When a ’1’ is written, the transmit datapath is reset.
0
5
RxReset
When a ’1’ is written, the receive datapath is reset.
0
6
PassRuntFrame
When set to ’1’, passes runt frames smaller than 64 bytes to
memory unless they have a CRC error. If ’0’ runt frames are
filtered out.
0
7
PassRxFilter
When set to ’1’, disables receive filtering i.e. all frames
received are written to memory.
0
8
TxFlowControl
Enable IEEE 802.3 / clause 31 flow control sending pause
frames in full duplex and continuous preamble in half duplex.
0
9
RMII
When set to “1”, RMII mode is selected. This bit must be set to 0
one during Ethernet initialization. See Section 10.17.2.
10
FullDuplex
When set to “1”, indicates full duplex operation.
0
31:11
-
Unused
0x0
All bits can be written and read. The Tx/RxReset bits are write-only, reading will return a 0.
10.12.2 Status Register (Status - 0x5000 0104)
The Status register (Status) is a read-only register with an address of 0x5000 0104. Its bit
definition is shown in Table 150.
Table 150. Status register (Status - address 0x5000 0104) bit description
Bit
Symbol
Function
0
RxStatus If 1, the receive channel is active. If 0, the receive channel is inactive.
1
TxStatus If 1, the transmit channel is active. If 0, the transmit channel is inactive. 0
31:2
-
Unused
Reset
value
0
0x0
The values represent the status of the two channels/data paths. When the status is 1, the
channel is active, meaning:
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
167 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
• It is enabled and the Rx/TxEnable bit is set in the Command register or it just got
disabled while still transmitting or receiving a frame.
• Also, for the transmit channel, the transmit queue is not empty
i.e. ProduceIndex != ConsumeIndex.
• Also, for the receive channel, the receive queue is not full
i.e. ProduceIndex != ConsumeIndex - 1.
The status transitions from active to inactive if the channel is disabled by a software reset
of the Rx/TxEnable bit in the Command register and the channel has committed the status
and data of the current frame to memory. The status also transitions to inactive if the
transmit queue is empty or if the receive queue is full and status and data have been
committed to memory.
10.12.3 Receive Descriptor Base Address Register (RxDescriptor 0x5000 0108)
The Receive Descriptor base address register (RxDescriptor) has an address of
0x5000 0108. Its bit definition is shown in Table 151.
Table 151. Receive Descriptor Base Address register (RxDescriptor - address 0x5000 0108)
bit description
Bit
Symbol
Function
Reset
value
1:0
31:2
-
Fixed to ’00’
-
RxDescriptor
MSBs of receive descriptor base address.
0x0
The receive descriptor base address is a byte address aligned to a word boundary i.e.
LSB 1:0 are fixed to “00”. The register contains the lowest address in the array of
descriptors.
10.12.4 Receive Status Base Address Register (RxStatus - 0x5000 010C)
The receive descriptor base address is a byte address aligned to a word boundary i.e.
LSB 1:0 are fixed to “00”. The register contains the lowest address in the array of
descriptors.
Table 152. receive Status Base Address register (RxStatus - address 0x5000 010C) bit
description
Bit
Symbol
Function
Reset
value
2:0
-
Fixed to ’000’
-
31:3
RxStatus
MSBs of receive status base address.
0x0
The receive status base address is a byte address aligned to a double word boundary i.e.
LSB 2:0 are fixed to “000”.
10.12.5 Receive Number of Descriptors Register (RxDescriptor - 0x5000 0110)
The Receive Number of Descriptors register (RxDescriptorNumber) has an address of
0x5000 0110. Its bit definition is shown in Table 153.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
168 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 153. Receive Number of Descriptors register (RxDescriptor - address 0x5000 0110) bit
description
Bit
Symbol
Function
Reset
value
15:0
RxDescriptorNumber
Number of descriptors in the descriptor array for which
RxDescriptor is the base address. The number of
descriptors is minus one encoded.
0x0
31:16
-
Unused
0x0
The receive number of descriptors register defines the number of descriptors in the
descriptor array for which RxDescriptor is the base address. The number of descriptors
should match the number of statuses. The register uses minus one encoding i.e. if the
array has 8 elements, the value in the register should be 7.
10.12.6 Receive Produce Index Register (RxProduceIndex - 0x5000 0114)
The Receive Produce Index register (RxProduceIndex) is a read-only register with an
address of 0x5000 0114. Its bit definition is shown in Table 154.
Table 154. Receive Produce Index register (RxProduceIndex - address 0x5000 0114) bit
description
Bit
Symbol
Function
Reset
value
15:0
RxProduceIndex Index of the descriptor that is going to be filled next by the
receive datapath.
0x0
31:16
-
0x0
Unused
The receive produce index register defines the descriptor that is going to be filled next by
the hardware receive process. After a frame has been received, hardware increments the
index. The value is wrapped to 0 once the value of RxDescriptorNumber has been
reached. If the RxProduceIndex equals RxConsumeIndex - 1, the array is full and any
further frames being received will cause a buffer overrun error.
10.12.7 Receive Consume Index Register (RxConsumeIndex - 0x5000 0118)
The Receive consume index register (RxConsumeIndex) has an address of 0x5000 0118.
Its bit definition is shown in Table 155.
Table 155. Receive Consume Index register (RxConsumeIndex - address 0x5000 0118) bit
description
Bit
Symbol
Function
15:0
RxConsumeIndex Index of the descriptor that is going to be processed next by
the receive
31:16
-
Unused
Reset
value
0x0
The receive consume register defines the descriptor that is going to be processed next by
the software receive driver. The receive array is empty as long as RxProduceIndex equals
RxConsumeIndex. As soon as the array is not empty, software can process the frame
pointed to by RxConsumeIndex. After a frame has been processed by software, software
should increment the RxConsumeIndex. The value must be wrapped to 0 once the value
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
169 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
of RxDescriptorNumber has been reached. If the RxProduceIndex equals
RxConsumeIndex - 1, the array is full and any further frames being received will cause a
buffer overrun error.
10.12.8 Transmit Descriptor Base Address Register (TxDescriptor 0x5000 011C)
The Transmit Descriptor base address register (TxDescriptor) has an address of
0x5000 011C. Its bit definition is shown in Table 156.
Table 156. Transmit Descriptor Base Address register (TxDescriptor - address 0x5000 011C)
bit description
Bit
Symbol
Function
Reset
value
1:0
-
Fixed to ’00’
-
31:2
TxDescriptor
MSBs of transmit descriptor base address.
0x0
The transmit descriptor base address is a byte address aligned to a word boundary i.e.
LSB 1:0 are fixed to “00”. The register contains the lowest address in the array of
descriptors.
10.12.9 Transmit Status Base Address Register (TxStatus - 0x5000 0120)
The Transmit Status base address register (TxStatus) has an address of 0x5000 0120. Its
bit definition is shown in Table 157.
Table 157. Transmit Status Base Address register (TxStatus - address 0x5000 0120) bit
description
Bit
Symbol
Function
Reset
value
1:0
-
Fixed to ’00’
-
31:2
TxStatus
MSBs of transmit status base address.
0x0
The transmit status base address is a byte address aligned to a word boundary i.e. LSB
1:0 are fixed to “00”. The register contains the lowest address in the array of statuses.
10.12.10 Transmit Number of Descriptors Register (TxDescriptorNumber 0x5000 0124)
The Transmit Number of Descriptors register (TxDescriptorNumber) has an address of
0x5000 0124. Its bit definition is shown in Table 158.
Table 158. Transmit Number of Descriptors register (TxDescriptorNumber - address
0x5000 0124) bit description
UM10360
User manual
Bit
Symbol
Function
15:0
TxDescriptorNumber
Number of descriptors in the descriptor array for which
TxDescriptor is the base address. The register is minus
one encoded.
31:16
-
Unused
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Reset
value
0x0
© NXP B.V. 2014. All rights reserved.
170 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The transmit number of descriptors register defines the number of descriptors in the
descriptor array for which TxDescriptor is the base address. The number of descriptors
should match the number of statuses. The register uses minus one encoding i.e. if the
array has 8 elements, the value in the register should be 7.
10.12.11 Transmit Produce Index Register (TxProduceIndex - 0x5000 0128)
The Transmit Produce Index register (TxProduceIndex) has an address of 0x5000 0128.
Its bit definition is shown in Table 159.
Table 159. Transmit Produce Index register (TxProduceIndex - address 0x5000 0128) bit
description
Bit
Symbol
Function
Reset
value
15:0
TxProduceIndex Index of the descriptor that is going to be filled next by the
transmit software driver.
0x0
31:16
-
0x0
Unused
The transmit produce index register defines the descriptor that is going to be filled next by
the software transmit driver. The transmit descriptor array is empty as long as
TxProduceIndex equals TxConsumeIndex. If the transmit hardware is enabled, it will start
transmitting frames as soon as the descriptor array is not empty. After a frame has been
processed by software, it should increment the TxProduceIndex. The value must be
wrapped to 0 once the value of TxDescriptorNumber has been reached. If the
TxProduceIndex equals TxConsumeIndex - 1 the descriptor array is full and software
should stop producing new descriptors until hardware has transmitted some frames and
updated the TxConsumeIndex.
10.12.12 Transmit Consume Index Register (TxConsumeIndex - 0x5000 012C)
The Transmit Consume Index register (TxConsumeIndex) is a read-only register with an
address of 0x5000 012C. Its bit definition is shown in Table 160.
Table 160. Transmit Consume Index register (TxConsumeIndex - address 0x5000 012C) bit
description
Bit
Symbol
Function
15:0
TxConsumeIndex Index of the descriptor that is going to be transmitted next by
the transmit datapath.
0x0
31:16
-
0x0
Unused
Reset
value
The transmit consume index register defines the descriptor that is going to be transmitted
next by the hardware transmit process. After a frame has been transmitted hardware
increments the index, wrapping the value to 0 once the value of TxDescriptorNumber has
been reached. If the TxConsumeIndex equals TxProduceIndex the descriptor array is
empty and the transmit channel will stop transmitting until software produces new
descriptors.
10.12.13 Transmit Status Vector 0 Register (TSV0 - 0x5000 0158)
The Transmit Status Vector 0 register (TSV0) is a read-only register with an address of
0x5000 0158. The transmit status vector registers store the most recent transmit status
returned by the MAC. Since the status vector consists of more than 4 bytes, status is
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
171 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
distributed over two registers TSV0 and TSV1. These registers are provided for debug
purposes, because the communication between driver software and the Ethernet block
takes place primarily through the frame descriptors. The status register contents are valid
as long as the internal status of the MAC is valid and should typically only be read when
the transmit and receive processes are halted.
Table 161 lists the bit definitions of the TSV0 register.
Table 161. Transmit Status Vector 0 register (TSV0 - address 0x5000 0158) bit description
Bit
Symbol
Function
Reset
value
0
CRC error
The attached CRC in the packet did not match the
internally generated CRC.
0
1
Length check error
Indicates the frame length field does not match the actual
number of data items and is not a type field.
0
2
Length out of range[1] Indicates that frame type/length field was larger than
1500 bytes.
3
Done
Transmission of packet was completed.
0
4
Multicast
Packet’s destination was a multicast address.
0
5
Broadcast
Packet’s destination was a broadcast address.
0
6
Packet Defer
Packet was deferred for at least one attempt, but less than 0
an excessive defer.
7
Excessive Defer
Packet was deferred in excess of 6071 nibble times in
100 Mbps or 24287 bit times in 10 Mbps mode.
8
Excessive Collision
Packet was aborted due to exceeding of maximum allowed 0
number of collisions.
9
Late Collision
Collision occurred beyond collision window, 512 bit times.
0
10
Giant
Byte count in frame was greater than can be represented
in the transmit byte count field in TSV1.
0
11
Underrun
Host side caused buffer underrun.
0
27:12
Total bytes
The total number of bytes transferred including collided
attempts.
0x0
28
Control frame
The frame was a control frame.
0
29
Pause
The frame was a control frame with a valid PAUSE
opcode.
0
30
Backpressure
Carrier-sense method backpressure was previously
applied.
0
31
VLAN
Frame’s length/type field contained 0x8100 which is the
VLAN protocol identifier.
0
[1]
0
0
The EMAC doesn't distinguish the frame type and frame length, so, e.g. when the IP(0x8000) or
ARP(0x0806) packets are received, it compares the frame type with the max length and gives the "Length
out of range" error. In fact, this bit is not an error indication, but simply a statement by the chip regarding the
status of the received frame.
10.12.14 Transmit Status Vector 1 Register (TSV1 - 0x5000 015C)
The Transmit Status Vector 1 register (TSV1) is a read-only register with an address of
0x5000 015C. The transmit status vector registers store the most recent transmit status
returned by the MAC. Since the status vector consists of more than 4 bytes, status is
distributed over two registers TSV0 and TSV1. These registers are provided for debug
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
172 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
purposes, because the communication between driver software and the Ethernet block
takes place primarily through the frame descriptors. The status register contents are valid
as long as the internal status of the MAC is valid and should typically only be read when
the transmit and receive processes are halted.Table 162 lists the bit definitions of the
TSV1 register.
Table 162. Transmit Status Vector 1 register (TSV1 - address 0x5000 015C) bit description
Bit
Symbol
Function
Reset
value
15:0
Transmit byte count
The total number of bytes in the frame, not counting the
collided bytes.
0x0
19:16
Transmit collision
count
Number of collisions the current packet incurred during
0x0
transmission attempts. The maximum number of collisions
(16) cannot be represented.
31:20
-
Unused
0x0
10.12.15 Receive Status Vector Register (RSV - 0x5000 0160)
The Receive status vector register (RSV) is a read-only register with an address of
0x5000 0160. The receive status vector register stores the most recent receive status
returned by the MAC. This register is provided for debug purposes, because the
communication between driver software and the Ethernet block takes place primarily
through the frame descriptors. The status register contents are valid as long as the
internal status of the MAC is valid and should typically only be read when the transmit and
receive processes are halted.
Table 163 lists the bit definitions of the RSV register.
Table 163. Receive Status Vector register (RSV - address 0x5000 0160) bit
description
UM10360
User manual
Bit
Symbol
Function
Reset
value
15:0
Received byte count
Indicates length of received frame.
0x0
16
Packet previously
ignored
Indicates that a packet was dropped.
0
17
RXDV event
previously seen
Indicates that the last receive event seen was not long
enough to be a valid packet.
0
18
Carrier event
previously seen
Indicates that at some time since the last receive statistics, 0
a carrier event was detected.
19
Receive code
violation
Indicates that received PHY data does not represent a
valid receive code.
0
20
CRC error
The attached CRC in the packet did not match the
internally generated CRC.
0
21
Length check error
Indicates the frame length field does not match the actual
number of data items and is not a type field.
0
22
Length out of range[1] Indicates that frame type/length field was larger than
1518 bytes.
0
23
Receive OK
The packet had valid CRC and no symbol errors.
0
24
Multicast
The packet destination was a multicast address.
0
25
Broadcast
The packet destination was a broadcast address.
0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
173 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 163. Receive Status Vector register (RSV - address 0x5000 0160) bit
description …continued
Bit
Symbol
Function
26
Dribble Nibble
Indicates that after the end of packet another 1-7 bits were 0
received. A single nibble, called dribble nibble, is formed
but not sent out.
27
Control frame
The frame was a control frame.
0
28
PAUSE
The frame was a control frame with a valid PAUSE
opcode.
0
29
Unsupported Opcode The current frame was recognized as a Control Frame but 0
contains an unknown opcode.
30
VLAN
Frame’s length/type field contained 0x8100 which is the
VLAN protocol identifier.
0
31
-
Unused
0x0
[1]
Reset
value
The EMAC doesn't distinguish the frame type and frame length, so, e.g. when the IP(0x8000) or
ARP(0x0806) packets are received, it compares the frame type with the max length and gives the "Length
out of range" error. In fact, this bit is not an error indication, but simply a statement by the chip regarding the
status of the received frame.
10.12.16 Flow Control Counter Register (FlowControlCounter - 0x5000 0170)
The Flow Control Counter register (FlowControlCounter) has an address of 0x5000 0170.
Table 164 lists the bit definitions of the register.
Table 164. Flow Control Counter register (FlowControlCounter - address 0x5000 0170) bit
description
Bit
Symbol
Function
Reset
value
15:0
MirrorCounter
In full duplex mode the MirrorCounter specifies the number 0x0
of cycles before re-issuing the Pause control frame.
31:16
PauseTimer
In full-duplex mode the PauseTimer specifies the value
that is inserted into the pause timer field of a pause flow
control frame. In half duplex mode the PauseTimer
specifies the number of backpressure cycles.
0x0
10.12.17 Flow Control Status Register (FlowControlStatus - 0x5000 0174)
The Flow Control Status register (FlowControlStatus) is a read-only register with an
address of 0x5000 0174. Table 165 lists the bit definitions of the register.
Table 165. Flow Control Status register (FlowControlStatus - address 0x5000 0174) bit
description
UM10360
User manual
Bit
Symbol
Function
15:0
MirrorCounterCurrent In full duplex mode this register represents the current
0x0
value of the datapath’s mirror counter which counts up to
the value specified by the MirrorCounter field in the
FlowControlCounter register. In half duplex mode the
register counts until it reaches the value of the PauseTimer
bits in the FlowControlCounter register.
31:16
-
Unused
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
Reset
value
0x0
© NXP B.V. 2014. All rights reserved.
174 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.13 Receive filter register definitions
10.13.1 Receive Filter Control Register (RxFilterCtrl - 0x5000 0200)
The Receive Filter Control register (RxFilterCtrl) has an address of 0x5000 0200.
Table 166 lists the definition of the individual bits in the register.
Table 166. Receive Filter Control register (RxFilterCtrl - address 0x5000 0200) bit description
Bit
Symbol
Function
Reset
value
0
AcceptUnicastEn
When set to ’1’, all unicast frames are accepted.
0
1
AcceptBroadcastEn
When set to ’1’, all broadcast frames are accepted.
0
2
AcceptMulticastEn
When set to ’1’, all multicast frames are accepted.
0
3
AcceptUnicastHashEn
When set to ’1’, unicast frames that pass the imperfect 0
hash filter are accepted.
4
AcceptMulticastHashEn
When set to ’1’, multicast frames that pass the
imperfect hash filter are accepted.
0
5
AcceptPerfectEn
When set to ’1’, the frames with a destination address
identical to the
0
station address are accepted.
11:6
-
Reserved, user software should not write ones to
NA
reserved bits. The value read from a reserved bit is not
defined.
12
MagicPacketEnWoL
When set to ’1’, the result of the magic packet filter will 0
generate a WoL interrupt when there is a match.
13
RxFilterEnWoL
When set to ’1’, the result of the perfect address
matching filter and the imperfect hash filter will
generate a WoL interrupt when there is a match.
0
Unused
0x0
31:14 -
10.13.2 Receive Filter WoL Status Register (RxFilterWoLStatus - 0x5000 0204)
The Receive Filter Wake-up on LAN Status register (RxFilterWoLStatus) is a read-only
register with an address of 0x5000 0204.
Table 167 lists the definition of the individual bits in the register.
Table 167. Receive Filter WoL Status register (RxFilterWoLStatus - address 0x5000 0204) bit
description
UM10360
User manual
Bit
Symbol
Function
Reset
value
0
1
AcceptUnicastWoL
When the value is ’1’, a unicast frames caused WoL.
0
AcceptBroadcastWoL
When the value is ’1’, a broadcast frame caused WoL.
0
2
AcceptMulticastWoL
When the value is ’1’, a multicast frame caused WoL.
0
3
AcceptUnicastHashWoL
When the value is ’1’, a unicast frame that passes the
imperfect hash filter caused WoL.
0
4
AcceptMulticastHashWoL When the value is ’1’, a multicast frame that passes the
imperfect hash filter caused WoL.
5
AcceptPerfectWoL
0
When the value is ’1’, the perfect address matching filter 0
caused WoL.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
175 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 167. Receive Filter WoL Status register (RxFilterWoLStatus - address 0x5000 0204) bit
description …continued
Bit
Symbol
Function
Reset
value
6
-
Unused
0x0
7
RxFilterWoL
When the value is ’1’, the receive filter caused WoL.
0
8
MagicPacketWoL
When the value is ’1’, the magic packet filter caused
WoL.
0
Unused
0x0
31:9 -
The bits in this register record the cause for a WoL. Bits in RxFilterWoLStatus can be
cleared by writing the RxFilterWoLClear register.
10.13.3 Receive Filter WoL Clear Register (RxFilterWoLClear - 0x5000 0208)
The Receive Filter Wake-up on LAN Clear register (RxFilterWoLClear) is a write-only
register with an address of 0x5000 0208.
Table 168 lists the definition of the individual bits in the register.
Table 168. Receive Filter WoL Clear register (RxFilterWoLClear - address 0x5000 0208) bit
description
Bit
Symbol
Function
Reset
value
When a ’1’ is written to one of these bits (0 to 5), the
corresponding status bit in the RxFilterWoLStatus
register is cleared.
0
AcceptUnicastWoLClr
1
AcceptBroadcastWoLClr
2
AcceptMulticastWoLClr
3
AcceptUnicastHashWoLClr
0
4
AcceptMulticastHashWoLClr
0
5
AcceptPerfectWoLClr
0
6
-
Unused
7
RxFilterWoLClr
8
MagicPacketWoLClr
When a ’1’ is written to one of these bits (7 and/or 8), 0
the corresponding status bit in the RxFilterWoLStatus 0
register is cleared.
31:9 -
0
0
0
0x0
Unused
0x0
The bits in this register are write-only; writing resets the corresponding bits in the
RxFilterWoLStatus register.
10.13.4 Hash Filter Table LSBs Register (HashFilterL - 0x5000 0210)
The Hash Filter table LSBs register (HashFilterL) has an address of 0x5000 0210.
Table 169 lists the bit definitions of the register. Details of Hash filter table use can be
found in Section 10.17.10 “Receive filtering” on page 207.
Table 169. Hash Filter Table LSBs register (HashFilterL - address 0x5000 0210) bit
description
UM10360
User manual
Bit
Symbol
Function
Reset
value
31:0
HashFilterL
Bits 31:0 of the imperfect filter hash table for receive
filtering.
0x0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
176 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.13.5 Hash Filter Table MSBs Register (HashFilterH - 0x5000 0214)
The Hash Filter table MSBs register (HashFilterH) has an address of 0x5000 0214.
Table 170 lists the bit definitions of the register. Details of Hash filter table use can be
found in Section 10.17.10 “Receive filtering” on page 207.
Table 170. Hash Filter MSBs register (HashFilterH - address 0x5000 0214) bit description
Bit
Symbol
Function
Reset
value
31:0
HashFilterH
Bits 63:32 of the imperfect filter hash table for receive
filtering.
0x0
10.14 Module control register definitions
10.14.1 Interrupt Status Register (IntStatus - 0x5000 0FE0)
The Interrupt Status register (IntStatus) is a read-only register with an address of
0x5000 0FE0. The interrupt status register bit definition is shown in Table 171. Note that
all bits are flip-flops with an asynchronous set in order to be able to generate interrupts if
there are wake-up events while clocks are disabled.
Table 171. Interrupt Status register (IntStatus - address 0x5000 0FE0) bit description
UM10360
User manual
Bit
Symbol
Function
Reset
value
0
RxOverrunInt
Interrupt set on a fatal overrun error in the receive queue. The
0
fatal interrupt should be resolved by a Rx soft-reset. The bit is not
set when there is a nonfatal overrun error.
1
RxErrorInt
Interrupt trigger on receive errors: AlignmentError, RangeError,
0
LengthError, SymbolError, CRCError or NoDescriptor or Overrun.
2
RxFinishedInt
Interrupt triggered when all receive descriptors have been
processed i.e. on the transition to the situation where
ProduceIndex == ConsumeIndex.
3
RxDoneInt
Interrupt triggered when a receive descriptor has been processed 0
while the Interrupt bit in the Control field of the descriptor was set.
4
TxUnderrunInt Interrupt set on a fatal underrun error in the transmit queue. The 0
fatal interrupt should be resolved by a Tx soft-reset. The bit is not
set when there is a nonfatal underrun error.
5
TxErrorInt
Interrupt trigger on transmit errors: LateCollision,
ExcessiveCollision and ExcessiveDefer, NoDescriptor or
Underrun.
0
6
TxFinishedInt
Interrupt triggered when all transmit descriptors have been
processed i.e. on the transition to the situation where
ProduceIndex == ConsumeIndex.
0
7
TxDoneInt
Interrupt triggered when a descriptor has been transmitted while
the Interrupt bit in the Control field of the descriptor was set.
0
0
11:8
-
Unused
0x0
12
SoftInt
Interrupt triggered by software writing a 1 to the SoftintSet bit in
the IntSet register.
0
13
WakeupInt
Interrupt triggered by a Wake-up event detected by the receive
filter.
0
31:14
-
Unused
0x0
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
177 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The interrupt status register is read-only. Setting can be done via the IntSet register. Reset
can be accomplished via the IntClear register.
10.14.2 Interrupt Enable Register (IntEnable - 0x5000 0FE4)
The Interrupt Enable register (IntEnable) has an address of 0x5000 0FE4. The interrupt
enable register bit definition is shown in Table 172.
Table 172. Interrupt Enable register (intEnable - address 0x5000 0FE4) bit description
Bit
Symbol
Function
Reset
value
0
RxOverrunIntEn
Enable for interrupt trigger on receive buffer overrun or
descriptor underrun situations.
0
1
RxErrorIntEn
Enable for interrupt trigger on receive errors.
0
2
RxFinishedIntEn
Enable for interrupt triggered when all receive descriptors have 0
been processed i.e. on the transition to the situation where
ProduceIndex == ConsumeIndex.
3
RxDoneIntEn
Enable for interrupt triggered when a receive descriptor has
0
been processed while the Interrupt bit in the Control field of the
descriptor was set.
4
TxUnderrunIntEn Enable for interrupt trigger on transmit buffer or descriptor
underrun situations.
0
5
TxErrorIntEn
Enable for interrupt trigger on transmit errors.
0
6
TxFinishedIntEn
Enable for interrupt triggered when all transmit descriptors
have been processed i.e. on the transition to the situation
where ProduceIndex == ConsumeIndex.
0
7
TxDoneIntEn
Enable for interrupt triggered when a descriptor has been
transmitted while the Interrupt bit in the Control field of the
descriptor was set.
0
11:8
-
Unused
0x0
12
SoftIntEn
Enable for interrupt triggered by the SoftInt bit in the IntStatus
register, caused by software writing a 1 to the SoftIntSet bit in
the IntSet register.
0
13
WakeupIntEn
Enable for interrupt triggered by a Wake-up event detected by
the receive filter.
0
31:14
-
Unused
0x0
10.14.3 Interrupt Clear Register (IntClear - 0x5000 0FE8)
The Interrupt Clear register (IntClear) is a write-only register with an address of
0x5000 0FE8. The interrupt clear register bit definition is shown in Table 173.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
178 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 173. Interrupt Clear register (IntClear - address 0x5000 0FE8) bit description
Bit
Symbol
Function
Reset
value
0
RxOverrunIntClr
0
1
RxErrorIntClr
2
RxFinishedIntClr
Writing a ’1’ to one of these bits clears (0 to 7) the
corresponding status bit in interrupt status register
IntStatus.
0
0
3
RxDoneIntClr
0
4
TxUnderrunIntClr
0
5
TxErrorIntClr
0
6
TxFinishedIntClr
0
7
TxDoneIntClr
11:8
-
Unused
0x0
12
SoftIntClr
0
13
WakeupIntClr
Writing a ’1’ to one of these bits (12 and/or 13) clears the
corresponding status bit in interrupt status register
IntStatus.
0
31:14
-
Unused
0x0
0
The interrupt clear register is write-only. Writing a 1 to a bit of the IntClear register clears
the corresponding bit in the status register. Writing a 0 will not affect the interrupt status.
10.14.4 Interrupt Set Register (IntSet - 0x5000 0FEC)
The Interrupt Set register (IntSet) is a write-only register with an address of 0x5000 0FEC.
The interrupt set register bit definition is shown in Table 174.
Table 174. Interrupt Set register (IntSet - address 0x5000 0FEC) bit description
Bit
Symbol
Function
Reset
value
Writing a ’1’ to one of these bits (0 to 7) sets the
corresponding status bit in interrupt status register
IntStatus.
0
0
RxOverrunIntSet
1
RxErrorIntSet
2
RxFinishedIntSet
3
RxDoneIntSet
4
TxUnderrunIntSet
0
5
TxErrorIntSet
0
6
TxFinishedIntSet
0
7
TxDoneIntSet
0
11:8
-
Unused
0x0
12
SoftIntSet
0
13
WakeupIntSet
Writing a ’1’ to one of these bits (12 and/or 13) sets the
corresponding status bit in interrupt status register
IntStatus.
31:14
-
Unused
0x0
0
0
0
0
The interrupt set register is write-only. Writing a 1 to a bit of the IntSet register sets the
corresponding bit in the status register. Writing a 0 will not affect the interrupt status.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
179 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.14.5 Power-Down Register (PowerDown - 0x5000 0FF4)
The Power-Down register (PowerDown) is used to block all AHB accesses except
accesses to the Power-Down register. The register has an address of 0x5000 0FF4. The
bit definition of the register is listed in Table 175.
Table 175. Power-Down register (PowerDown - address 0x5000 0FF4) bit description
Bit
Symbol
Function
Reset
value
30:0
-
Unused
0x0
31
PowerDownMACAHB
If true, all AHB accesses will return a read/write error,
except accesses to the Power-Down register.
0
Setting the bit will return an error on all read and write accesses on the MACAHB interface
except for accesses to the Power-Down register.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
180 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.15 Descriptor and status formats
This section defines the descriptor format for the transmit and receive scatter/gather DMA
engines. Each Ethernet frame can consist of one or more fragments. Each fragment
corresponds to a single descriptor. The DMA managers in the Ethernet block scatter (for
receive) and gather (for transmit) multiple fragments for a single Ethernet frame.
10.15.1 Receive descriptors and statuses
Figure 20 depicts the layout of the receive descriptors in memory.
RxDescriptor
RxStatus
PACKET
1
DATA BUFFER
CONTROL
PACKET
2
StatusHashCRC
DATA BUFFER
CONTROL
PACKET
3
PACKET
DATA BUFFER
PACKET
DATA BUFFER
PACKET
StatusInfo
StatusHashCRC
DATA BUFFER
CONTROL
RxDescriptorNumber
StatusInfo
StatusHashCRC
CONTROL
5
StatusInfo
StatusHashCRC
CONTROL
4
StatusInfo
StatusInfo
StatusHashCRC
DATA BUFFER
CONTROL
StatusInfo
StatusHashCRC
Fig 20. Receive descriptor memory layout
Receive descriptors are stored in an array in memory. The base address of the array is
stored in the RxDescriptor register, and should be aligned on a 4 byte address boundary.
The number of descriptors in the array is stored in the RxDescriptorNumber register using
a minus one encoding style e.g. if the array has 8 elements the register value should be 7.
Parallel to the descriptors there is an array of statuses. For each element of the descriptor
array there is an associated status field in the status array. The base address of the status
array is stored in the RxStatus register, and must be aligned on an 8 byte address
boundary. During operation (when the receive data path is enabled) the RxDescriptor,
RxStatus and RxDescriptorNumber registers should not be modified.
Two registers, RxConsumeIndex and RxProduceIndex, define the descriptor locations
that will be used next by hardware and software. Both registers act as counters starting at
0 and wrapping when they reach the value of RxDescriptorNumber. The RxProduceIndex
contains the index of the descriptor that is going to be filled with the next frame being
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
181 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
received. The RxConsumeIndex is programmed by software and is the index of the next
descriptor that the software receive driver is going to process. When RxProduceIndex ==
RxConsumeIndex, the receive buffer is empty. When RxProduceIndex ==
RxConsumeIndex -1 (taking wraparound into account), the receive buffer is full and newly
received data would generate an overflow unless the software driver frees up one or more
descriptors.
Each receive descriptor takes two word locations (8 bytes) in memory. Likewise each
status field takes two words (8 bytes) in memory. Each receive descriptor consists of a
pointer to the data buffer for storing receive data (Packet) and a control word (Control).
The Packet field has a zero address offset, the control field has a 4 byte address offset
with respect to the descriptor address as defined in Table 176.
Table 176. Receive Descriptor Fields
Symbol
Address Bytes Description
offset
Packet
0x0
4
Base address of the data buffer for storing receive data.
Control
0x4
4
Control information, see Table 177.
The data buffer pointer (Packet) is a 32-bit, byte aligned address value containing the
base address of the data buffer. The definition of the control word bits is listed in
Table 177.
Table 177. Receive Descriptor Control Word
Bit
Symbol
Description
10:0
Size
Size in bytes of the data buffer. This is the size of the buffer reserved by the
device driver for a frame or frame fragment i.e. the byte size of the buffer
pointed to by the Packet field. The size is -1 encoded e.g. if the buffer is 8
bytes the size field should be equal to 7.
30:11 -
Unused
31
If true generate an RxDone interrupt when the data in this frame or frame
fragment and the associated status information has been committed to
memory.
Interrupt
Table 178 lists the fields in the receive status elements from the status array.
Table 178. Receive Status Fields
Symbol
Address Bytes Description
offset
StatusInfo
0x0
4
Receive status return flags, see Table 180.
StatusHashCRC 0x4
4
The concatenation of the destination address hash CRC and
the source address hash CRC.
Each receive status consists of two words. The StatusHashCRC word contains a
concatenation of the two 9-bit hash CRCs calculated from the destination and source
addresses contained in the received frame. After detecting the destination and source
addresses, StatusHashCRC is calculated once, then held for every fragment of the same
frame.
The concatenation of the two CRCs is shown in Table 179:
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
182 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Table 179. Receive Status HashCRC Word
Bit
Symbol
Description
8:0
SAHashCRC Hash CRC calculated from the source address.
15:9
-
Unused
24:16 DAHashCRC Hash CRC calculated from the destination address.
31:25 -
Unused
The StatusInfo word contains flags returned by the MAC and flags generated by the
receive data path reflecting the status of the reception. Table 180 lists the bit definitions in
the StatusInfo word.
Table 180. Receive status information word
UM10360
User manual
Bit
Symbol
Description
10:0
RxSize
The size in bytes of the actual data transferred into one fragment buffer. In
other words, this is the size of the frame or fragment as actually written by
the DMA manager for one descriptor. This may be different from the Size
bits of the Control field in the descriptor that indicate the size of the buffer
allocated by the device driver. Size is -1 encoded e.g. if the buffer has
8 bytes the RxSize value will be 7.
17:11 -
Unused
18
Indicates this is a control frame for flow control, either a pause frame or a
frame with an unsupported opcode.
ControlFrame
19
VLAN
Indicates a VLAN frame.
20
FailFilter
Indicates this frame has failed the Rx filter. These frames will not normally
pass to memory. But due to the limitation of the size of the buffer, part of
this frame may already be passed to memory. Once the frame is found to
have failed the Rx filter, the remainder of the frame will be discarded
without being passed to the memory. However, if the PassRxFilter bit in
the Command register is set, the whole frame will be passed to memory.
21
Multicast
Set when a multicast frame is received.
22
Broadcast
Set when a broadcast frame is received.
23
CRCError
The received frame had a CRC error.
24
SymbolError
The PHY reports a bit error over the PHY interface during reception.
25
LengthError
The frame length field value in the frame specifies a valid length, but does
not match the actual data length.
26
RangeError[1]
The received packet exceeds the maximum packet size.
27
AlignmentError An alignment error is flagged when dribble bits are detected and also a
CRC error is detected. This is in accordance with IEEE std. 802.3/clause
4.3.2.
28
Overrun
Receive overrun. The adapter can not accept the data stream.
29
NoDescriptor
No new Rx descriptor is available and the frame is too long for the buffer
size in the current receive descriptor.
30
LastFlag
When set to 1, indicates this descriptor is for the last fragment of a frame.
If the frame consists of a single fragment, this bit is also set to 1.
31
Error
An error occurred during reception of this frame. This is a logical OR of
AlignmentError, RangeError, LengthError, SymbolError, CRCError, and
Overrun.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
183 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
[1]
The EMAC doesn't distinguish the frame type and frame length, so, e.g. when the IP(0x8000) or
ARP(0x0806) packets are received, it compares the frame type with the max length and gives the "Range"
error. In fact, this bit is not an error indication, but simply a statement by the chip regarding the status of the
received frame.
For multi-fragment frames, the value of the AlignmentError, RangeError, LengthError,
SymbolError and CRCError bits in all but the last fragment in the frame will be 0; likewise
the value of the FailFilter, Multicast, Broadcast, VLAN and ControlFrame bits is undefined.
The status of the last fragment in the frame will copy the value for these bits from the
MAC. All fragment statuses will have valid LastFrag, RxSize, Error, Overrun and
NoDescriptor bits.
10.15.2 Transmit descriptors and statuses
Figure 21 depicts the layout of the transmit descriptors in memory.
TxDescriptor
TxStatus
PACKET
1
DATA BUFFER
StatusInfo
CONTROL
PACKET
2
DATA BUFFER
StatusInfo
CONTROL
PACKET
3
DATA BUFFER
StatusInfo
CONTROL
PACKET
4
DATA BUFFER
StatusInfo
CONTROL
PACKET
5
DATA BUFFER
StatusInfo
CONTROL
TxDescriptorNumber
PACKET
DATA BUFFER
StatusInfo
CONTROL
Fig 21. Transmit descriptor memory layout
Transmit descriptors are stored in an array in memory. The lowest address of the transmit
descriptor array is stored in the TxDescriptor register, and must be aligned on a 4 byte
address boundary. The number of descriptors in the array is stored in the
TxDescriptorNumber register using a minus one encoding style i.e. if the array has 8
elements the register value should be 7. Parallel to the descriptors there is an array of
statuses. For each element of the descriptor array there is an associated status field in the
status array. The base address of the status array is stored in the TxStatus register, and
must be aligned on a 4 byte address boundary. During operation (when the transmit data
path is enabled) the TxDescriptor, TxStatus, and TxDescriptorNumber registers should
not be modified.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
184 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Two registers, TxConsumeIndex and TxProduceIndex, define the descriptor locations that
will be used next by hardware and software. Both register act as counters starting at 0 and
wrapping when they reach the value of TxDescriptorNumber. The TxProduceIndex
contains the index of the next descriptor that is going to be filled by the software driver.
The TxConsumeIndex contains the index of the next descriptor going to be transmitted by
the hardware. When TxProduceIndex == TxConsumeIndex, the transmit buffer is empty.
When TxProduceIndex == TxConsumeIndex -1 (taking wraparound into account), the
transmit buffer is full and the software driver cannot add new descriptors until the
hardware has transmitted one or more frames to free up descriptors.
Each transmit descriptor takes two word locations (8 bytes) in memory. Likewise each
status field takes one word (4 bytes) in memory. Each transmit descriptor consists of a
pointer to the data buffer containing transmit data (Packet) and a control word (Control).
The Packet field has a zero address offset, whereas the control field has a 4 byte address
offset, see Table 181.
Table 181. Transmit descriptor fields
Symbol
Address offset
Bytes
Description
Packet
0x0
4
Base address of the data buffer containing transmit data.
Control
0x4
4
Control information, see Table 182.
The data buffer pointer (Packet) is a 32-bit, byte aligned address value containing the
base address of the data buffer. The definition of the control word bits is listed in
Table 182.
Table 182. Transmit descriptor control word
Bit
Symbol
Description
10:0
Size
Size in bytes of the data buffer. This is the size of the frame or fragment as it
needs to be fetched by the DMA manager. In most cases it will be equal to the
byte size of the data buffer pointed to by the Packet field of the descriptor. Size
is -1 encoded e.g. a buffer of 8 bytes is encoded as the Size value 7.
25:11 -
Unused
26
Override
Per frame override. If true, bits 30:27 will override the defaults from the MAC
internal registers. If false, bits 30:27 will be ignored and the default values
from the MAC will be used.
27
Huge
If true, enables huge frame, allowing unlimited frame sizes. When false,
prevents transmission of more than the maximum frame length (MAXF[15:0]).
28
Pad
If true, pad short frames to 64 bytes.
29
CRC
If true, append a hardware CRC to the frame.
30
Last
If true, indicates that this is the descriptor for the last fragment in the transmit
frame. If false, the fragment from the next descriptor should be appended.
31
Interrupt
If true, a TxDone interrupt will be generated when the data in this frame or
frame fragment has been sent and the associated status information has been
committed to memory.
Table 183 shows the one field transmit status.
Table 183. Transmit status fields
UM10360
User manual
Symbol
Address
offset
Bytes
Description
StatusInfo
0x0
4
Transmit status return flags, see Table 184.
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
185 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The transmit status consists of one word which is the StatusInfo word. It contains flags
returned by the MAC and flags generated by the transmit data path reflecting the status of
the transmission. Table 184 lists the bit definitions in the StatusInfo word.
Table 184. Transmit status information word
Bit
Symbol
20:0
-
Description
Unused
24:21 CollisionCount
The number of collisions this packet incurred, up to the
Retransmission Maximum.
25
Defer
This packet incurred deferral, because the medium was occupied.
This is not an error unless excessive deferral occurs.
26
ExcessiveDefer
This packet incurred deferral beyond the maximum deferral limit and
was aborted.
27
ExcessiveCollision Indicates this packet exceeded the maximum collision limit and was
aborted.
28
LateCollision
An Out of window Collision was seen, causing packet abort.
29
Underrun
A Tx underrun occurred due to the adapter not producing transmit
data.
30
NoDescriptor
The transmit stream was interrupted because a descriptor was not
available.
31
Error
An error occurred during transmission. This is a logical OR of
Underrun, LateCollision, ExcessiveCollision, and ExcessiveDefer.
For multi-fragment frames, the value of the LateCollision, ExcessiveCollision,
ExcessiveDefer, Defer and CollissionCount bits in all but the last fragment in the frame will
be 0. The status of the last fragment in the frame will copy the value for these bits from the
MAC. All fragment statuses will have valid Error, NoDescriptor and Underrun bits.
10.16 Ethernet block functional description
This section defines the functions of the DMA capable 10/100 Ethernet MAC. After
introducing the DMA concepts of the Ethernet block, and a description of the basic
transmit and receive functions, this section elaborates on advanced features such as flow
control, receive filtering, etc.
10.16.1 Overview
The Ethernet block can transmit and receive Ethernet packets from an off-chip Ethernet
PHY connected through the RMII interface.
Typically during system start-up, the Ethernet block will be initialized. Software
initialization of the Ethernet block should include initialization of the descriptor and status
arrays as well as the receiver fragment buffers.
Remark: When initializing the Ethernet block, it is important to first configure the PHY and
ensure that reference clocks (ENET_REF_CLK signal in RMII mode, or both
ENET_RX_CLK and ENET_TX_CLK signals in MII mode) are present at the external pins
and connected to the EMAC module (selecting the appropriate pins using the PINSEL
registers) prior to continuing with Ethernet configuration. Otherwise the CPU can become
locked and no further functionality will be possible. This will cause JTAG lose
communication with the target, if debug mode is being used.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
186 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
To transmit a packet the software driver has to set up the appropriate Control registers
and a descriptor to point to the packet data buffer before transferring the packet to
hardware by incrementing the TxProduceIndex register. After transmission, hardware will
increment TxConsumeIndex and optionally generate an interrupt.
The hardware will receive packets from the PHY and apply filtering as configured by the
software driver. While receiving a packet the hardware will read a descriptor from memory
to find the location of the associated receiver data buffer. Receive data is written in the
data buffer and receive status is returned in the receive descriptor status word. Optionally
an interrupt can be generated to notify software that a packet has been received. Note
that the DMA manager will prefetch and buffer up to three descriptors.
10.16.2 AHB interface
The registers of the Ethernet block connect to an AHB slave interface to allow access to
the registers from the CPU.
The AHB interface has a 32-bit data path, which supports only word accesses and has an
address aperture of 4 kB. Table 129 lists the registers of the Ethernet block.
All AHB write accesses to registers are posted except for accesses to the IntSet, IntClear
and IntEnable registers. AHB write operations are executed in order.
If the PowerDown bit of the PowerDown register is set, all AHB read and write accesses
will return a read or write error except for accesses to the PowerDown register.
Bus Errors
The Ethernet block generates errors for several conditions:
• The AHB interface will return a read error when there is an AHB read access to a
write-only register; likewise a write error is returned when there is an AHB write
access to the read-only register. An AHB read or write error will be returned on AHB
read or write accesses to reserved registers. These errors are propagated back to the
CPU. Registers defined as read-only and write-only are identified in Table 129.
• If the PowerDown bit is set all accesses to AHB registers will result in an error
response except for accesses to the PowerDown register.
10.17 Interrupts
The Ethernet block has a single interrupt request output to the CPU (via the NVIC).
The interrupt service routine must read the IntStatus register to determine the origin of the
interrupt. All interrupt statuses can be set by software writing to the IntSet register;
statuses can be cleared by software writing to the IntClear register.
The transmit and receive data paths can only set interrupt statuses, they cannot clear
statuses. The SoftInt interrupt cannot be set by hardware and can be used by software for
test purposes.
10.17.1 Direct Memory Access (DMA)
Descriptor arrays
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
187 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The Ethernet block includes two DMA managers. The DMA managers make it possible to
transfer frames directly to and from memory with little support from the processor and
without the need to trigger an interrupt for each frame.
The DMA managers work with arrays of frame descriptors and statuses that are stored in
memory. The descriptors and statuses act as an interface between the Ethernet hardware
and the device driver software. There is one descriptor array for receive frames and one
descriptor array for transmit frames. Using buffering for frame descriptors, the memory
traffic and memory bandwidth utilization of descriptors can be kept small.
Each frame descriptor contains two 32-bit fields: the first field is a pointer to a data buffer
containing a frame or a fragment, whereas the second field is a control word related to
that frame or fragment.
The software driver must write the base addresses of the descriptor and status arrays in
the TxDescriptor/RxDescriptor and TxStatus/RxStatus registers. The number of
descriptors/statuses in each array must be written in the
TxDescriptorNumber/RxDescriptorNumber registers. The number of descriptors in an
array corresponds to the number of statuses in the associated status array.
Transmit descriptor arrays, receive descriptor arrays and transmit status arrays must be
aligned on a 4 byte (32bit)address boundary, while the receive status array must be
aligned on a 8 byte (64bit) address boundary.
Ownership of descriptors
Both device driver software and Ethernet hardware can read and write the descriptor
arrays at the same time in order to produce and consume descriptors. A descriptor is
"owned" either by the device driver or by the Ethernet hardware. Only the owner of a
descriptor reads or writes its value. Typically, the sequence of use and ownership of
descriptors and statuses is as follows: a descriptor is owned and set up by the device
driver; ownership of the descriptor/status is passed by the device driver to the Ethernet
block, which reads the descriptor and writes information to the status field; the Ethernet
block passes ownership of the descriptor back to the device driver, which uses the status
information and then recycles the descriptor to be used for another frame. Software must
pre-allocate the memory used to hold the descriptor arrays.
Software can hand over ownership of descriptors and statuses to the hardware by
incrementing (and wrapping if on the array boundary) the
TxProduceIndex/RxConsumeIndex registers. Hardware hands over descriptors and
status to software by updating the TxConsumeIndex/ RxProduceIndex registers.
After handing over a descriptor to the receive and transmit DMA hardware, device driver
software should not modify the descriptor or reclaim the descriptor by decrementing the
TxProduceIndex/ RxConsumeIndex registers because descriptors may have been
prefetched by the hardware. In this case the device driver software will have to wait until
the frame has been transmitted or the device driver has to soft-reset the transmit and/or
receive data paths which will also reset the descriptor arrays.
Sequential order with wrap-around
When descriptors are read from and statuses are written to the arrays, this is done in
sequential order with wrap-around. Sequential order means that when the Ethernet block
has finished reading/writing a descriptor/status, the next descriptor/status it reads/writes is
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
188 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
the one at the next higher, adjacent memory address. Wrap around means that when the
Ethernet block has finished reading/writing the last descriptor/status of the array (with the
highest memory address), the next descriptor/status it reads/writes is the first
descriptor/status of the array at the base address of the array.
Full and Empty state of descriptor arrays
The descriptor arrays can be empty, partially full or full. A descriptor array is empty when
all descriptors are owned by the producer. A descriptor array is partially full if both
producer and consumer own part of the descriptors and both are busy processing those
descriptors. A descriptor array is full when all descriptors (except one) are owned by the
consumer, so that the producer has no more room to process frames. Ownership of
descriptors is indicated with the use of a consume index and a produce index. The
produce index is the first element of the array owned by the producer. It is also the index
of the array element that is next going to be used by the producer of frames (it may
already be busy using it and subsequent elements). The consume index is the first
element of the array that is owned by the consumer. It is also the number of the array
element next to be consumed by the consumer of frames (it and subsequent elements
may already be in the process of being consumed). If the consume index and the produce
index are equal, the descriptor array is empty and all array elements are owned by the
producer. If the consume index equals the produce index plus one, then the array is full
and all array elements (except the one at the produce index) are owned by the consumer.
With a full descriptor array, still one array element is kept empty, to be able to easily
distinguish the full or empty state by looking at the value of the produce index and
consume index. An array must have at least 2 elements to be able to indicate a full
descriptor array with a produce index of value 0 and a consume index of value 1. The
wrap around of the arrays is taken into account when determining if a descriptor array is
full, so a produce index that indicates the last element in the array and a consume index
that indicates the first element in the array, also means the descriptor array is full. When
the produce index and the consume index are unequal and the consume index is not the
produce index plus one (with wrap around taken into account), then the descriptor array is
partially full and both the consumer and producer own enough descriptors to be able to
operate actively on the descriptor array.
Interrupt bit
The descriptors have an Interrupt bit, which is programmed by software. When the
Ethernet block is processing a descriptor and finds this bit set, it will allow triggering an
interrupt (after committing status to memory) by passing the RxDoneInt or TxDoneInt bits
in the IntStatus register to the interrupt output pin. If the Interrupt bit is not set in the
descriptor, then the RxDoneInt or TxDoneInt are not set and no interrupt is triggered (note
that the corresponding bits in IntEnable must also be set to trigger interrupts). This offers
flexible ways of managing the descriptor arrays. For instance, the device driver could add
10 frames to the Tx descriptor array, and set the Interrupt bit in descriptor number 5 in the
descriptor array. This would invoke the interrupt service routine before the transmit
descriptor array is completely exhausted. The device driver could add another batch of
frames to the descriptor array, without interrupting continuous transmission of frames.
Frame fragments
For maximum flexibility in frame storage, frames can be split up into multiple frame
fragments with fragments located in different places in memory. In this case one
descriptor is used for each frame fragment. So, a descriptor can point to a single frame or
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
189 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
to a fragment of a frame. By using fragments, scatter/gather DMA can be done: transmit
frames are gathered from multiple fragments in memory and receive frames can be
scattered to multiple fragments in memory.
By stringing together fragments it is possible to create large frames from small memory
areas. Another use of fragments is to be able to locate a frame header and frame payload
in different places and to concatenate them without copy operations in the device driver.
For transmissions, the Last bit in the descriptor Control field indicates if the fragment is the
last in a frame; for receive frames, the LastFrag bit in the StatusInfo field of the status
words indicates if the fragment is the last in the frame. If the Last(Frag) bit is 0 the next
descriptor belongs to the same Ethernet frame, If the Last(Frag) bit is 1 the next descriptor
is a new Ethernet frame.
10.17.2 Initialization
After reset, the Ethernet software driver needs to initialize the Ethernet block. During
initialization the software needs to:
• Remove the soft reset condition from the MAC
• Configure the PHY via the MIIM interface of the MAC.
Remark: it is important to configure the PHY and insure that reference clocks
(ENET_REF_CLK signal in RMII mode, or both ENET_RX_CLK and ENET_TX_CLK
signals in MII mode) are present at the external pins and connected to the EMAC
module (selecting the appropriate pins using the PINSEL registers) prior to continuing
with Ethernet configuration. Otherwise the CPU can become locked and no further
functionality will be possible. This will cause JTAG lose communication with the target,
if debug mode is being used.
•
•
•
•
Select RMII mode
Configure the transmit and receive DMA engines, including the descriptor arrays
Configure the host registers (MAC1,MAC2 etc.) in the MAC
Enable the receive and transmit data paths
Depending on the PHY, the software needs to initialize registers in the PHY via the MII
Management interface. The software can read and write PHY registers by programming
the MCFG, MCMD, MADR registers of the MAC. Write data should be written to the
MWTD register; read data and status information can be read from the MRDD and MIND
registers.
The Ethernet block supports RMII PHYs. During initialization software must select RMII
mode by programming the Command register.
Before switching to RMII mode the default soft reset (MAC1 register bit 15) has to be
de-asserted. The phy_ref_clk must be running and internally connected during this
operation.
Transmit and receive DMA engines should be initialized by the device driver by allocating
the descriptor and status arrays in memory. Transmit and receive functions have their own
dedicated descriptor and status arrays. The base addresses of these arrays need to be
programmed in the TxDescriptor/TxStatus and RxDescriptor/RxStatus registers. The
number of descriptors in an array matches the number of statuses in an array.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
190 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Please note that the transmit descriptors, receive descriptors and receive statuses are 8
bytes each while the transmit statuses are 4 bytes each. All descriptor arrays and transmit
statuses need to be aligned on 4 byte boundaries; receive status arrays need to be
aligned on 8 byte boundaries. The number of descriptors in the descriptor arrays needs to
be written to the TxDescriptorNumber/RxDescriptorNumber registers using a -1 encoding
i.e. the value in the registers is the number of descriptors minus one e.g. if the descriptor
array has 4 descriptors the value of the number of descriptors register should be 3.
After setting up the descriptor arrays, frame buffers need to be allocated for the receive
descriptors before enabling the receive data path. The Packet field of the receive
descriptors needs to be filled with the base address of the frame buffer of that descriptor.
Amongst others the Control field in the receive descriptor needs to contain the size of the
data buffer using -1 encoding.
The receive data path has a configurable filtering function for discarding/ignoring specific
Ethernet frames. The filtering function should also be configured during initialization.
After an assertion of the hardware reset, the soft reset bit in the MAC will be asserted. The
soft reset condition must be removed before the Ethernet block can be enabled.
Enabling of the receive function is located in two places. The receive DMA manager
needs to be enabled and the receive data path of the MAC needs to be enabled. To
prevent overflow in the receive DMA engine the receive DMA engine should be enabled
by setting the RxEnable bit in the Command register before enabling the receive data path
in the MAC by setting the RECEIVE ENABLE bit in the MAC1 register.
The transmit DMA engine can be enabled at any time by setting the TxEnable bit in the
Command register.
Before enabling the data paths, several options can be programmed in the MAC, such as
automatic flow control, transmit to receive loop-back for verification, full/half duplex
modes, etc.
Base addresses of descriptor arrays and descriptor array sizes cannot be modified
without a (soft) reset of the receive and transmit data paths.
10.17.3 Transmit process
Overview
This section outlines the transmission process.
Device driver sets up descriptors and data
If the descriptor array is full the device driver should wait for the descriptor arrays to
become not full before writing to a descriptor in the descriptor array. If the descriptor array
is not full, the device driver should use the descriptor numbered TxProduceIndex of the
array pointed to by TxDescriptor.
The Packet pointer in the descriptor is set to point to a data frame or frame fragment to be
transmitted. The Size field in the Command field of the descriptor should be set to the
number of bytes in the fragment buffer, -1 encoded. Additional control information can be
indicated in the Control field in the descriptor (bits Interrupt, Last, CRC, Pad).
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
191 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
After writing the descriptor the descriptor needs to be handed over to the hardware by
incrementing (and possibly wrapping) the TxProduceIndex register.
If the transmit data path is disabled, the device driver should not forget to enable the
transmit data path by setting the TxEnable bit in the Command register.
When there is a multi-fragment transmission for fragments other than the last, the Last bit
in the descriptor must be set to 0; for the last fragment the Last bit must be set to 1. To
trigger an interrupt when the frame has been transmitted and transmission status has
been committed to memory, set the Interrupt bit in the descriptor Control field to 1. To have
the hardware add a CRC in the frame sequence control field of this Ethernet frame, set
the CRC bit in the descriptor. This should be done if the CRC has not already been added
by software. To enable automatic padding of small frames to the minimum required frame
size, set the Pad bit in the Control field of the descriptor to 1. In typical applications bits
CRC and Pad are both set to 1.
The device driver can set up interrupts using the IntEnable register to wait for a signal of
completion from the hardware or can periodically inspect (poll) the progress of
transmission. It can also add new frames at the end of the descriptor array, while
hardware consumes descriptors at the start of the array.
The device driver can stop the transmit process by resetting the TxEnable bit in the
Command register to 0. The transmission will not stop immediately; frames already being
transmitted will be transmitted completely and the status will be committed to memory
before deactivating the data path. The status of the transmit data path can be monitored
by the device driver reading the TxStatus bit in the Status register.
As soon as the transmit data path is enabled and the corresponding TxConsumeIndex
and TxProduceIndex are not equal i.e. the hardware still needs to process frames from
the descriptor array, the TxStatus bit in the Status register will return to 1 (active).
Tx DMA manager reads the Tx descriptor array
When the TxEnable bit is set, the Tx DMA manager reads the descriptors from memory at
the address determined by TxDescriptor and TxConsumeIndex. The number of
descriptors requested is determined by the total number of descriptors owned by the
hardware: TxProduceIndex - TxConsumeIndex. Block transferring descriptors minimizes
memory loading. Read data returned from memory is buffered and consumed as needed.
Tx DMA manager transmits data
After reading the descriptor the transmit DMA engine reads the associated frame data
from memory and transmits the frame. After transfer completion, the Tx DMA manager
writes status information back to the StatusInfo and StatusHashCRC words of the status
field. The value of the TxConsumeIndex is only updated after status information has been
committed to memory, which is checked by an internal tag protocol in the memory
interface. The Tx DMA manager continues to transmit frames until the descriptor array is
empty. If the transmit descriptor array is empty the TxStatus bit in the Status register will
return to 0 (inactive). If the descriptor array is empty the Ethernet hardware will set the
TxFinishedInt bit of the IntStatus register. The transmit data path will still be enabled.
The Tx DMA manager inspects the Last bit of the descriptor Control field when loading the
descriptor. If the Last bit is 0, this indicates that the frame consists of multiple fragments.
The Tx DMA manager gathers all the fragments from the host memory, visiting a string of
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
192 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
frame descriptors, and sends them out as one Ethernet frame on the Ethernet connection.
When the Tx DMA manager finds a descriptor with the Last bit in the Control field set to 1,
this indicates the last fragment of the frame and thus the end of the frame is found.
Update ConsumeIndex
Each time the Tx DMA manager commits a status word to memory it completes the
transmission of a descriptor and it increments the TxConsumeIndex (taking wrap around
into account) to hand the descriptor back to the device driver software. Software can
re-use the descriptor for new transmissions after hardware has handed it back.
The device driver software can keep track of the progress of the DMA manager by reading
the TxConsumeIndex register to see how far along the transmit process is. When the Tx
descriptor array is emptied completely, the TxConsumeIndex register retains its last value.
Write transmission status
After the frame has been transmitted over the RMII bus, the StatusInfo word of the frame
descriptor is updated by the DMA manager.
If the descriptor is for the last fragment of a frame (or for the whole frame if there are no
fragments), then depending on the success or failure of the frame transmission, error
flags (Error, LateCollision, ExcessiveCollision, Underrun, ExcessiveDefer, Defer) are set
in the status. The CollisionCount field is set to the number of collisions the frame incurred,
up to the Retransmission Maximum programmed in the Collision window/retry register of
the MAC.
Statuses for all but the last fragment in the frame will be written as soon as the data in the
frame has been accepted by the Tx DMA manager. Even if the descriptor is for a frame
fragment other than the last fragment, the error flags are returned via the AHB interface. If
the Ethernet block detects a transmission error during transmission of a (multi-fragment)
frame, all remaining fragments of the frame are still read via the AHB interface. After an
error, the remaining transmit data is discarded by the Ethernet block. If there are errors
during transmission of a multi-fragment frame the error statuses will be repeated until the
last fragment of the frame. Statuses for all but the last fragment in the frame will be written
as soon as the data in the frame has been accepted by the Tx DMA manager. These may
include error information if the error is detected early enough. The status for the last
fragment in the frame will only be written after the transmission has completed on the
Ethernet connection. Thus, the status for the last fragment will always reflect any error
that occurred anywhere in the frame.
The status of the last frame transmission can also be inspected by reading the TSV0 and
TSV1 registers. These registers do not report statuses on a fragment basis and do not
store information of previously sent frames. They are provided primarily for debug
purposes, because the communication between driver software and the Ethernet block
takes place through the frame descriptors. The status registers are valid as long as the
internal status of the MAC is valid and should typically only be read when the transmit and
receive processes are halted.
Transmission error handling
If an error occurs during the transmit process, the Tx DMA manager will report the error
via the transmission StatusInfo word written in the Status array and the IntStatus interrupt
status register.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
193 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The transmission can generate several types of errors: LateCollision, ExcessiveCollision,
ExcessiveDefer, Underrun, and NoDescriptor. All have corresponding bits in the
transmission StatusInfo word. In addition to the separate bits in the StatusInfo word,
LateCollision, ExcessiveCollision, and ExcessiveDefer are ORed together into the Error
bit of the Status. Errors are also propagated to the IntStatus register; the TxError bit in the
IntStatus register is set in the case of a LateCollision, ExcessiveCollision, ExcessiveDefer,
or NoDescriptor error; Underrun errors are reported in the TxUnderrun bit of the IntStatus
register.
Underrun errors can have three causes:
• The next fragment in a multi-fragment transmission is not available. This is a nonfatal
error. A NoDescriptor status will be returned on the previous fragment and the TxError
bit in IntStatus will be set.
• The transmission fragment data is not available when the Ethernet block has already
started sending the frame. This is a nonfatal error. An Underrun status will be returned
on transfer and the TxError bit in IntStatus will be set.
• The flow of transmission statuses stalls and a new status has to be written while a
previous status still waits to be transferred across the memory interface. This is a fatal
error which can only be resolved by a soft reset of the hardware.
The first and second situations are nonfatal and the device driver has to re-send the frame
or have upper software layers re-send the frame. In the third case the hardware is in an
undefined state and needs to be soft reset by setting the TxReset bit in the Command
register.
After reporting a LateCollision, ExcessiveCollision, ExcessiveDefer or Underrun error, the
transmission of the erroneous frame will be aborted, remaining transmission data and
frame fragments will be discarded and transmission will continue with the next frame in
the descriptor array.
Device drivers should catch the transmission errors and take action.
Transmit triggers interrupts
The transmit data path can generate four different interrupt types:
• If the Interrupt bit in the descriptor Control field is set, the Tx DMA will set the
TxDoneInt bit in the IntStatus register after sending the fragment and committing the
associated transmission status to memory. Even if a descriptor (fragment) is not the
last in a multi-fragment frame the Interrupt bit in the descriptor can be used to
generate an interrupt.
• If the descriptor array is empty while the Ethernet hardware is enabled the hardware
will set the TxFinishedInt bit of the IntStatus register.
• If the AHB interface does not consume the transmission statuses at a sufficiently high
bandwidth the transmission may underrun in which case the TxUnderrun bit will be set
in the IntStatus register. This is a fatal error which requires a soft reset of the
transmission queue.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
194 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
• In the case of a transmission error (LateCollision, ExcessiveCollision, or
ExcessiveDefer) or a multi-fragment frame where the device driver did provide the
initial fragments but did not provide the rest of the fragments (NoDescriptor) or in the
case of a nonfatal overrun, the hardware will set the TxErrorInt bit of the IntStatus
register.
All of the above interrupts can be enabled and disabled by setting or resetting the
corresponding bits in the IntEnable register. Enabling or disabling does not affect the
IntStatus register contents, only the propagation of the interrupt status to the CPU (via the
NVIC).
The interrupts, either of individual frames or of the whole list, are a good means of
communication between the DMA manager and the device driver, triggering the device
driver to inspect the status words of descriptors that have been processed.
Transmit example
status 0
StatusInfo
status 1
StatusInfo
status 2
StatusInfo
StatusInfo
0x200811F8
0x200811FC
3
Control
0x20081100 1 1 CONTROL
0x2008132B
Packet
0x20081419
0x20081324
0x200810FC
0 0 CONTROL
7
Control
descriptor 2
descriptor array
0x200810F8
Packet
0x20081411
descriptor 1
PACKET 0 PAYLOAD (12 bytes)
0x200810F4
0x20081108
7
0 0 CONTROL
Control
descriptor array
descriptor 3
Packet
0x20081324
0x20081204
TxProduceIndex
PACKET 1 HEADER (8 bytes)
0x20081104
0x20081200
status array
0x2008141C
0x20081419
0 0 CONTROL
Control
7
0x20081411
PACKET 0 HEADER (8 bytes)
Packet
0x20081314
descriptor 0
0x200810F0
TxStatus
0x200811F8
status 3
0x20081314
TxDescriptor
0x200810EC
0x200810EC
0x2008131B
Figure 22 illustrates the transmit process in an example transmitting uses a frame header
of 8 bytes and a frame payload of 12 bytes.
TxConsumeIndex
TxDescriptorNumber
=3
fragment buffers
status array
Fig 22. Transmit example memory and registers
After reset the values of the DMA registers will be zero. During initialization the device
driver will allocate the descriptor and status array in memory. In this example, an array of
four descriptors is allocated; the array is 4x2x4 bytes and aligned on a 4 byte address
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
195 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
boundary. Since the number of descriptors matches the number of statuses the status
array consists of four elements; the array is 4x1x4 bytes and aligned on a 4 byte address
boundary. The device driver writes the base address of the descriptor array
(0x2008 10EC) to the TxDescriptor register and the base address of the status array
(0x2008 11F8) to the TxStatus register. The device driver writes the number of descriptors
and statuses minus 1(3) to the TxDescriptorNumber register. The descriptors and
statuses in the arrays need not be initialized, yet.
At this point, the transmit data path may be enabled by setting the TxEnable bit in the
Command register. If the transmit data path is enabled while there are no further frames to
send the TxFinishedInt interrupt flag will be set. To reduce the processor interrupt load
only the desired interrupts can be enabled by setting the relevant bits in the IntEnable
register.
Now suppose application software wants to transmit a frame of 12 bytes using a TCP/IP
protocol (in real applications frames will be larger than 12 bytes). The TCP/IP stack will
add a header to the frame. The frame header need not be immediately in front of the
payload data in memory. The device driver can program the Tx DMA to collect header and
payload data. To do so, the device driver will program the first descriptor to point at the
frame header; the Last flag in the descriptor will be set to false/0 to indicate a
multi-fragment transmission. The device driver will program the next descriptor to point at
the actual payload data. The maximum size of a payload buffer is 2 kB so a single
descriptor suffices to describe the payload buffer. For the sake of the example though the
payload is distributed across two descriptors. After the first descriptor in the array
describing the header, the second descriptor in the array describes the initial 8 bytes of
the payload; the third descriptor in the array describes the remaining 4 bytes of the frame.
In the third descriptor the Last bit in the Control word is set to true/1 to indicate it is the last
descriptor in the frame. In this example the Interrupt bit in the descriptor Control field is set
in the last fragment of the frame in order to trigger an interrupt after the transmission
completed. The Size field in the descriptor’s Control word is set to the number of bytes in
the fragment buffer, -1 encoded.
Note that in real device drivers, the payload will typically only be split across multiple
descriptors if it is more than 2 kB. Also note that transmission payload data is forwarded to
the hardware without the device driver copying it (zero copy device driver).
After setting up the descriptors for the transaction the device driver increments the
TxProduceIndex register by 3 since three descriptors have been programmed. If the
transmit data path was not enabled during initialization the device driver needs to enable
the data path now.
If the transmit data path is enabled the Ethernet block will start transmitting the frame as
soon as it detects the TxProduceIndex is not equal to TxConsumeIndex - both were zero
after reset. The Tx DMA will start reading the descriptors from memory. The memory
system will return the descriptors and the Ethernet block will accept them one by one
while reading the transmit data fragments.
As soon as transmission read data is returned from memory, the Ethernet block will try to
start transmission on the Ethernet connection via the RMII interface.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
196 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
After transmitting each fragment of the frame the Tx DMA will write the status of the
fragment’s transmission. Statuses for all but the last fragment in the frame will be written
as soon as the data in the frame has been accepted by the Tx DMA manager. The status
for the last fragment in the frame will only be written after the transmission has completed
on the Ethernet connection.
Since the Interrupt bit in the descriptor of the last fragment is set, after committing the
status of the last fragment to memory the Ethernet block will trigger a TxDoneInt interrupt,
which triggers the device driver to inspect the status information.
In this example the device driver cannot add new descriptors as long as the Ethernet
block has not incremented the TxConsumeIndex because the descriptor array is full (even
though one descriptor is not programmed yet). Only after the hardware commits the status
for the first fragment to memory and the TxConsumeIndex is set to 1 by the DMA manager
can the device driver program the next (the fourth) descriptor. The fourth descriptor can
already be programmed before completely transmitting the first frame.
In this example the hardware adds the CRC to the frame. If the device driver software
adds the CRC, the CRC trailer can be considered another frame fragment which can be
added by doing another gather DMA.
Each data byte is transmitted across the RMII interface as four 2-bit values. The Ethernet
block adds the preamble, frame delimiter leader, and the CRC trailer if hardware CRC is
enabled. Once transmission on the RMII interface commences the transmission cannot
be interrupted without generating an underrun error, which is why descriptors and data
read commands are issued as soon as possible and pipelined.
Using an RMII PHY, the data communication between the Ethernet block and the PHY is
communicated at 50 MHz. In 10 Mbps mode data will only be transmitted once every 10
clock cycles.
10.17.4 Receive process
This section outlines the receive process including the activities in the device driver
software.
Device driver sets up descriptors
After initializing the receive descriptor and status arrays to receive frames from the
Ethernet connection, the receive data path should be enabled in the MAC1 register and
the Control register.
During initialization, each Packet pointer in the descriptors is set to point to a data
fragment buffer. The size of the buffer is stored in the Size bits of the Control field of the
descriptor. Additionally, the Control field in the descriptor has an Interrupt bit. The Interrupt
bit allows generation of an interrupt after a fragment buffer has been filled and its status
has been committed to memory.
After the initialization and enabling of the receive data path, all descriptors are owned by
the receive hardware and should not be modified by the software unless hardware hands
over the descriptor by incrementing the RxProduceIndex, indicating that a frame has been
received. The device driver is allowed to modify the descriptors after a (soft) reset of the
receive data path.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
197 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Rx DMA manager reads Rx descriptor arrays
When the RxEnable bit in the Command register is set, the Rx DMA manager reads the
descriptors from memory at the address determined by RxDescriptor and
RxProduceIndex. The Ethernet block will start reading descriptors even before actual
receive data arrives on the RMII interface (descriptor prefetching). The block size of the
descriptors to be read is determined by the total number of descriptors owned by the
hardware: RxConsumeIndex - RxProduceIndex - 1. Block transferring of descriptors
minimizes memory load. Read data returned from memory is buffered and consumed as
needed.
RX DMA manager receives data
After reading the descriptor, the receive DMA engine waits for the MAC to return receive
data from the RMII interface that passes the receive filter. Receive frames that do not
match the filtering criteria are not passed to memory. Once a frame passes the receive
filter, the data is written in the fragment buffer associated with the descriptor. The Rx DMA
does not write beyond the size of the buffer. When a frame is received that is larger than a
descriptor’s fragment buffer, the frame will be written to multiple fragment buffers of
consecutive descriptors. In the case of a multi-fragment reception, all but the last fragment
in the frame will return a status where the LastFrag bit is set to 0. Only on the last
fragment of a frame the LastFrag bit in the status will be set to 1. If a fragment buffer is the
last of a frame, the buffer may not be filled completely. The first receive data of the next
frame will be written to the fragment buffer of the next descriptor.
After receiving a fragment, the Rx DMA manager writes status information back to the
StatusInfo and StatusHashCRC words of the status. The Ethernet block writes the size in
bytes of a descriptor’s fragment buffer in the RxSize field of the Status word. The value of
the RxProduceIndex is only updated after the fragment data and the fragment status
information has been committed to memory, which is checked by an internal tag protocol
in the memory interface. The Rx DMA manager continues to receive frames until the
descriptor array is full. If the descriptor array is full, the Ethernet hardware will set the
RxFinishedInt bit of the IntStatus register. The receive data path will still be enabled. If the
receive descriptor array is full any new receive data will generate an overflow error and
interrupt.
Update ProduceIndex
Each time the Rx DMA manager commits a data fragment and the associated status word
to memory, it completes the reception of a descriptor and increments the RxProduceIndex
(taking wrap around into account) in order to hand the descriptor back to the device driver
software. Software can re-use the descriptor for new receptions by handing it back to
hardware when the receive data has been processed.
The device driver software can keep track of the progress of the DMA manager by reading
the RxProduceIndex register to see how far along the receive process is. When the Rx
descriptor array is emptied completely, the RxProduceIndex retains its last value.
Write reception status
After the frame has been received from the RMII bus, the StatusInfo and StatusHashCRC
words of the frame descriptor are updated by the DMA manager.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
198 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
If the descriptor is for the last fragment of a frame (or for the whole frame if there are no
fragments), then depending on the success or failure of the frame reception, error flags
(Error, NoDescriptor, Overrun, AlignmentError, RangeError, LengthError, SymbolError, or
CRCError) are set in StatusInfo. The RxSize field is set to the number of bytes actually
written to the fragment buffer, -1 encoded. For fragments not being the last in the frame
the RxSize will match the size of the buffer. The hash CRCs of the destination and source
addresses of a packet are calculated once for all the fragments belonging to the same
packet and then stored in every StatusHashCRC word of the statuses associated with the
corresponding fragments. If the reception reports an error, any remaining data in the
receive frame is discarded and the LastFrag bit will be set in the receive status field, so
the error flags in all but the last fragment of a frame will always be 0.
The status of the last received frame can also be inspected by reading the RSV register.
The register does not report statuses on a fragment basis and does not store information
of previously received frames. RSV is provided primarily for debug purposes, because the
communication between driver software and the Ethernet block takes place through the
frame descriptors.
Reception error handling
When an error occurs during the receive process, the Rx DMA manager will report the
error via the receive StatusInfo written in the Status array and the IntStatus interrupt status
register.
The receive process can generate several types of errors: AlignmentError, RangeError,
LengthError, SymbolError, CRCError, Overrun, and NoDescriptor. All have corresponding
bits in the receive StatusInfo. In addition to the separate bits in the StatusInfo,
AlignmentError, RangeError, LengthError, SymbolError, and CRCError are ORed together
into the Error bit of the StatusInfo. Errors are also propagated to the IntStatus register; the
RxError bit in the IntStatus register is set if there is an AlignmentError, RangeError,
LengthError, SymbolError, CRCError, or NoDescriptor error; nonfatal overrun errors are
reported in the RxError bit of the IntStatus register; fatal Overrun errors are report in the
RxOverrun bit of the IntStatus register. On fatal overrun errors, the Rx data path needs to
be soft reset by setting the RxReset bit in the Command register.
Overrun errors can have three causes:
• In the case of a multi-fragment reception, the next descriptor may be missing. In this
case the NoDescriptor field is set in the status word of the previous descriptor and the
RxError in the IntStatus register is set. This error is nonfatal.
• The data flow on the receiver data interface stalls, corrupting the packet. In this case
the overrun bit in the status word is set and the RxError bit in the IntStatus register is
set. This error is nonfatal.
• The flow of reception statuses stalls and a new status has to be written while a
previous status still waits to be transferred across the memory interface. This error will
corrupt the hardware state and requires the hardware to be soft reset. The error is
detected and sets the Overrun bit in the IntStatus register.
The first overrun situation will result in an incomplete frame with a NoDescriptor status
and the RxError bit in IntStatus set. Software should discard the partially received frame.
In the second overrun situation the frame data will be corrupt which results in the Overrun
status bit being set in the Status word while the IntError interrupt bit is set. In the third case
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
199 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
receive errors cannot be reported in the receiver Status arrays which corrupts the
hardware state; the errors will still be reported in the IntStatus register’s Overrun bit. The
RxReset bit in the Command register should be used to soft reset the hardware.
Device drivers should catch the above receive errors and take action.
Receive triggers interrupts
The receive data path can generate four different interrupt types:
• If the Interrupt bit in the descriptor Control field is set, the Rx DMA will set the
RxDoneInt bit in the IntStatus register after receiving a fragment and committing the
associated data and status to memory. Even if a descriptor (fragment) is not the last in
a multi-fragment frame, the Interrupt bit in the descriptor can be used to generate an
interrupt.
• If the descriptor array is full while the Ethernet hardware is enabled, the hardware will
set the RxFinishedInt bit of the IntStatus register.
• If the AHB interface does not consume receive statuses at a sufficiently high
bandwidth, the receive status process may overrun, in which case the RxOverrun bit
will be set in the IntStatus register.
• If there is a receive error (AlignmentError, RangeError, LengthError, SymbolError, or
CRCError), or a multi-fragment frame where the device driver did provide descriptors
for the initial fragments but did not provide the descriptors for the rest of the
fragments, or if a nonfatal data Overrun occurred, the hardware will set the RxErrorInt
bit of the IntStatus register.
All of the above interrupts can be enabled and disabled by setting or resetting the
corresponding bits in the IntEnable register. Enabling or disabling does not affect the
IntStatus register contents, only the propagation of the interrupt status to the CPU (via the
NVIC).
The interrupts, either of individual frames or of the whole list, are a good means of
communication between the DMA manager and the device driver, triggering the device
driver to inspect the status words of descriptors that have been processed.
Device driver processes receive data
As a response to status (e.g. RxDoneInt) interrupts or polling of the RxProduceIndex, the
device driver can read the descriptors that have been handed over to it by the hardware
(RxProduceIndex - RxConsumeIndex). The device driver should inspect the status words
in the status array to check for multi-fragment receptions and receive errors.
The device driver can forward receive data and status to upper software layers. After
processing of data and status, the descriptors, statuses and data buffers may be recycled
and handed back to hardware by incrementing the RxConsumeIndex.
Receive example
Figure 23 illustrates the receive process in an example receiving a frame of 19 bytes.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
200 of 849
UM10360
NXP Semiconductors
Status 0
Status 1
0x20081418
1 CONTROL 7
0x20081411
0x200810F0
FRAGMENT 0 BUFFER(8 bytes)
PACKET
0x20081409
Descriptor 0
0x200810EC
RxStatus
0x200811F8
StatusInfo
7
0x200811F8
StatusHashCRC
StatusInfo
7
0x20081200
StatusHashCRC
Status 2
Status 3
0x2008141B
0x200810F8 1 CONTROL 7
0x20081419
PACKET
0x20081411
0x20081100 1 CONTROL 7
0x20081325
PACKET
0x20081419
StatusInfo
2
0x20081208
StatusHashCRC
StatusInfo
7
0x20081210
StatusHashCRC
0x2008132C
FRAGMENT 2 BUFFER(3 bytes)
0x200810FC
Descriptor 2
descriptor array
0x200810F4
Descriptor 1
FRAGMENT 1 BUFFER(8 bytes)
status array
RxDescriptor
0x200810EC
0x20081410
0x20081409
Chapter 10: LPC176x/5x Ethernet
FRAGMENT 3 BUFFER(8 bytes)
0x20081108
1 CONTROL 7
descriptor array
RxProduceIndex
Descriptor 3
0x20081104
PACKET
0x20081325
RxConsumeIndex
RxDescriptorNumber= 3
fragment buffers
status array
Fig 23. Receive Example Memory and Registers
After reset, the values of the DMA registers will be zero. During initialization, the device
driver will allocate the descriptor and status array in memory. In this example, an array of
four descriptors is allocated; the array is 4x2x4 bytes and aligned on a 4 byte address
boundary. Since the number of descriptors matches the number of statuses, the status
array consists of four elements; the array is 4x2x4 bytes and aligned on a 8 byte address
boundary. The device driver writes the base address of the descriptor array
(0x2008 10EC) in the RxDescriptor register, and the base address of the status array
(0x2008 11F8) in the RxStatus register. The device driver writes the number of descriptors
and statuses minus 1 (3) in the RxDescriptorNumber register. The descriptors and
statuses in the arrays need not be initialized yet.
After allocating the descriptors, a fragment buffer needs to be allocated for each of the
descriptors. Each fragment buffer can be between 1 byte and 2 k bytes. The base
address of the fragment buffer is stored in the Packet field of the descriptors. The number
of bytes in the fragment buffer is stored in the Size field of the descriptor Control word.
The Interrupt field in the Control word of the descriptor can be set to generate an interrupt
as soon as the descriptor has been filled by the receive process. In this example the
fragment buffers are 8 bytes, so the value of the Size field in the Control word of the
descriptor is set to 7. Note that in this example, the fragment buffers are actually a
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
201 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
continuous memory space; even when a frame is distributed over multiple fragments it will
typically be in a linear, continuous memory space; when the descriptors wrap at the end of
the descriptor array the frame will not be in a continuous memory space.
The device driver should enable the receive process by writing a 1 to the RxEnable bit of
the Command register, after which the MAC needs to be enabled by writing a 1 to the
‘RECEIVE ENABLE’ bit of the MAC1 configuration register. The Ethernet block will now
start receiving Ethernet frames. To reduce the processor interrupt load, some interrupts
can be disabled by setting the relevant bits in the IntEnable register.
After the Rx DMA manager is enabled, it will start issuing descriptor read commands. In
this example the number of descriptors is 4. Initially the RxProduceIndex and
RxConsumeIndex are 0. Since the descriptor array is considered full if RxProduceIndex
== RxConsumeIndex - 1, the Rx DMA manager can only read (RxConsumeIndex RxProduceIndex - 1 =) 3 descriptors; note the wrapping.
After enabling the receive function in the MAC, data reception will begin starting at the
next frame i.e. if the receive function is enabled while the RMII interface is halfway
through receiving a frame, the frame will be discarded and reception will start at the next
frame. The Ethernet block will strip the preamble and start of frame delimiter from the
frame. If the frame passes the receive filtering, the Rx DMA manager will start writing the
frame to the first fragment buffer.
Suppose the frame is 19 bytes long. Due to the buffer sizes specified in this example, the
frame will be distributed over three fragment buffers. After writing the initial 8 bytes in the
first fragment buffer, the status for the first fragment buffer will be written and the Rx DMA
will continue filling the second fragment buffer. Since this is a multi-fragment receive, the
status of the first fragment will have a 0 for the LastFrag bit in the StatusInfo word; the
RxSize field will be set to 7 (8, -1 encoded). After writing the 8 bytes in the second
fragment the Rx DMA will continue writing the third fragment. The status of the second
fragment will be like the status of the first fragment: LastFrag = 0, RxSize = 7. After writing
the three bytes in the third fragment buffer, the end of the frame has been reached and the
status of the third fragment is written. The third fragment’s status will have the LastFrag bit
set to 1 and the RxSize equal to 2 (3, -1 encoded).
The next frame received from the RMII interface will be written to the fourth fragment
buffer i.e. five bytes of the third buffer will be unused.
The Rx DMA manager uses an internal tag protocol in the memory interface to check that
the receive data and status have been committed to memory. After the status of the
fragments are committed to memory, an RxDoneInt interrupt will be triggered, which
activates the device driver to inspect the status information. In this example, all
descriptors have the Interrupt bit set in the Control word i.e. all descriptors will generate
an interrupt after committing data and status to memory.
In this example the receive function cannot read new descriptors as long as the device
driver does not increment the RxConsumeIndex, because the descriptor array is full (even
though one descriptor is not programmed yet). Only after the device driver has forwarded
the receive data to application software, and after the device driver has updated the
RxConsumeIndex by incrementing it, will the Ethernet block can continue reading
descriptors and receive data. The device driver will probably increment the
RxConsumeIndex by 3, since the driver will forward the complete frame consisting of
three fragments to the application, and hence free up three descriptors at the same time.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
202 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Each four pairs of bits transferred on the RMII interface are transferred as a byte on the
data write interface after being delayed by 128 or 136 cycles for filtering by the receive
filter and buffer modules. The Ethernet block removes preamble, frame start delimiter, and
CRC from the data and checks the CRC. To limit the buffer NoDescriptor error probability,
three descriptors are buffered. The value of the RxProduceIndex is only updated after
status information has been committed to memory, which is checked by an internal tag
protocol in the memory interface. The software device driver will process the receive data,
after which the device driver will update the RxConsumeIndex.
10.17.5 Transmission retry
If a collision on the Ethernet occurs, it usually takes place during the collision window
spanning the first 64 bytes of a frame. If collision is detected, the Ethernet block will retry
the transmission. For this purpose, the first 64 bytes of a frame are buffered, so that this
data can be used during the retry. A transmission retry within the first 64 bytes in a frame
is fully transparent to the application and device driver software.
When a collision occurs outside of the 64 byte collision window, a LateCollision error is
triggered, and the transmission is aborted. After a LateCollision error, the remaining data
in the transmit frame will be discarded. The Ethernet block will set the Error and
LateCollision bits in the frame’s status fields. The TxError bit in the IntStatus register will
be set. If the corresponding bit in the IntEnable register is set, the TxError bit in the
IntStatus register will be propagated to the CPU (via the NVIC). The device driver software
should catch the interrupt and take appropriate actions.
The ‘RETRANSMISSION MAXIMUM’ field of the CLRT register can be used to configure
the maximum number of retries before aborting the transmission.
10.17.6 Status hash CRC calculations
For each received frame, the Ethernet block is able to detect the destination address and
source address and from them calculate the corresponding hash CRCs. To perform the
computation, the Ethernet block features two internal blocks: one is a controller
synchronized with the beginning and the end of each frame, the second block is the CRC
calculator.
When a new frame is detected, internal signaling notifies the controller.The controller
starts counting the incoming bytes of the frame, which correspond to the destination
address bytes. When the sixth (and last) byte is counted, the controller notifies the
calculator to store the corresponding 32-bit CRC into a first inner register. Then the
controller repeats counting the next incoming bytes, in order to get synchronized with the
source address. When the last byte of the source address is encountered, the controller
again notifies the CRC calculator, which freezes until the next new frame. When the
calculator receives this second notification, it stores the present 32-bit CRC into a second
inner register. Then the CRCs remain frozen in their own registers until new notifications
arise.
The destination address and source address hash CRCs being written in the
StatusHashCRC word are the nine most significant bits of the 32-bit CRCs as calculated
by the CRC calculator.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
203 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.17.7 Duplex modes
The Ethernet block can operate in full duplex and half duplex mode. Half or full duplex
mode needs to be configured by the device driver software during initialization.
For a full duplex connection the FullDuplex bit of the Command register needs to be set to
1 and the FULL-DUPLEX bit of the MAC2 configuration register needs to be set to 1; for
half duplex the same bits need to be set to 0.
10.17.8 IEE 802.3/Clause 31 flow control
Overview
For full duplex connections, the Ethernet block supports IEEE 802.3/clause 31 flow control
using pause frames. This type of flow control may be used in full-duplex point-to-point
connections. Flow control allows a receiver to stall a transmitter e.g. when the receive
buffers are (almost) full. For this purpose, the receiving side sends a pause frame to the
transmitting side.
Pause frames use units of 512 bit times corresponding to 128 rx_clk/tx_clk cycles.
Receive flow control
In full-duplex mode, the Ethernet block will suspend its transmissions when the it receives
a pause frame. Rx flow control is initiated by the receiving side of the transmission. It is
enabled by setting the ‘RX FLOW CONTROL’ bit in the MAC1 configuration register. If the
RX FLOW CONTROL’ bit is zero, then the Ethernet block ignores received pause control
frames. When a pause frame is received on the Rx side of the Ethernet block,
transmission on the Tx side will be interrupted after the currently transmitting frame has
completed, for an amount of time as indicated in the received pause frame. The transmit
data path will stop transmitting data for the number of 512 bit slot times encoded in the
pause-timer field of the received pause control frame.
By default the received pause control frames are not forwarded to the device driver. To
forward the receive flow control frames to the device driver, set the ‘PASS ALL RECEIVE
FRAMES’ bit in the MAC1 configuration register.
Transmit flow control
If case device drivers need to stall the receive data e.g. because software buffers are full,
the Ethernet block can transmit pause control frames. Transmit flow control needs to be
initiated by the device driver software; there is no IEEE 802.3/31 flow control initiated by
hardware, such as the DMA managers.
With software flow control, the device driver can detect a situation in which the process of
receiving frames needs to be interrupted by sending out Tx pause frames. Note that due
to Ethernet delays, a few frames can still be received before the flow control takes effect
and the receive stream stops.
Transmit flow control is activated by writing 1 to the TxFlowControl bit of the Command
register. When the Ethernet block operates in full duplex mode, this will result in
transmission of IEEE 802.3/31 pause frames. The flow control continues until a 0 is
written to TxFlowControl bit of the Command register.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
204 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
If the MAC is operating in full-duplex mode, then setting the TxFlowControl bit of the
Command register will start a pause frame transmission. The value inserted into the
pause-timer value field of transmitted pause frames is programmed via the
PauseTimer[15:0] bits in the FlowControlCounter register. When the TxFlowControl bit is
de-asserted, another pause frame having a pause-timer value of 0x0000 is automatically
sent to abort flow control and resume transmission.
When flow control be in force for an extended time, a sequence of pause frames must be
transmitted. This is supported with a mirror counter mechanism. To enable mirror
counting, a nonzero value is written to the MirrorCounter[15:0] bits in the
FlowControlCounter register. When the TxFlowControl bit is asserted, a pause frame is
transmitted. After sending the pause frame, an internal mirror counter is initialized to zero.
The internal mirror counter starts incrementing one every 512 bit-slot times. When the
internal mirror counter reaches the MirrorCounter value, another pause frame is
transmitted with pause-timer value equal to the PauseTimer field from the
FlowControlCounter register, the internal mirror counter is reset to zero and restarts
counting. The register MirrorCounter[15:0] is usually set to a smaller value than register
PauseTimer[15:0] to ensure an early expiration of the mirror counter, allowing time to send
a new pause frame before the transmission on the other side can resume. By continuing
to send pause frames before the transmitting side finishes counting the pause timer, the
pause can be extended as long as TxFlowControl is asserted. This continues until
TxFlowControl is de-asserted when a final pause frame having a pause-timer value of
0x0000 is automatically sent to abort flow control and resume transmission. To disable the
mirror counter mechanism, write the value 0 to MirrorCounter field in the
FlowControlCounter register. When using the mirror counter mechanism, account for
time-of-flight delays, frame transmission time, queuing delays, crystal frequency
tolerances, and response time delays by programming the MirrorCounter conservatively,
typically about 80% of the PauseTimer value.
If the software device driver sets the MirrorCounter field of the FlowControlCounter
register to zero, the Ethernet block will only send one pause control frame. After sending
the pause frame an internal pause counter is initialized at zero; the internal pause counter
is incremented by one every 512 bit-slot times. Once the internal pause counter reaches
the value of the PauseTimer register, the TxFlowControl bit in the Command register will
be reset. The software device driver can poll the TxFlowControl bit to detect when the
pause completes.
The value of the internal counter in the flow control module can be read out via the
FlowControlStatus register. If the MirrorCounter is nonzero, the FlowControlStatus register
will return the value of the internal mirror counter; if the MirrorCounter is zero the
FlowControlStatus register will return the value of the internal pause counter value.
The device driver is allowed to dynamically modify the MirrorCounter register value and
switch between zero MirrorCounter and nonzero MirrorCounter modes.
Transmit flow control is enabled via the ‘TX FLOW CONTROL’ bit in the MAC1
configuration register. If the ‘TX FLOW CONTROL’ bit is zero, then the MAC will not
transmit pause control frames, software must not initiate pause frame transmissions, and
the TxFlowControl bit in the Command register should be zero.
Transmit flow control example
Figure 24 illustrates the transmit flow control.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
205 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
device driver PauseTimer
register MirrorCounter
TxFlowCtl
writes
RMII
transmit
clear
TxFlowCtl
normal
transmission
pause control
frame
transmission
pause control
frame
transmission
normal transimisson
pause control
frame
transmission
MirrorCounter
(1/515 bit
slots)
RMII
receive
0
pause in effect
normal receive
50
100
150
200
250
300
normal receive
350
400
450
500
Fig 24. Transmit Flow Control
In this example, a frame is received while transmitting another frame (full duplex.) The
device driver detects that some buffer might overrun and enables the transmit flow control
by programming the PauseTimer and MirrorCounter fields of the FlowControlCounter
register, after which it enables the transmit flow control by setting the TxFlowControl bit in
the Command register.
As a response to the enabling of the flow control a pause control frame will be sent after
the currently transmitting frame has been transmitted. When the pause frame
transmission completes the internal mirror counter will start counting bit slots; as soon as
the counter reaches the value in the MirrorCounter field another pause frame is
transmitted. While counting the transmit data path will continue normal transmissions.
As soon as software disables transmit flow control a zero pause control frame is
transmitted to resume the receive process.
10.17.9 Half-Duplex mode backpressure
When in half-duplex mode, backpressure can be generated to stall receive packets by
sending continuous preamble that basically jams any other transmissions on the Ethernet
medium. When the Ethernet block operates in half duplex mode, asserting
the TxFlowControl bit in the Command register will result in applying continuous preamble
on the Ethernet wire, effectively blocking traffic from any other Ethernet station on the
same segment.
In half duplex mode, when the TxFlowControl bit goes high, continuous preamble is sent
until TxFlowControl is de-asserted. If the medium is idle, the Ethernet block begins
transmitting preamble, which raises carrier sense causing all other stations to defer. In the
event the transmitting of preamble causes a collision, the backpressure ‘rides through’ the
collision. The colliding station backs off and then defers to the backpressure. If during
backpressure, the user wishes to send a frame, the backpressure is interrupted, the frame
sent and then the backpressure resumed. If TxFlowControl is asserted for longer than
3.3 ms in 10 Mbps mode or 0.33 ms in 100 Mbps mode, backpressure will cease sending
preamble for several byte times to avoid the jabber limit.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
206 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
10.17.10 Receive filtering
Features of receive filtering
The Ethernet MAC has several receive packet filtering functions that can be configured
from the software driver:
• Perfect address filter: allows packets with a perfectly matching station address to be
identified and passed to the software driver.
• Hash table filter: allows imperfect filtering of packets based on the station address.
• Unicast/multicast/broadcast filtering: allows passing of all unicast, multicast, and/or
broadcast packets.
• Magic packet filter: detection of magic packets to generate a Wake-on-LAN interrupt.
The filtering functions can be logically combined to create complex filtering functions.
Furthermore, the Ethernet block can pass or reject runt packets smaller than 64 bytes; a
promiscuous mode allows all packets to be passed to software.
Overview
The Ethernet block has the capability to filter out receive frames by analyzing the Ethernet
destination address in the frame. This capability greatly reduces the load on the host
system, because Ethernet frames that are addressed to other stations would otherwise
need to be inspected and rejected by the device driver software, using up bandwidth,
memory space, and host CPU time. Address filtering can be implemented using the
perfect address filter or the (imperfect) hash filter. The latter produces a 6-bit hash code
which can be used as an index into a 64 entry programmable hash table. Figure 25
depicts a functional view of the receive filter.
At the top of the diagram the Ethernet receive frame enters the filters. Each filter is
controlled by signals from control registers; each filter produces a ‘Ready’ output and a
‘Match’ output. If ‘Ready’ is 0 then the Match value is ‘don’t care’; if a filter finishes filtering
then it will assert its Ready output; if the filter finds a matching frame it will assert the
Match output along with the Ready output. The results of the filters are combined by logic
functions into a single RxAbort output. If the RxAbort output is asserted, the frame does
not need to be received.
In order to reduce memory traffic, the receive data path has a buffer of 68 bytes. The
Ethernet MAC will only start writing a frame to memory after 68 byte delays. If the RxAbort
signal is asserted during the initial 68 bytes of the frame, the frame can be discarded and
removed from the buffer and not stored to memory at all, not using up receive descriptors,
etc. If the RxAbort signal is asserted after the initial 68 bytes in a frame (probably due to
reception of a Magic Packet), part of the frame is already written to memory and the
Ethernet MAC will stop writing further data in the frame to memory; the FailFilter bit in the
status word of the frame will be set to indicate that the software device driver can discard
the frame immediately.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
207 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
packet
AcceptUnicastEn
AcceptMulticastEn
IMPERFECT
HASH
FILTER
AcceptUnicastHashEn
StationAddress
AcceptMulticastHashEn
AcceptPerfectEn
PERFECT
ADDRESS
FILTER
PAMatch
PAReady
HFReady
H FMatc h
HashFilter
CRC
OK?
FMatch
RxFilterWoL
RxFilterEnWoL
RxAbort
FReady
Fig 25. Receive filter block diagram
Unicast, broadcast and multicast
Generic filtering based on the type of frame (unicast, multicast or broadcast) can be
programmed using the AcceptUnicastEn, AcceptMulticastEn, or AcceptBroadcastEn bits
of the RxFilterCtrl register. Setting the AcceptUnicast, AcceptMulticast, and
AcceptBroadcast bits causes all frames of types unicast, multicast and broadcast,
respectively, to be accepted, ignoring the Ethernet destination address in the frame. To
program promiscuous mode, i.e. to accept all frames, set all 3 bits to 1.
Perfect address match
When a frame with a unicast destination address is received, a perfect filter compares the
destination address with the 6 byte station address programmed in the station address
registers SA0, SA1, SA2. If the AcceptPerfectEn bit in the RxFilterCtrl register is set to 1,
and the address matches, the frame is accepted.
Imperfect hash filtering
An imperfect filter is available, based on a hash mechanism. This filter applies a hash
function to the destination address and uses the hash to access a table that indicates if
the frame should be accepted. The advantage of this type of filter is that a small table can
cover any possible address. The disadvantage is that the filtering is imperfect, i.e.
sometimes frames are accepted that should have been discarded.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
208 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
• Hash function:
– The standard Ethernet cyclic redundancy check (CRC) function is calculated from
the 6 byte destination address in the Ethernet frame (this CRC is calculated
anyway as part of calculating the CRC of the whole frame), then bits [28:23] out of
the 32-bit CRC result are taken to form the hash. The 6-bit hash is used to access
the hash table: it is used as an index in the 64-bit HashFilter register that has been
programmed with accept values. If the selected accept value is 1, the frame is
accepted.
– The device driver can initialize the hash filter table by writing to the registers
HashFilterL and HashfilterH. HashFilterL contains bits 0 through 31 of the table
and HashFilterH contains bit 32 through 63 of the table. So, hash value 0
corresponds to bit 0 of the HashfilterL register and hash value 63 corresponds to
bit 31 of the HashFilterH register.
• Multicast and unicast
– The imperfect hash filter can be applied to multicast addresses, by setting the
AcceptMulticastHashEn bit in the RxFilter register to 1.
– The same imperfect hash filter that is available for multicast addresses can also be
used for unicast addresses. This is useful to be able to respond to a multitude of
unicast addresses without enabling all unicast addresses. The hash filter can be
applied to unicast addresses by setting the AcceptUnicastHashEn bit in the
RxFilter register to 1.
Enabling and disabling filtering
The filters as defined in the sections above can be bypassed by setting the PassRxFilter
bit in the Command register. When the PassRxFilter bit is set, all receive frames will be
passed to memory. In this case the device driver software has to implement all filtering
functionality in software. Setting the PassRxFilter bit does not affect the runt frame filtering
as defined in the next section.
Runt frames
A frame with less than 64 bytes (or 68 bytes for VLAN frames) is shorter than the
minimum Ethernet frame size and therefore considered erroneous; they might be collision
fragments. The receive data path automatically filters and discards these runt frames
without writing them to memory and using a receive descriptor.
When a runt frame has a correct CRC there is a possibility that it is intended to be useful.
The device driver can receive the runt frames with correct CRC by setting the
PassRuntFrame bit of the Command register to 1.
10.17.11 Power management
The Ethernet block supports power management by means of clock switching. All clocks
in the Ethernet core can be switched off. If Wake-up on LAN is needed, the rx_clk should
not be switched off.
10.17.12 Wake-up on LAN
Overview
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
209 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
The Ethernet block supports power management with remote wake-up over LAN. The
host system can be powered down, even including part of the Ethernet block itself, while
the Ethernet block continues to listen to packets on the LAN. Appropriately formed
packets can be received and recognized by the Ethernet block and used to trigger the
host system to wake up from its power-down state.
Wake-up of the system takes effect through an interrupt. When a wake-up event is
detected, the WakeupInt bit in the IntStatus register is set. The interrupt status will trigger
an interrupt if the corresponding WakeupIntEn bit in the IntEnable register is set. This
interrupt should be used by system power management logic to wake up the system.
While in a power-down state the packet that generates a Wake-up on LAN event is lost.
There are two ways in which Ethernet packets can trigger wake-up events: generic
Wake-up on LAN and Magic Packet. Magic Packet filtering uses an additional filter for
Magic Packet detection. In both cases a Wake-up on LAN event is only triggered if the
triggering packet has a valid CRC. Figure 25 shows the generation of the wake-up signal.
The RxFilterWoLStatus register can be read by the software to inspect the reason for a
Wake-up event. Before going to power-down the power management software should
clear the register by writing the RxFilterWolClear register.
NOTE: when entering in power-down mode, a receive frame might be not entirely stored
into the Rx buffer. In this situation, after turning exiting power-down mode, the next
receive frame is corrupted due to the data of the previous frame being added in front of
the last received frame. Software drivers have to reset the receive data path just after
exiting power-down mode.
The following subsections describe the two Wake-up on LAN mechanisms.
Filtering for WoL
The receive filter functionality can be used to generate Wake-up on LAN events. If the
RxFilterEnWoL bit of the RxFilterCtrl register is set, the receive filter will set the WakeupInt
bit of the IntStatus register if a frame is received that passes the filter. The interrupt will
only be generated if the CRC of the frame is correct.
Magic Packet WoL
The Ethernet block supports wake-up using Magic Packet technology (see ‘Magic Packet
technology’, Advanced Micro Devices). A Magic Packet is a specially formed packet solely
intended for wake-up purposes. This packet can be received, analyzed and recognized by
the Ethernet block and used to trigger a wake-up event.
A Magic Packet is a packet that contains in its data portion the station address repeated
16 times with no breaks or interruptions, preceded by 6 Magic Packet synchronization
bytes with the value 0xFF. Other data may be surrounding the Magic Packet pattern in the
data portion of the packet. The whole packet must be a well-formed Ethernet frame.
The magic packet detection unit analyzes the Ethernet packets, extracts the packet
address and checks the payload for the Magic Packet pattern. The address from the
packet is used for matching the pattern (not the address in the SA0/1/2 registers.) A magic
packet only sets the wake-up interrupt status bit if the packet passes the receive filter as
illustrated in Figure 25: the result of the receive filter is ANDed with the magic packet filter
result to produce the result.
UM10360
User manual
All information provided in this document is subject to legal disclaimers.
Rev. 3.1 — 2 April 2014
© NXP B.V. 2014. All rights reserved.
210 of 849
UM10360
NXP Semiconductors
Chapter 10: LPC176x/5x Ethernet
Magic Packet filtering is enabled by setting the MagicPacketEnWoL bit of the RxFilterCtrl
register. Note that when doing Magic Packet WoL, the RxFilterEnWoL bit in the
RxFilterCtrl register should be 0. Setting the RxFilterEnWoL bit to 1 would accept all
packets for a matching address, not just the Magic Packets i.e. WoL using Magic Packets
is more strict.
When a magic packet is detected, apart from the WakeupInt bit in the IntStatus register,
the MagicPacketWoL bit is set in the RxFilterWoLStatus register. Software can reset the
bit writing a 1 to the corresponding bit of the RxFilterWoLClear register.
Example: An example of a Magic Packet with station address 0x11 0x22 0x33 0x44 0x55
0x66 is the following (MISC indicates miscellaneous additional data bytes in the packet):
Source Exif Data:
File Type : PDF
File Type Extension : pdf
MIME Type : application/pdf
PDF Version : 1.3
Linearized : No
XMP Toolkit : XMP Core 5.4.0
Title : UM10360 LPC176x/5x User manual
Creator : NXP Semiconductors
Format : application/pdf
Metadata Date : 2014:04:03 14:45:57+02:00
Create Date : 2014:04:02 14:37:30Z
Modify Date : 2014:04:03 14:45:57+02:00
Creator Tool : FrameMaker 10.0.2
Instance ID : uuid:4f9b072c-020f-4c2b-8dc4-ea58ed1db288
Document ID : uuid:7a3d5156-7021-4e20-b3ea-0de1eda552c0
Bookmarks Page Index : 56
Bookmarks Uuid : CC2AA2C6-97F5-4A1F-983B-CE4D3C8B34BE
Producer : Acrobat Distiller 10.1.7 (Windows)
Page Count : 849
Author : NXP Semiconductors
EXIF Metadata provided by EXIF.tools