Skip to content

Commit

Permalink
Merge pull request wolfSSL#439 from MulattoKid/uart_baseaddr_4
Browse files Browse the repository at this point in the history
Add support for LPUART4 for i.MX RT10xx
  • Loading branch information
bigbrett committed Apr 19, 2024
2 parents 4e8fccb + 322a101 commit 203c17f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion hal/imx_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ static void clock_init(void)
/* The UART interface (LPUART1 - LPUART8) */
#ifndef UART_BASEADDR
#define UART_BASEADDR LPUART1
#define UART_BASE LPUART1_BASE
#endif
#ifndef UART_BAUDRATE
#define UART_BAUDRATE (115200U)
Expand All @@ -741,7 +742,7 @@ void uart_init(void)
lpuart_config_t config;
uint32_t uartClkSrcFreq = 20000000U; /* 20 MHz */

#if UART_BASEADDR == LPUART1
#if UART_BASE == LPUART1_BASE
/* Configure the UART IO pins for LPUART1
* Tested with RT1040, RT1050, RT1062 and RT1064
*/
Expand All @@ -750,6 +751,17 @@ void uart_init(void)
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0x10B0U);
#elif UART_BASE == LPUART4_BASE
/* Configure the UART IO pins for one combination for LPUART4
* Tested with RT1040
*/
CLOCK_EnableClock(kCLOCK_Iomuxc);
IOMUXC_SetPinMux(IOMUXC_GPIO_B1_00_LPUART4_TX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_B1_01_LPUART4_RX, 0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_00_LPUART4_TX, 0x10B0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_01_LPUART4_RX, 0x10B0U);
#else
#error Unsupported UART_BASEADDR/UART_BASE
#endif

LPUART_GetDefaultConfig(&config);
Expand Down

0 comments on commit 203c17f

Please sign in to comment.