Skip to content

Commit be0161e

Browse files
authored
[bsp][nxp][mcxa153] add more UART channels (#9635)
* [bsp][nxp][mcxa153] add more UART channels
1 parent f093463 commit be0161e

File tree

3 files changed

+151
-1
lines changed

3 files changed

+151
-1
lines changed

bsp/nxp/mcx/mcxa/Libraries/drivers/drv_uart.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2024-02-06 yandld The first version for MCX
9+
* 2024-11-11 hywing add more UART channels
910
*/
1011
#include <rtdevice.h>
1112
#include "drv_uart.h"
@@ -35,6 +36,22 @@ void LPUART0_IRQHandler(void)
3536
uart_isr(&serial0);
3637
}
3738
#endif
39+
#if defined(BSP_USING_UART1)
40+
struct rt_serial_device serial1;
41+
42+
void LPUART1_IRQHandler(void)
43+
{
44+
uart_isr(&serial1);
45+
}
46+
#endif
47+
#if defined(BSP_USING_UART2)
48+
struct rt_serial_device serial2;
49+
50+
void LPUART2_IRQHandler(void)
51+
{
52+
uart_isr(&serial2);
53+
}
54+
#endif
3855

3956
static const struct mcx_uart uarts[] =
4057
{
@@ -50,6 +67,30 @@ static const struct mcx_uart uarts[] =
5067
"uart0",
5168
},
5269
#endif
70+
#ifdef BSP_USING_UART1
71+
{
72+
&serial1,
73+
LPUART1,
74+
LPUART1_IRQn,
75+
kCLOCK_Fro12M,
76+
kFRO12M_to_LPUART1,
77+
kCLOCK_GateLPUART1,
78+
kCLOCK_DivLPUART1,
79+
"uart1",
80+
},
81+
#endif
82+
#ifdef BSP_USING_UART2
83+
{
84+
&serial2,
85+
LPUART2,
86+
LPUART2_IRQn,
87+
kCLOCK_Fro12M,
88+
kFRO12M_to_LPUART2,
89+
kCLOCK_GateLPUART2,
90+
kCLOCK_DivLPUART2,
91+
"uart2",
92+
},
93+
#endif
5394
};
5495

5596
static rt_err_t mcx_configure(struct rt_serial_device *serial, struct serial_configure *cfg)

bsp/nxp/mcx/mcxa/frdm-mcxa153/board/Kconfig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ menu "On-chip Peripheral Drivers"
2727

2828
if BSP_USING_UART
2929
config BSP_USING_UART0
30-
bool "Enable LPUART as UART"
30+
bool "Enable LPUART as UART0"
3131
default y
32+
config BSP_USING_UART1
33+
bool "Enable LPUART as UART1"
34+
default n
35+
config BSP_USING_UART2
36+
bool "Enable LPUART as UART2"
37+
default n
3238
endif
3339

3440
menuconfig BSP_USING_I2C

bsp/nxp/mcx/mcxa/frdm-mcxa153/board/MCUX_Config/board/pin_mux.c

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,109 @@ void BOARD_InitPins(void)
117117
/* PORT0_3 (pin 52) is configured as LPUART0_TXD */
118118
PORT_SetPinConfig(PORT0, 3U, &port0_3_pin52_config);
119119

