Skip to content

Commit 203c17f

Browse files
authored
Merge pull request #439 from MulattoKid/uart_baseaddr_4
Add support for LPUART4 for i.MX RT10xx
2 parents 4e8fccb + 322a101 commit 203c17f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

hal/imx_rt.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ static void clock_init(void)
731731
/* The UART interface (LPUART1 - LPUART8) */
732732
#ifndef UART_BASEADDR
733733
#define UART_BASEADDR LPUART1
734+
#define UART_BASE LPUART1_BASE
734735
#endif
735736
#ifndef UART_BAUDRATE
736737
#define UART_BAUDRATE (115200U)
@@ -741,7 +742,7 @@ void uart_init(void)
741742
lpuart_config_t config;
742743
uint32_t uartClkSrcFreq = 20000000U; /* 20 MHz */
743744

744-
#if UART_BASEADDR == LPUART1
745+
#if UART_BASE == LPUART1_BASE
745746
/* Configure the UART IO pins for LPUART1
746747
* Tested with RT1040, RT1050, RT1062 and RT1064
747748
*/
@@ -750,6 +751,17 @@ void uart_init(void)
750751
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0U);
751752
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0x10B0U);
752753
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0x10B0U);
754+
#elif UART_BASE == LPUART4_BASE
755+
/* Configure the UART IO pins for one combination for LPUART4
756+
* Tested with RT1040
757+
*/
758+
CLOCK_EnableClock(kCLOCK_Iomuxc);
759+
IOMUXC_SetPinMux(IOMUXC_GPIO_B1_00_LPUART4_TX, 0U);
760+
IOMUXC_SetPinMux(IOMUXC_GPIO_B1_01_LPUART4_RX, 0U);
761+
IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_00_LPUART4_TX, 0x10B0U);
762+
IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_01_LPUART4_RX, 0x10B0U);
763+
#else
764+
#error Unsupported UART_BASEADDR/UART_BASE
753765
#endif
754766

755767
LPUART_GetDefaultConfig(&config);

0 commit comments

Comments
 (0)