Pin Selection and Pin Mode

Objective

Know how to select a specific functionality of a given LPC17xx pin. Know how to select a pin mode.

Pin Selection

Every GPIO pin of the LPC17xx is capable of other alternative functionalities. Pin selection is the method by which a user is able to designate the functionality of any given pin. For example, GPIO Pin 0.0 can alternatively by used for CAN channel 1 receive, UART channel 3 transmit, and I2C channel 1 data line.

Pin Mode

The LPC17xx has several registers dedicated to setting a pin's mode. Mode refers to enabling/disabling pull up/down resistors as well as open drain configuration. PINMODE registers allow users to enable a pull-up (00), enable pull up and pull down (01), disable pull up and pull down (10), and enable pull down (11). PINMODE_OD registers allow users to enable/disable open drain mode.

Figure 2. LPC17xx User Manual PINMODE & PINMODE_OD

Figure 3. LPC17xx User Manual PINMODE0

Figure 4. LPC17xx User Manual PINMODE_OD0

For example, if one desires to configure pin 0.09 to enable a pull-up resistor and open drain mode, one must clear bits 18 & 19 of PINMODE0 register, and set bit 9 of register PINMODE_OD0.