SWM General description

The switch matrix connects internal signals (functions) to external pins. Functions are signals coming from or going to a single pin on the package and coming from or going to an on-chip peripheral block. Examples of functions are the GPIOs, the UART transmit output (TXD), or the clock output CLKOUT. Many peripherals have several functions that must be connected to external pins.

The switch matrix also enables the output driver for digital functions that are outputs. The electrical pin characteristics for both inputs and outputs (internal pull-up/down resistors, inverter, digital filter, open-drain mode) are configured by the IOCON block for each pin.

On the LPC81x, most functions can be assigned through the switch matrix to any external pin that is not a power or ground pin. These functions are called movable functions.

A few functions like the crystal oscillator pins (XTALIN/XTALOUT) or the analog comparator inputs can only be assigned to one particular external pin with the appropriate electrical characteristics. These functions are called fixed-pin functions. If a fixed-pin function is not used, it can be replaced by any other movable function.

For fixed-pin analog functions, the switch matrix enables the analog input or output and disables the digital pad.

GPIOs are special fixed-pin functions. Each GPIO is assigned to one and only one external pin by default. External pins are therefore identified by their fixed-pin GPIO function. The level on a digital input is always reflected in the GPIO port register and in the pin interrupt/pattern match state, if selected, regardless of which (digital) function is assigned to the pin through the switch matrix.



Functional diagram of the switch matrix

