How to change Debug UART port from UART1 to UART4 on RT1061

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change Debug UART port from UART1 to UART4 on RT1061

Jump to solution
1,318 Views
JarvisC
Contributor II

Dear All,

I had added the [M5] GPIO_SD_B1_01 (UART4_RX)/[L5] GPIO_SD_B1_00 (UART4_TX) ,and modified some source code as below, but it seems not working.

How should I do to change Debug UART port from UART1 to UART4 on RT1061 with (SDK_2_12_1_EVK-MIMXRT1060)?

pin_mux.c

void BOARD_InitPins(void) {
CLOCK_EnableClock(kCLOCK_Iomuxc);

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_00_LPUART4_TX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_01_LPUART4_RX, 0U);
IOMUXC_GPR->GPR26 = ((IOMUXC_GPR->GPR26 &
(~(BOARD_INITPINS_IOMUXC_GPR_GPR26_GPIO_MUX1_GPIO_SEL_MASK)))
| IOMUXC_GPR_GPR26_GPIO_MUX1_GPIO_SEL(0x00U)
);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, 0x90B1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_00_LPUART4_TX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_01_LPUART4_RX, 0x10B0U);
}

borad.h:

/* The UART to use for debug messages. */
#define BOARD_DEBUG_UART_CLK_FREQ BOARD_DebugConsoleSrcFreq()
#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
#ifndef BOARD_DEBUG_UART_BASEADDR
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART4 //LPUART1
#endif
#ifndef BOARD_DEBUG_UART_INSTANCE
#define BOARD_DEBUG_UART_INSTANCE 4U //1U
#endif
#ifndef BOARD_UART_IRQ
#define BOARD_UART_IRQ LPUART4_IRQn
#endif
#ifndef BOARD_UART_IRQ_HANDLER
#define BOARD_UART_IRQ_HANDLER LPUART4_IRQHandler //LPUART1_IRQHandler
#endif
#ifndef BOARD_DEBUG_UART_BAUDRATE
#define BOARD_DEBUG_UART_BAUDRATE (115200U)
#endif

 

Thanks.

Labels (2)
0 Kudos
Reply
1 Solution
1,303 Views
jay_heng
NXP Employee
NXP Employee

Your code modification is enough for your case. please double check HW setting.

I tried to change debug UART port to UART3 and tested it on MIMXRT1060-EVK (J22-1&2), it worked well.

View solution in original post

0 Kudos
Reply
1 Reply
1,304 Views
jay_heng
NXP Employee
NXP Employee

Your code modification is enough for your case. please double check HW setting.

I tried to change debug UART port to UART3 and tested it on MIMXRT1060-EVK (J22-1&2), it worked well.

0 Kudos
Reply