Hi,
The esay way is to follow the example:
void BOARD_InitPins(void)
{
/* Port A Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortA); // open clock is must
/* Port B Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortB);
/* Port C Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortC);
/* PORTA1 (pin 23) is configured as LPUART0_RX */
PORT_SetPinMux(PORTA, 1U, kPORT_MuxAlt2); // set pin function
/* PORTA2 (pin 24) is configured as LPUART0_TX */
PORT_SetPinMux(PORTA, 2U, kPORT_MuxAlt2);
/* PORTB18 (pin 41) is configured as PTB18 */
PORT_SetPinMux(PORTB, 18U, kPORT_MuxAsGpio);
const port_pin_config_t portc1_pin44_config = {/* Internal pull-up resistor is enabled */
kPORT_PullUp,
/* Slow slew rate is configured */
kPORT_SlowSlewRate,
/* Passive filter is disabled */
kPORT_PassiveFilterDisable,
/* Low drive strength is configured */
kPORT_LowDriveStrength,
/* Pin is configured as PTC1 */
kPORT_MuxAsGpio};
/* PORTC1 (pin 44) is configured as PTC1 */
PORT_SetPinConfig(PORTC, 1U, &portc1_pin44_config);
SIM->SOPT5 = ((SIM->SOPT5 & // don't forget here, some misc setting
/* Mask bits to zero which are setting */
(~(SIM_SOPT5_LPUART0TXSRC_MASK | SIM_SOPT5_LPUART0RXSRC_MASK)))
/* LPUART0 Transmit Data Source Select: LPUART0_TX pin. */
| SIM_SOPT5_LPUART0TXSRC(SOPT5_LPUART0TXSRC_LPUART_TX)
/* LPUART0 Receive Data Source Select: LPUART_RX pin. */
| SIM_SOPT5_LPUART0RXSRC(SOPT5_LPUART0RXSRC_LPUART_RX));
}
Regards,
Jing