Note: From all movable and fixed-pin functions, you can assign multiple functions to the same pin but no more than one output or bidirectional function (see c-Generaldescription.html#CEGIDGID__CEGJJHFC). Use the following guidelines when assigning pins:

Movable functions

Table 1. SWM Movable functions (assign to pins PIO0_0 to PIO0_17 through switch matrix)
Function name Type Description SWM Pin assign register Reference
U0_TXD O

Transmitter output for USART0.

PINASSIGN0 SWM registerName = PINASSIGN0 addressOffset = 0x000
U0_RXD I

Receiver input for USART0.

PINASSIGN0 SWM registerName = PINASSIGN0 addressOffset = 0x000
U0_RTS O

Request To Send output for USART0.

PINASSIGN0 SWM registerName = PINASSIGN0 addressOffset = 0x000
U0_CTS I

Clear To Send input for USART0.

PINASSIGN0 SWM registerName = PINASSIGN0 addressOffset = 0x000
U0_SCLK I/O

Serial clock input/output for USART0 in synchronous mode.

PINASSIGN1 SWM registerName = PINASSIGN1 addressOffset = 0x004
U1_TXD O

Transmitter output for USART1.

PINASSIGN1 SWM registerName = PINASSIGN1 addressOffset = 0x004
U1_RXD I

Receiver input for USART1.

PINASSIGN1 SWM registerName = PINASSIGN1 addressOffset = 0x004
U1_RTS O

Request To Send output for USART1.

PINASSIGN1 SWM registerName = PINASSIGN1 addressOffset = 0x004
U1_CTS I

Clear To Send input for USART1.

PINASSIGN2 SWM registerName = PINASSIGN2 addressOffset = 0x008
U1_SCLK I/O

Serial clock input/output for USART1 in synchronous mode.

PINASSIGN2 SWM registerName = PINASSIGN2 addressOffset = 0x008
U2_TXD O

Transmitter output for USART2.

PINASSIGN2 SWM registerName = PINASSIGN2 addressOffset = 0x008
U2_RXD I

Receiver input for USART2.

PINASSIGN2 SWM registerName = PINASSIGN2 addressOffset = 0x008
U2_RTS O

Request To Send output for USART1.

PINASSIGN3 SWM registerName = PINASSIGN3 addressOffset = 0x00C
U2_CTS I

Clear To Send input for USART1.

PINASSIGN3 SWM registerName = PINASSIGN3 addressOffset = 0x00C
U2_SCLK I/O

Serial clock input/output for USART1 in synchronous mode.

PINASSIGN3 SWM registerName = PINASSIGN3 addressOffset = 0x00C
SPI0_SCK I/O

Serial clock for SPI0.

PINASSIGN3 SWM registerName = PINASSIGN3 addressOffset = 0x00C
SPI0_MOSI I/O

Master Out Slave In for SPI0.

PINASSIGN4 SWM registerName = PINASSIGN4 addressOffset = 0x010
SPI0_MISO I/O

Master In Slave Out for SPI0.

PINASSIGN4 SWM registerName = PINASSIGN4 addressOffset = 0x010
SPI0_SSEL I/O

Slave select for SPI0.

PINASSIGN4 SWM registerName = PINASSIGN4 addressOffset = 0x010
SPI1_SCK I/O

Serial clock for SPI1.

PINASSIGN4 SWM registerName = PINASSIGN4 addressOffset = 0x010
SPI1_MOSI I/O

Master Out Slave In for SPI1.

PINASSIGN5 SWM registerName = PINASSIGN5 addressOffset = 0x014
SPI1_MISO I/O

Master In Slave Out for SPI1.

PINASSIGN5 SWM registerName = PINASSIGN5 addressOffset = 0x014
SPI1_SSEL I/O

Slave select for SPI1.

PINASSIGN5 SWM registerName = PINASSIGN5 addressOffset = 0x014
CTIN_0 I

SCT input 0.

PINASSIGN5 SWM registerName = PINASSIGN5 addressOffset = 0x014
CTIN_1 I

SCT input 1.

PINASSIGN6 SWM registerName = PINASSIGN6 addressOffset = 0x018
CTIN_2 I

SCT input 2.

PINASSIGN6 SWM registerName = PINASSIGN6 addressOffset = 0x018
CTIN_3 I

SCT input 3.

PINASSIGN6 SWM registerName = PINASSIGN6 addressOffset = 0x018
CTOUT_0 O

SCT output 0.

PINASSIGN6 SWM registerName = PINASSIGN6 addressOffset = 0x018
CTOUT_1 O

SCT output 1.

PINASSIGN7 SWM registerName = PINASSIGN7 addressOffset = 0x01C
CTOUT_2 O

SCT output 2.

PINASSIGN7 SWM registerName = PINASSIGN7 addressOffset = 0x01C
CTOUT_3 O

SCT output 3.

PINASSIGN7 SWM registerName = PINASSIGN7 addressOffset = 0x01C
I2C0_SDA I/O

I^ 2C-bus data input/output (open-drain if assigned to pin PIO0_11). High-current sink only if assigned to pin PIO0_11 and if I^ 2C Fast-mode Plus is selected in the I/O configuration register.

PINASSIGN7 SWM registerName = PINASSIGN7 addressOffset = 0x01C
I2C0_SCL I/O

I^ 2C-bus clock input/output (open-drain if assigned to pin PIO0_10). High-current sink only if assigned to PIO0_10 and if I^ 2C Fast-mode Plus is selected in the I/O configuration register.

PINASSIGN8 SWM registerName = PINASSIGN8 addressOffset = 0x020
ACMP_O O Analog comparator output. PINASSIGN8 SWM registerName = PINASSIGN8 addressOffset = 0x020
CLKOUT O Clock output. PINASSIGN8 SWM registerName = PINASSIGN8 addressOffset = 0x020
GPIO_INT_BMAT O Output of the pattern match engine. PINASSIGN8 SWM registerName = PINASSIGN8 addressOffset = 0x020

Switch matrix register interface

The switch matrix consists of two blocks of pin-assignment registers PINASSIGN and PINENABLE. Every function has an assigned field (1-bit or 8-bit wide) within this bank of registers where you can program the external pin - identified by its GPIO function - you want the function to connect to.

GPIOs range from PIO0_0 to PIO0_17 and, for assignment through the pin-assignment registers, are numbered 0 to 17.

There are two types of functions which must be assigned to port pins in different ways:

  1. Movable functions (PINASSIGN0 to 8):

    All movable functions are digital functions. Assign movable functions to pin numbers through the 8 bits of the PINASSIGN register associated with this function. Once the function is assigned a pin PIO0_n, it is connected through this pin to a physical pin on the package.

    Note: You can assign only one digital output function to an external pin at any given time.
    Note: You can assign more than one digital input function to one external pin.
  2. Fixed-pin functions (PINENABLE0):

    Some functions require pins with special characteristics and cannot be moved to other physical pins. Hence these functions are mapped to a fixed port pin. Examples of fixed-pin functions are the oscillator pins or comparator inputs.

    Each fixed-pin function is associated with one bit in the PINENABLE0 register which selects or deselects the function.

    • If a fixed-pin function is deselected, any movable function can be assigned to its port and pin.
    • If a fixed-pin function is deselected and no movable function is assigned to this pin, the pin is assigned its GPIO function.
    • On reset, all fixed-pin functions are deselected.
    • If a fixed-pin analog function is selected, its assigned pin cannot be used for any other function.


-->