Most available example applications use UART as the serial interface for terminal communication. This approach is commonly chosen because a terminal provides a simple and efficient method for interacting with the application during development and debugging.
The KW47-EVK supports two CAN/CAN-FD interface; as well as two UART interfaces accessible through the onboard USB-to-UART bridge.
The corresponding SoC peripheral instances are CAN0 and CAN1 for the CAN/CAN‑FD interfaces, and LPUART0 and LPUART1 for the UART interfaces.
Since the LPUART1 serial interface and the CAN1 interface are routed to the same pins (PTC2 and PTC3) at the board level, and both functions can be enabled through header configuration, external isolation is required to ensure correct operation and prevent interference from other onboard components.
If CAN1 must be enabled and your application also requires a serial terminal interface, then LPUART0 must be used as the serial interface.To enable both CAN1 and LPUART0 on the KW47‑EVK, follow the steps below:
Changes required on hardware
| Pin name |
Board jumper |
Pin name |
Board jumper |
| CANH |
J21 - 1 |
CANH |
J21 - 1 |
| CANL |
J21 - 2 |
CANL |
J21 - 2 |
| GND |
J21 - 4 |
GND |
J21 - 4 |
| P12V |
J21 - 3 |
P12V |
J21 - 3 |
Note: Plug in the 12V power supply on J9 to supply the P5V_CAN.
| LPUART0 interface connection |
| Functionality |
Board jumper |
Connection configuration |
| LIN_RX |
JP11 |
2 - 3 |
| LIN_TX |
JP12 |
2 - 3 |
| UART_RX_USB selector |
JP16 |
2 - 3 |
| UART_TX_USB selector |
JP17 |
2 - 3 |
| CAN_RX_1 selector |
JP56 |
1 - 2 |
| CAN_TX_1 selector |
JP57 |
1 - 2 |

