Skip to content

Commit 923b3ba

Browse files
committed
boards: frdm_mcxa344: add frdm_mcxa344 board
enable board support for frdm_mcxa344 Signed-off-by: Neil Chen <[email protected]>
1 parent ec8e235 commit 923b3ba

File tree

12 files changed

+577
-0
lines changed

12 files changed

+577
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright 2025 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_library()
8+
zephyr_library_sources(board.c)

boards/nxp/frdm_mcxa344/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_FRDM_MCXA344
5+
select BOARD_EARLY_INIT_HOOK
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_FRDM_MCXA344
5+
select SOC_MCXA344
6+
select SOC_PART_NUMBER_MCXA344VLL

boards/nxp/frdm_mcxa344/board.c

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/*
2+
* Copyright 2025 NXP
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
#include <zephyr/init.h>
6+
#include <zephyr/device.h>
7+
#include <zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h>
8+
#include <fsl_clock.h>
9+
#include <fsl_spc.h>
10+
#include <soc.h>
11+
12+
/* Core clock frequency: 180MHz */
13+
#define CLOCK_INIT_CORE_CLOCK 180000000U
14+
#define BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK 180000000U
15+
/* System clock frequency. */
16+
extern uint32_t SystemCoreClock;
17+
18+
void board_early_init_hook(void)
19+
{
20+
uint32_t coreFreq;
21+
spc_active_mode_core_ldo_option_t ldoOption;
22+
spc_sram_voltage_config_t sramOption;
23+
24+
/* Get the CPU Core frequency */
25+
coreFreq = CLOCK_GetCoreSysClkFreq();
26+
27+
/* The flow of increasing voltage and frequency */
28+
if (coreFreq <= BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK) {
29+
/* Set the LDO_CORE VDD regulator level */
30+
ldoOption.CoreLDOVoltage = kSPC_CoreLDO_OverDriveVoltage;
31+
ldoOption.CoreLDODriveStrength = kSPC_CoreLDO_NormalDriveStrength;
32+
(void)SPC_SetActiveModeCoreLDORegulatorConfig(SPC0, &ldoOption);
33+
/* Configure Flash to support different voltage level and frequency */
34+
FMU0->FCTRL =
35+
(FMU0->FCTRL & ~((uint32_t)FMU_FCTRL_RWSC_MASK)) | (FMU_FCTRL_RWSC(0x4U));
36+
/* Specifies the operating voltage for the SRAM's read/write timing margin */
37+
sramOption.operateVoltage = kSPC_sramOperateAt1P2V;
38+
sramOption.requestVoltageUpdate = true;
39+
(void)SPC_SetSRAMOperateVoltage(SPC0, &sramOption);
40+
}
41+
42+
/*!< Set up system dividers */
43+
CLOCK_SetClockDiv(kCLOCK_DivAHBCLK, 1U); /* !< Set SYSCON.AHBCLKDIV divider to value 1 */
44+
CLOCK_SetClockDiv(kCLOCK_DivFRO_HF, 1U); /* !< Set SYSCON.FROHFDIV divider to value 1 */
45+
CLOCK_SetupFROHFClocking(BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK); /*!< Enable FRO HF */
46+
CLOCK_SetupFRO12MClocking(); /*!< Setup FRO12M clock */
47+
48+
CLOCK_AttachClk(kFRO_HF_to_MAIN_CLK); /* !< Switch MAIN_CLK to kFRO_HF */
49+
50+
/* The flow of decreasing voltage and frequency */
51+
if (coreFreq > BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK) {
52+
/* Configure Flash to support different voltage level and frequency */
53+
FMU0->FCTRL =
54+
(FMU0->FCTRL & ~((uint32_t)FMU_FCTRL_RWSC_MASK)) | (FMU_FCTRL_RWSC(0x4U));
55+
/* Specifies the operating voltage for the SRAM's read/write timing margin */
56+
sramOption.operateVoltage = kSPC_sramOperateAt1P2V;
57+
sramOption.requestVoltageUpdate = true;
58+
(void)SPC_SetSRAMOperateVoltage(SPC0, &sramOption);
59+
/* Set the LDO_CORE VDD regulator level */
60+
ldoOption.CoreLDOVoltage = kSPC_CoreLDO_OverDriveVoltage;
61+
ldoOption.CoreLDODriveStrength = kSPC_CoreLDO_NormalDriveStrength;
62+
(void)SPC_SetActiveModeCoreLDORegulatorConfig(SPC0, &ldoOption);
63+
}
64+
65+
/*!< Set up clock selectors - Attach clocks to the peripheries */
66+
CLOCK_AttachClk(kCPU_CLK_to_TRACE); /* !< Switch TRACE to CPU_CLK */
67+
68+
/*!< Set up dividers */
69+
CLOCK_SetClockDiv(kCLOCK_DivFRO_LF, 1U); /* !< Set SYSCON.FROLFDIV divider to value 1 */
70+
CLOCK_SetClockDiv(kCLOCK_DivTRACE, 2U); /* !< Set MRCC.TRACE_CLKDIV divider to value 2 */
71+
72+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porta))
73+
RESET_ReleasePeripheralReset(kPORT0_RST_SHIFT_RSTn);
74+
CLOCK_EnableClock(kCLOCK_GatePORT0);
75+
#endif
76+
77+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portb))
78+
RESET_ReleasePeripheralReset(kPORT1_RST_SHIFT_RSTn);
79+
CLOCK_EnableClock(kCLOCK_GatePORT1);
80+
#endif
81+
82+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portc))
83+
RESET_ReleasePeripheralReset(kPORT2_RST_SHIFT_RSTn);
84+
CLOCK_EnableClock(kCLOCK_GatePORT2);
85+
#endif
86+
87+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portd))
88+
RESET_ReleasePeripheralReset(kPORT3_RST_SHIFT_RSTn);
89+
CLOCK_EnableClock(kCLOCK_GatePORT3);
90+
#endif
91+
92+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porte))
93+
RESET_ReleasePeripheralReset(kPORT4_RST_SHIFT_RSTn);
94+
CLOCK_EnableClock(kCLOCK_GatePORT4);
95+
#endif
96+
97+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0))
98+
RESET_ReleasePeripheralReset(kGPIO0_RST_SHIFT_RSTn);
99+
CLOCK_EnableClock(kCLOCK_GateGPIO0);
100+
#endif
101+
102+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1))
103+
RESET_ReleasePeripheralReset(kGPIO1_RST_SHIFT_RSTn);
104+
CLOCK_EnableClock(kCLOCK_GateGPIO1);
105+
#endif
106+
107+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2))
108+
RESET_ReleasePeripheralReset(kGPIO2_RST_SHIFT_RSTn);
109+
CLOCK_EnableClock(kCLOCK_GateGPIO2);
110+
#endif
111+
112+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3))
113+
RESET_ReleasePeripheralReset(kGPIO3_RST_SHIFT_RSTn);
114+
CLOCK_EnableClock(kCLOCK_GateGPIO3);
115+
#endif
116+
117+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4))
118+
RESET_ReleasePeripheralReset(kGPIO4_RST_SHIFT_RSTn);
119+
CLOCK_EnableClock(kCLOCK_GateGPIO4);
120+
#endif
121+
122+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0))
123+
CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u);
124+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART0);
125+
RESET_ReleasePeripheralReset(kLPUART0_RST_SHIFT_RSTn);
126+
#endif
127+
128+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1))
129+
CLOCK_SetClockDiv(kCLOCK_DivLPUART1, 1u);
130+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART1);
131+
RESET_ReleasePeripheralReset(kLPUART1_RST_SHIFT_RSTn);
132+
#endif
133+
134+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2))
135+
CLOCK_SetClockDiv(kCLOCK_DivLPUART2, 1u);
136+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART2);
137+
RESET_ReleasePeripheralReset(kLPUART2_RST_SHIFT_RSTn);
138+
#endif
139+
140+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart3))
141+
CLOCK_SetClockDiv(kCLOCK_DivLPUART3, 1u);
142+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART3);
143+
RESET_ReleasePeripheralReset(kLPUART3_RST_SHIFT_RSTn);
144+
#endif
145+
146+
/* Set SystemCoreClock variable. */
147+
SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
148+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright 2025 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
board_runner_args(jlink "--device=MCXA344")
8+
board_runner_args(linkserver "--device=MCXA344:FRDM-MCXA344")
9+
board_runner_args(pyocd "--target=MCXA344")
10+
11+
include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake)
12+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
13+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)

