From 09d24a667604f2f1c61edc870ffa0d183d88c493 Mon Sep 17 00:00:00 2001 From: Yilin Sun Date: Wed, 19 Feb 2025 14:59:44 +0800 Subject: [PATCH 1/2] bsp: nxp/mcx/mcxa/frdm-mcxa156: Enable PORT and GPIO clocks. Enable PORT and GPIO peripheral clocks and release resets for all ports. Signed-off-by: Yilin Sun --- .../board/MCUX_Config/board/pin_mux.c | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/MCUX_Config/board/pin_mux.c b/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/MCUX_Config/board/pin_mux.c index c9be992461a..d4ed54f4692 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/MCUX_Config/board/pin_mux.c +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/MCUX_Config/board/pin_mux.c @@ -59,12 +59,31 @@ void BOARD_InitBootPins(void) * END ****************************************************************************************************************/ void BOARD_InitPins(void) { - /* PORT0: Peripheral clock is enabled */ + /* Enable all PORT clocks */ CLOCK_EnableClock(kCLOCK_GatePORT0); - /* LPUART0 peripheral is released from reset */ - RESET_ReleasePeripheralReset(kLPUART0_RST_SHIFT_RSTn); - /* PORT0 peripheral is released from reset */ + CLOCK_EnableClock(kCLOCK_GatePORT1); + CLOCK_EnableClock(kCLOCK_GatePORT2); + CLOCK_EnableClock(kCLOCK_GatePORT3); + + /* Enable all GPIO clocks */ + CLOCK_EnableClock(kCLOCK_GateGPIO0); + CLOCK_EnableClock(kCLOCK_GateGPIO1); + CLOCK_EnableClock(kCLOCK_GateGPIO2); + CLOCK_EnableClock(kCLOCK_GateGPIO3); + + /* Release all PORT resets */ RESET_ReleasePeripheralReset(kPORT0_RST_SHIFT_RSTn); + RESET_ReleasePeripheralReset(kPORT1_RST_SHIFT_RSTn); + RESET_ReleasePeripheralReset(kPORT2_RST_SHIFT_RSTn); + RESET_ReleasePeripheralReset(kPORT3_RST_SHIFT_RSTn); + + RESET_ReleasePeripheralReset(kGPIO0_RST_SHIFT_RSTn); + RESET_ReleasePeripheralReset(kGPIO1_RST_SHIFT_RSTn); + RESET_ReleasePeripheralReset(kGPIO2_RST_SHIFT_RSTn); + RESET_ReleasePeripheralReset(kGPIO3_RST_SHIFT_RSTn); + + /* Release LPUART0 resets */ + RESET_ReleasePeripheralReset(kLPUART0_RST_SHIFT_RSTn); const port_pin_config_t port0_2_pin78_config = {/* Internal pull-up resistor is enabled */ kPORT_PullUp, @@ -115,6 +134,31 @@ void BOARD_InitPins(void) kPORT_UnlockRegister}; /* PORT0_3 (pin 79) is configured as LPUART0_TXD */ PORT_SetPinConfig(PORT0, 3U, &port0_3_pin79_config); + + const port_pin_config_t port3_12_pin63_config = {/* Internal pull-up resistor is enabled */ + kPORT_PullDisable, + /* Low internal pull resistor value is selected. */ + kPORT_LowPullResistor, + /* Fast slew rate is configured */ + kPORT_FastSlewRate, + /* Passive input filter is disabled */ + kPORT_PassiveFilterDisable, + /* Open drain output is disabled */ + kPORT_OpenDrainEnable, + /* Low drive strength is configured */ + kPORT_LowDriveStrength, + /* Normal drive strength is configured */ + kPORT_NormalDriveStrength, + /* Pin is configured as LPUART0_TXD */ + kPORT_MuxAsGpio, + /* Digital input enabled */ + kPORT_InputBufferEnable, + /* Digital input is not inverted */ + kPORT_InputNormal, + /* Pin Control Register fields [15:0] are not locked */ + kPORT_UnlockRegister}; + /* PORT3_12 (pin 63) is configured as LED_RED */ + PORT_SetPinConfig(PORT3, 12U, &port3_12_pin63_config); } /*********************************************************************************************************************** * EOF From 8ec87a895a5ebc398f9fdd2901b4e10d07907b19 Mon Sep 17 00:00:00 2001 From: Yilin Sun Date: Wed, 19 Feb 2025 15:00:40 +0800 Subject: [PATCH 2/2] bsp: nxp/mcx/mcxa/frdm-mcxa156: Add LED blinking demo. Add LED blinking demo to align with other BSPs. Signed-off-by: Yilin Sun --- bsp/nxp/mcx/mcxa/frdm-mcxa156/applications/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa156/applications/main.c b/bsp/nxp/mcx/mcxa/frdm-mcxa156/applications/main.c index d229d56b1c1..a387a24eafa 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa156/applications/main.c +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa156/applications/main.c @@ -29,10 +29,15 @@ int main(void) rt_kprintf("using gcc, version: %d.%d\n", __GNUC__, __GNUC_MINOR__); #endif + rt_kprintf("MCXA156 HelloWorld\r\n"); + rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT); /* Set GPIO as Output */ + while (1) { - rt_thread_mdelay(1000); /* Delay 1S */ - rt_kprintf("MCXA156 HelloWorld\r\n"); + rt_pin_write(LED_PIN, PIN_HIGH); /* Set GPIO output 1 */ + rt_thread_mdelay(500); /* Delay 500mS */ + rt_pin_write(LED_PIN, PIN_LOW); /* Set GPIO output 0 */ + rt_thread_mdelay(500); /* Delay 500mS */ } }