120+
#ifdef BSP_USING_UART1
121+
const port_pin_config_t port1_8_pin2_config = {/* Internal pull-up resistor is enabled */
122+
kPORT_PullUp,
123+
/* Low internal pull resistor value is selected. */
124+
kPORT_LowPullResistor,
125+
/* Fast slew rate is configured */
126+
kPORT_FastSlewRate,
127+
/* Passive input filter is disabled */
128+
kPORT_PassiveFilterDisable,
129+
/* Open drain output is disabled */
130+
kPORT_OpenDrainDisable,
131+
/* Low drive strength is configured */
132+
kPORT_LowDriveStrength,
133+
/* Normal drive strength is configured */
134+
kPORT_NormalDriveStrength,
135+
/* Pin is configured as LPUART1_RXD */
136+
kPORT_MuxAlt2,
137+
/* Digital input enabled */
138+
kPORT_InputBufferEnable,
139+
/* Digital input is not inverted */
140+
kPORT_InputNormal,
141+
/* Pin Control Register fields [15:0] are not locked */
142+
kPORT_UnlockRegister};
143+
/* PORT1_8 (pin 2) is configured as LPUART1_RXD */
144+
PORT_SetPinConfig(PORT1, 8U, &port1_8_pin2_config);
145+
146+
const port_pin_config_t port1_9_pin3_config = {/* Internal pull-up resistor is enabled */
147+
kPORT_PullUp,
148+
/* Low internal pull resistor value is selected. */
149+
kPORT_LowPullResistor,
150+
/* Fast slew rate is configured */
151+
kPORT_FastSlewRate,
152+
/* Passive input filter is disabled */
153+
kPORT_PassiveFilterDisable,
154+
/* Open drain output is disabled */
155+
kPORT_OpenDrainDisable,
156+
/* Low drive strength is configured */
157+
kPORT_LowDriveStrength,
158+
/* Normal drive strength is configured */
159+
kPORT_NormalDriveStrength,
160+
/* Pin is configured as LPUART1_TXD */
161+
kPORT_MuxAlt2,
162+
/* Digital input enabled */
163+
kPORT_InputBufferEnable,
164+
/* Digital input is not inverted */
165+
kPORT_InputNormal,
166+
/* Pin Control Register fields [15:0] are not locked */
167+
kPORT_UnlockRegister};
168+
/* PORT1_9 (pin 3) is configured as LPUART1_TXD */
169+
PORT_SetPinConfig(PORT1, 9U, &port1_9_pin3_config);
170+
#endif
171+
#ifdef BSP_USING_UART2
172+
const port_pin_config_t port3_14_pin36_config = {/* Internal pull-up resistor is enabled */
173+
kPORT_PullUp,
174+
/* Low internal pull resistor value is selected. */
175+
kPORT_LowPullResistor,
176+
/* Fast slew rate is configured */
177+
kPORT_FastSlewRate,
178+
/* Passive input filter is disabled */
179+
kPORT_PassiveFilterDisable,
180+
/* Open drain output is disabled */
181+
kPORT_OpenDrainDisable,
182+
/* Low drive strength is configured */
183+
kPORT_LowDriveStrength,
184+
/* Normal drive strength is configured */
185+
kPORT_NormalDriveStrength,
186+
/* Pin is configured as LPUART2_RXD */
187+
kPORT_MuxAlt2,
188+
/* Digital input enabled */
189+
kPORT_InputBufferEnable,
190+
/* Digital input is not inverted */
191+
kPORT_InputNormal,
192+
/* Pin Control Register fields [15:0] are not locked */
193+
kPORT_UnlockRegister};
194+
/* PORT3_14 (pin 36) is configured as LPUART2_RXD */
195+
PORT_SetPinConfig(PORT3, 14U, &port3_14_pin36_config);
196+
197+
const port_pin_config_t port3_15_pin35_config = {/* Internal pull-up resistor is enabled */
198+
kPORT_PullUp,
199+
/* Low internal pull resistor value is selected. */
200+
kPORT_LowPullResistor,
201+
/* Fast slew rate is configured */
202+
kPORT_FastSlewRate,
203+
/* Passive input filter is disabled */
204+
kPORT_PassiveFilterDisable,
205+
/* Open drain output is disabled */
206+
kPORT_OpenDrainDisable,
207+
/* Low drive strength is configured */
208+
kPORT_LowDriveStrength,
209+
/* Normal drive strength is configured */
210+
kPORT_NormalDriveStrength,
211+
/* Pin is configured as LPUART2_TXD */
212+
kPORT_MuxAlt2,
213+
/* Digital input enabled */
214+
kPORT_InputBufferEnable,
215+
/* Digital input is not inverted */
216+
kPORT_InputNormal,
217+
/* Pin Control Register fields [15:0] are not locked */
218+
kPORT_UnlockRegister};
219+
/* PORT3_15 (pin 35) is configured as LPUART2_TXD */
220+
PORT_SetPinConfig(PORT3, 15U, &port3_15_pin35_config);
221+
#endif
222+
120223
#ifdef BSP_USING_PWM0
121224
ctimer_config_t config;
122225
CTIMER_Init(CTIMER1, &config);

0 commit comments

Comments
 (0)