boards/nxp/frdm_mcxa344/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: frdm_mcxa344
3+
full_name: FRDM-MCXA344
4+
vendor: nxp
5+
socs:
6+
- name: mcxa344
62.3 KB
Loading
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
.. zephyr:board:: frdm_mcxa344
2+
3+
Overview
4+
********
5+
6+
FRDM-MCXA344 is a compact and scalable development board for rapid prototyping of MCX A344
7+
MCUs. They offer industry standard headers for easy access to the MCUs input/output (I/O),
8+
integrated open-standard serial interfaces, external flash memory and an onboard MCU-Link
9+
debugger.
10+
11+
Hardware
12+
********
13+
14+
- MCX-A344 Arm Cortex-M33 microcontroller running at 180 MHz
15+
- 256KB dual-bank on chip Flash
16+
- 64 KB RAM
17+
- 1x FlexCAN with FD, 1x RGB LED, 3x SW buttons
18+
- On-board MCU-Link debugger with CMSIS-DAP
19+
- Arduino Header, SmartDMA/Camera Header, mikroBUS
20+
21+
For more information about the MCX-A344 SoC and FRDM-MCXA344 board, see:
22+
23+
- `MCX-A344 SoC Website`_
24+
- `MCX-A344 Datasheet`_
25+
- `MCX-A344 Reference Manual`_
26+
- `FRDM-MCXA344 Website`_
27+
- `FRDM-MCXA344 User Guide`_
28+
- `FRDM-MCXA344 Board User Manual`_
29+
- `FRDM-MCXA344 Schematics`_
30+
31+
Supported Features
32+
==================
33+
34+
.. zephyr:board-supported-hw::
35+
36+
Connections and IOs
37+
===================
38+
39+
The MCX-A344 SoC has 5 gpio controllers and has pinmux registers which
40+
can be used to configure the functionality of a pin.
41+
42+
+------------+-----------------+----------------------------+
43+
| Name | Function | Usage |
44+
+============+=================+============================+
45+
| PIO2_3 | UART | UART RX |
46+
+------------+-----------------+----------------------------+
47+
| PIO2_2 | UART | UART TX |
48+
+------------+-----------------+----------------------------+
49+
50+
System Clock
51+
============
52+
53+
The MCX-A344 SoC is configured to use FRO running at 180MHz as a source for
54+
the system clock.
55+
56+
Serial Port
57+
===========
58+
59+
The FRDM-MCXA344 SoC has 4 LPUART interfaces for serial communication.
60+
LPUART 2 is configured as UART for the console.
61+
62+
Programming and Debugging
63+
*************************
64+
65+
.. zephyr:board-supported-runners::
66+
67+
Build and flash applications as usual (see :ref:`build_an_application` and
68+
:ref:`application_run` for more details).
69+
70+
Configuring a Debug Probe
71+
=========================
72+
73+
A debug probe is used for both flashing and debugging the board. This board is
74+
configured by default to use the MCU-Link CMSIS-DAP Onboard Debug Probe.
75+
76+
Using LinkServer
77+
----------------
78+
79+
Linkserver is the default runner for this board, and supports the factory
80+
default MCU-Link firmware. Follow the instructions in
81+
:ref:`mcu-link-cmsis-onboard-debug-probe` to reprogram the default MCU-Link
82+
firmware. This only needs to be done if the default onboard debug circuit
83+
firmware was changed. To put the board in ``ISP mode`` to program the firmware,
84+
short jumper JP4.
85+
86+
Using J-Link
87+
------------
88+
89+
There are two options. The onboard debug circuit can be updated with Segger
90+
J-Link firmware by following the instructions in
91+
:ref:`mcu-link-jlink-onboard-debug-probe`.
92+
To be able to program the firmware, you need to put the board in ``ISP mode``
93+
by shortening the jumper JP4.
94+
The second option is to attach a :ref:`jlink-external-debug-probe` to the
95+
10-pin SWD connector (J11) of the board. Additionally, the jumper JP6 must
96+
be shorted.
97+
For both options use the ``-r jlink`` option with west to use the jlink runner.
98+
99+
.. code-block:: console
100+
101+
west flash -r jlink
102+
103+
Configuring a Console
104+
=====================
105+
106+
Connect a USB cable from your PC to J13, and use the serial terminal of your choice
107+
(minicom, putty, etc.) with the following settings:
108+
109+
- Speed: 115200
110+
- Data: 8 bits
111+
- Parity: None
112+
- Stop bits: 1
113+
114+
Flashing
115+
========
116+
117+
Here is an example for the :zephyr:code-sample:`hello_world` application.
118+
119+
.. zephyr-app-commands::
120+
:zephyr-app: samples/hello_world
121+
:board: frdm_mcxa344
122+
:goals: flash
123+
124+
Open a serial terminal, reset the board (press the RESET button), and you should
125+
see the following message in the terminal:
126+
127+
.. code-block:: console
128+
129+
*** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 ***
130+
Hello World! frdm_mcxa344/mcxa344
131+
132+
Debugging
133+
=========
134+
135+
Here is an example for the :zephyr:code-sample:`hello_world` application.
136+
137+
.. zephyr-app-commands::
138+
:zephyr-app: samples/hello_world
139+
:board: frdm_mcxa344/mcxa344
140+
:goals: debug
141+
142+
Open a serial terminal, step through the application in your debugger, and you
143+
should see the following message in the terminal:
144+
145+
.. code-block:: console
146+
147+
*** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 ***
148+
Hello World! frdm_mcxa344/mcxa344
149+
150+
Troubleshooting
151+
===============
152+
153+
.. include:: ../../common/segger-ecc-systemview.rst.inc
154+
155+
.. include:: ../../common/board-footer.rst.inc
156+
157+
.. _MCX-A344 SoC Website:
158+
https://www.nxp.com/products/MCX-A34X
159+
160+
.. _MCX-A344 Datasheet:
161+
TBD
162+
163+
.. _MCX-A344 Reference Manual:
164+
TBD
165+
166+
.. _FRDM-MCXA344 Website:
167+
https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA344
168+
169+
.. _FRDM-MCXA344 User Guide:
170+
https://www.nxp.com/document/guide/getting-started-with-frdm-mcxa344:GS-FRDM-MCXA344
171+
172+
.. _FRDM-MCXA344 Board User Manual:
173+
TBD
174+
175+
.. _FRDM-MCXA344 Schematics:
176+
TBD
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2025 NXP
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
7+
#include <nxp/mcx/MCXA344VLL-pinctrl.h>
8+
9+
&pinctrl {
10+
pinmux_lpuart2: pinmux_lpuart2 {
11+
group0 {
12+
pinmux = <LPUART2_RXD_P2_3>,
13+
<LPUART2_TXD_P2_2>;
14+
drive-strength = "low";
15+
slew-rate = "fast";
16+
input-enable;
17+
};
18+
};
19+
};

0 commit comments

Comments
 (0)