8.6 Input Mapping

The inputs of the Peripheral Pin Select options are mapped on the basis of the peripheral. That is, a control register associated with a peripheral dictates the pin it will be mapped to. The RPINRx registers are used to configure peripheral input mapping. Each register contains sets of 8-bit fields, with each set associated with one of the remappable peripherals. Programming a given peripheral’s bit field with an appropriate 8-bit index value maps the RPn pin with the corresponding value, or internal signal, to that peripheral. See Table 8-4 for a list of available inputs.

For example, Figure 8-2 illustrates remappable pin selection for the U1RX input.
Figure 8-2. Remappable Input for U1RX

Configuring UART1 Input and Output Functions provides a configuration for bidirectional communication with flow control using UART1. The following input and output functions are used:

  • Input Functions: U1RX, U1CTS
  • Output Functions: U1TX, U1RTS

Table 8-4. Remappable Pin Inputs
RPINRx[15:8] or RPINRx[7:0]FunctionAvailable on Ports
0VSSInternal
1Comparator 1Internal
2Comparator 2Internal
3-5RP3-RP5Reserved
6PTG Trigger 26Internal
7PTG Trigger 27Internal
8-10RP8-RP10Reserved
11PWM Event Out CInternal
12PWM Event Out DInternal
13PWM Event Out EInternal
14-31RP14-RP31Reserved
32RP32Port Pin RB0
33RP33Port Pin RB1
34RP34Port Pin RB2
35RP35Port Pin RB3
36RP36Port Pin RB4
37RP37Port Pin RB5
38RP38Port Pin RB6
39RP39Port Pin RB7
40RP40Port Pin RB8
41RP41Port Pin RB9
42RP42Port Pin RB10
43RP43Port Pin RB11
44RP44Port Pin RB12
45RP45Port Pin RB13
46RP46Port Pin RB14
47RP47Port Pin RB15
48RP48Port Pin RC0
49RP49Port Pin RC1
50RP50Port Pin RC2
51RP51Port Pin RC3
52RP52Port Pin RC4
53RP53Port Pin RC5
54RP54Port Pin RC6
55RP55Port Pin RC7
56RP56Port Pin RC8
57RP57Port Pin RC9
58RP58Port Pin RC10
59RP59Port Pin RC11
60RP60Port Pin RC12
61RP61Port Pin RC13
62RP62Port Pin RC14
63RP63Port Pin RC15
64RP64Port Pin RD0
65RP65Port Pin RD1
66RP66Port Pin RD2
67RP67Port Pin RD3
68RP68Port Pin RD4
69RP69Port Pin RD5
70RP70Port Pin RD6
71RP71Port Pin RD7
72RP72Port Pin RD8
73RP73Port Pin RD9
74RP74Port Pin RD10
75RP75Port Pin RD11
76RP76Port Pin RD12
77RP77Port Pin RD13
78RP78Port Pin RD14
79RP79Port Pin RD15
80-165RP80-RP165Reserved
166DAC2 pwm_req_onInternal
167DAC2 pwm_req_offInternal
168DAC1 pwm_req_onInternal
169DAC1 pwm_req_offInternal
170-175RP170-RP175Reserved
176RP176Virtual RPV0
177RP177Virtual RPV1
178RP178Virtual RPV2
179RP179Virtual RPV3
180RP180Virtual RPV4
181RP181Virtual RPV5
Table 8-5. Selectable Input Sources (Maps Input to Function)
Input Name(1)Function NameRegisterRegister Bits
External Interrupt 1INT1 RPINR0INT1R[7:0]
External Interrupt 2INT2 RPINR1INT2R[7:0]
External Interrupt 3INT3RPINR1INT3R[7:0]
Timer1 External ClockT1CKRPINR2T1CK[7:0]
SCCP Timer1TCKI1RPINR3TCKI1R[7:0]
SCCP Capture 1ICM1RPINR3ICM1R[7:0]
SCCP Timer2TCKI2RPINR4TCKI2R[7:0]
SCCP Capture 2ICM2RPINR4ICM2R[7:0]
SCCP Timer3TCKI3RPINR5TCKI3R[7:0]
SCCP Capture 3ICM3RPINR5ICM3R[7:0]
SCCP Timer4TCKI4RPINR6TCKI4R[7:0]
SCCP Capture 4ICM4RPINR6ICM4R[7:0]
SCCP Fault A OCFA RPINR11OCFAR[7:0]
SCCP Fault B OCFB RPINR11OCFBR[7:0]
PWM PCI Input 8PCI8RPINR12PCI8R[7:0]
PWM PCI Input 9PCI9RPINR12PCI9R[7:0]
PWM PCI Input 10PCI10RPINR13PCI10R[7:0]
PWM PCI Input 11PCI11RPINR13PCI11R[7:0]
QEI1 Input AQEIA1RPINR14QEIA1R[7:0]
QEI1 Input BQEIB1RPINR14QEIB1R[7:0]
QEI1 Index 1 InputQEINDX1RPINR15QEINDX1R[7:0]
QEI1 Home 1 InputQEIHOM1RPINR15QEIHOM1R[7:0]
UART1 ReceiveU1RX RPINR18U1RXR[7:0]
UART1 Data-Set-ReadyU1DSRRPINR18U1DSRR[7:0]
UART2 ReceiveU2RX RPINR19U2RXR[7:0]
UART2 Data-Set-ReadyU2DSRRPINR19U2DSRR[7:0]
SPI1 Data InputSDI1RPINR20SDI1R[7:0]
SPI1 Clock InputSCK1INRPINR20SCK1R[7:0]
SPI1 Client SelectSS1RPINR21SS1R[7:0]
Reference Clock Input REFCLKIRPINR21REFOIR[7:0]
SPI2 Data InputSDI2 RPINR22SDI2R[7:0]
SPI2 Clock InputSCK2IN RPINR22SCK2R[7:0]
SPI2 Client SelectSS2RPINR23SS2R[7:0]
CAN1 Input (CAN1RX) CAN1RXRPINR26CAN1RXR[7:0]
UART3 ReceiveU3RXRPINR27U3RXR[7:0]
UART3 Data-Set-ReadyU3DSRRPINR27U3DSRR[7:0]
SCCP Fault COCFCRPINR37OCFCR[7:0]
PWM PCI Input 17PCI17RPINR37PCI17R[7:0]
PWM PCI Input 18PCI18RPINR38PCI18R[7:0]
PWM PCI Input 12PCI12RPINR42PCI12R[7:0]
PWM PCI Input 13PCI13RPINR42PCI13R[7:0]
PWM PCI Input 14PCI14RPINR43PCI14R[7:0]
PWM PCI Input 15 PCI15RPINR43PCI15R[7:0]
PWM PCI Input 16 PCI16RPINR44PCI16R[7:0]
SENT1 InputSENT1RPINR44SENT1R[7:0]
CLC Input ACLCINARPINR45CLCINAR[7:0]
CLC Input BCLCINBRPINR46CLCINBR[7:0]
CLC Input CCLCINCRPINR46CLCINCR[7:0]
CLC Input DCLCINDRPINR47CLCINDR[7:0]
ADC Trigger Input (ADTRIG31)ADCTRGRPINR47ADCTRGR[7:0]
SCCP Fault DOCFDRPINR48OCFDR[7:0]
UART1 Clear-to-SendU1CTSRPINR48U1CTSR[7:0]
UART2 Clear-to-SendU2CTSRPINR49U2CTSR[7:0]
UART3 Clear-to-SendU3CTSRPINR49U3CTSR[7:0]
Note:
  1. Unless otherwise noted, all inputs use the Schmitt Trigger input buffers.

Configuring UART1 Input and Output Functions

//
*******************************************
// Unlock Registers
//*****************************************
__builtin_write_RPCON(0x0000);
//*****************************************
// Configure Input Functions (See Table 3-32)
// Assign U1Rx To Pin RP35
//***************************
_U1RXR = 35;
// Assign U1CTS To Pin RP36
//***************************
_U1CTSR = 36;
//*****************************************
// Configure Output Functions (See Table 3-34)
//*****************************************
// Assign U1Tx To Pin RP37
//***************************
_RP37R = 1;
//***************************
// Assign U1RTS To Pin RP38
//***************************
_RP38R = 2;
//*****************************************
// Lock Registers
//*****************************************
__builtin_write_RPCON(0x0800);