Changes required on software
Note: These steps assume you are using a FlexCAN SDK example application.
If your application requires enabling CAN1 instead of the default CAN0, update the following configuration in your project’s source code:
1. In board.c, modify the LPUART instance, kCLOCK_Lpuart1 -> kCLOCK_Lpuart0:
/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq = 0U;
/* Set LPUART0 clock source */
CLOCK_SetIpSrc(kCLOCK_Lpuart0, kCLOCK_IpSrcFro192M);
uartClkSrcFreq = CLOCK_GetIpFreq(kCLOCK_Lpuart0);
DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
}
2. In board.h, modify the LPUART instance definitions:
- BOARD_DEBUG_UART_BASEADDR LPUART1 -> LPUART0
- BOARD_DEBUG_UART_INSTANCE 1U -> 0U
- BOARD_DEBUG_UART_CLK_FREQ kCLOCK_Lpuart1 -> kCLOCK_Lpuart0
/* The UART to use for debug messages. */
#define BOARD_USE_LPUART
#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART0
#define BOARD_DEBUG_UART_INSTANCE 0U
#define BOARD_DEBUG_UART_CLK_FREQ (CLOCK_GetIpFreq(kCLOCK_Lpuart0))
3. In hardware_init.c, modify the CAN instance to CAN1 at FlexCAN functional clock configuration:
void BOARD_InitHardware(void)
{
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
/* FRO192M is configured as CAN1 functional clock in this example
but other clock options may be available */
CLOCK_SetIpSrc(kCLOCK_Can1, kCLOCK_IpSrcFro192M);
CLOCK_SetIpSrcDiv(kCLOCK_Can1, kSCG_SysClkDivBy1);
}
4. In app.h, modify the EXAMPLE_CAN definition to CAN1:
#define EXAMPLE_CAN CAN1
#define USE_CANFD (1)
#define RX_MESSAGE_BUFFER_NUM (0)
#define TX_MESSAGE_BUFFER_NUM (1)
5. In pin_mux.c, modify pin multiplexing configuration to enable CAN1 and LPUART0 pins respectively. You can copy and paste the below code to replace BOARD_InitPins function:
void BOARD_InitPins(void)
{
/* Clock Config: Peripheral clocks are enabled; module does not stall low power mode entry */
CLOCK_EnableClock(kCLOCK_PortA);
CLOCK_EnableClock(kCLOCK_PortC);
const port_pin_config_t porta16_pin11_config = {/* Internal pull-up/down resistor is disabled */
(uint16_t)kPORT_PullDisable,
/* Low internal pull resistor value is selected. */
(uint16_t)kPORT_LowPullResistor,
/* Fast slew rate is configured */
(uint16_t)kPORT_FastSlewRate,
/* Passive input filter is disabled */
(uint16_t)kPORT_PassiveFilterDisable,
/* Open drain output is disabled */
(uint16_t)kPORT_OpenDrainDisable,
/* Low drive strength is configured */
(uint16_t)kPORT_LowDriveStrength,
/* Normal drive strength is configured */
(uint16_t)kPORT_NormalDriveStrength,
/* Pin is configured as LPUART0_RX */
(uint16_t)kPORT_MuxAlt6,
/* Does not invert */
(uint16_t)kPORT_InputNormal,
/* Pin Control Register fields [15:0] are not locked */
(uint16_t)kPORT_UnlockRegister};
/* PORTA16 (pin 11) is configured as LPUART0_RX */
PORT_SetPinConfig(PORTA, 16U, &porta16_pin11_config);
const port_pin_config_t porta17_pin12_config = {/* Internal pull-up/down resistor is disabled */
(uint16_t)kPORT_PullDisable,
/* Low internal pull resistor value is selected. */
(uint16_t)kPORT_LowPullResistor,
/* Fast slew rate is configured */
(uint16_t)kPORT_FastSlewRate,
/* Passive input filter is disabled */
(uint16_t)kPORT_PassiveFilterDisable,
/* Open drain output is disabled */
(uint16_t)kPORT_OpenDrainDisable,
/* Low drive strength is configured */
(uint16_t)kPORT_LowDriveStrength,
/* Normal drive strength is configured */
(uint16_t)kPORT_NormalDriveStrength,
/* Pin is configured as LPUART0_TX */
(uint16_t)kPORT_MuxAlt6,
/* Does not invert */
(uint16_t)kPORT_InputNormal,
/* Pin Control Register fields [15:0] are not locked */
(uint16_t)kPORT_UnlockRegister};
/* PORTA17 (pin 12) is configured as LPUART0_TX */
PORT_SetPinConfig(PORTA, 17U, &porta17_pin12_config);
const port_pin_config_t portc2_pin39_config = {/* Internal pull-up/down resistor is disabled */
(uint16_t)kPORT_PullDisable,
/* Low internal pull resistor value is selected. */
(uint16_t)kPORT_LowPullResistor,
/* Fast slew rate is configured */
(uint16_t)kPORT_FastSlewRate,
/* Passive input filter is disabled */
(uint16_t)kPORT_PassiveFilterDisable,
/* Open drain output is disabled */
(uint16_t)kPORT_OpenDrainDisable,
/* Low drive strength is configured */
(uint16_t)kPORT_LowDriveStrength,
/* Normal drive strength is configured */
(uint16_t)kPORT_NormalDriveStrength,
/* Pin is configured as CAN1_RX */
(uint16_t)kPORT_MuxAlt11,
/* Does not invert */
(uint16_t)kPORT_InputNormal,
/* Pin Control Register fields [15:0] are not locked */
(uint16_t)kPORT_UnlockRegister};
/* PORTC2 (pin 39) is configured as CAN1_RX */
PORT_SetPinConfig(PORTC, 2U, &portc2_pin39_config);
const port_pin_config_t portc3_pin40_config = {/* Internal pull-up/down resistor is disabled */
(uint16_t)kPORT_PullDisable,
/* Low internal pull resistor value is selected. */
(uint16_t)kPORT_LowPullResistor,
/* Fast slew rate is configured */
(uint16_t)kPORT_FastSlewRate,
/* Passive input filter is disabled */
(uint16_t)kPORT_PassiveFilterDisable,
/* Open drain output is disabled */
(uint16_t)kPORT_OpenDrainDisable,
/* Low drive strength is configured */
(uint16_t)kPORT_LowDriveStrength,
/* Normal drive strength is configured */
(uint16_t)kPORT_NormalDriveStrength,
/* Pin is configured as CAN1_TX */
(uint16_t)kPORT_MuxAlt11,
/* Does not invert */
(uint16_t)kPORT_InputNormal,
/* Pin Control Register fields [15:0] are not locked */
(uint16_t)kPORT_UnlockRegister};
/* PORTC3 (pin 43) is configured as CAN1_TX */
PORT_SetPinConfig(PORTC, 3U, &portc3_pin40_config);
}
Run your demo application
- Connect a USB cable between the host PC and the KW47-EVK board J14.
- Open a serial terminal on PC for each board with the following settings:
- 115200 baud rate
- 8 data bits
- No parity
- One stop bit
- No flow control
- Download the program to the target board
- Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.