Skip to content

Commit 74bb5b3

Browse files
NeilChen93nashif
authored andcommitted
boards: frdm_mcxa156: add frdm_mcxa156 board
add frdm_mcxa156 board support Signed-off-by: Neil Chen <[email protected]>
1 parent 810e6a1 commit 74bb5b3

File tree

12 files changed

+509
-0
lines changed

12 files changed

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

boards/nxp/frdm_mcxa156/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2024 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_INIT_PRIORITY
5+
int "Board initialization priority"
6+
default 1
7+
help
8+
Board initialization priority.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2024 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_FRDM_MCXA156
5+
select SOC_MCXA156 if BOARD_FRDM_MCXA156
6+
select SOC_PART_NUMBER_MCXA156VLL

boards/nxp/frdm_mcxa156/board.c

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
* Copyright 2024 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: 150MHz */
13+
#define CLOCK_INIT_CORE_CLOCK 960000000U
14+
#define BOARD_BOOTCLOCKFRO96M_CORE_CLOCK 960000000U
15+
/* System clock frequency. */
16+
extern uint32_t SystemCoreClock;
17+
18+
static int frdm_mcxa156_init(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_BOOTCLOCKFRO96M_CORE_CLOCK) {
29+
/* Set the LDO_CORE VDD regulator level */
30+
ldoOption.CoreLDOVoltage = kSPC_CoreLDO_NormalVoltage;
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(0x2U));
36+
/* Specifies the operating voltage for the SRAM's read/write timing margin */
37+
sramOption.operateVoltage = kSPC_sramOperateAt1P1V;
38+
sramOption.requestVoltageUpdate = true;
39+
(void)SPC_SetSRAMOperateVoltage(SPC0, &sramOption);
40+
}
41+
42+
CLOCK_SetupFROHFClocking(96000000U); /*!< Enable FRO HF(96MHz) output */
43+
44+
CLOCK_SetupFRO12MClocking(); /*!< Setup FRO12M clock */
45+
46+
CLOCK_AttachClk(kFRO_HF_to_MAIN_CLK); /* !< Switch MAIN_CLK to FRO_HF */
47+
48+
/* The flow of decreasing voltage and frequency */
49+
if (coreFreq > BOARD_BOOTCLOCKFRO96M_CORE_CLOCK) {
50+
/* Configure Flash to support different voltage level and frequency */
51+
FMU0->FCTRL =
52+
(FMU0->FCTRL & ~((uint32_t)FMU_FCTRL_RWSC_MASK)) | (FMU_FCTRL_RWSC(0x2U));
53+
/* Specifies the operating voltage for the SRAM's read/write timing margin */
54+
sramOption.operateVoltage = kSPC_sramOperateAt1P1V;
55+
sramOption.requestVoltageUpdate = true;
56+
(void)SPC_SetSRAMOperateVoltage(SPC0, &sramOption);
57+
/* Set the LDO_CORE VDD regulator level */
58+
ldoOption.CoreLDOVoltage = kSPC_CoreLDO_NormalVoltage;
59+
ldoOption.CoreLDODriveStrength = kSPC_CoreLDO_NormalDriveStrength;
60+
(void)SPC_SetActiveModeCoreLDORegulatorConfig(SPC0, &ldoOption);
61+
}
62+
63+
/*!< Set up clock selectors - Attach clocks to the peripheries */
64+
65+
/*!< Set up dividers */
66+
CLOCK_SetClockDiv(kCLOCK_DivAHBCLK, 1U); /* !< Set AHBCLKDIV divider to value 1 */
67+
CLOCK_SetClockDiv(kCLOCK_DivFRO_HF_DIV, 1U); /* !< Set FROHFDIV divider to value 1 */
68+
69+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay)
70+
RESET_ReleasePeripheralReset(kPORT0_RST_SHIFT_RSTn);
71+
#endif
72+
73+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay)
74+
RESET_ReleasePeripheralReset(kPORT1_RST_SHIFT_RSTn);
75+
#endif
76+
77+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay)
78+
RESET_ReleasePeripheralReset(kPORT2_RST_SHIFT_RSTn);
79+
#endif
80+
81+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay)
82+
RESET_ReleasePeripheralReset(kPORT3_RST_SHIFT_RSTn);
83+
#endif
84+
85+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(porte), okay)
86+
RESET_ReleasePeripheralReset(kPORT4_RST_SHIFT_RSTn);
87+
#endif
88+
89+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay)
90+
RESET_ReleasePeripheralReset(kGPIO0_RST_SHIFT_RSTn);
91+
CLOCK_EnableClock(kCLOCK_GateGPIO0);
92+
#endif
93+
94+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay)
95+
RESET_ReleasePeripheralReset(kGPIO1_RST_SHIFT_RSTn);
96+
CLOCK_EnableClock(kCLOCK_GateGPIO1);
97+
#endif
98+
99+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay)
100+
RESET_ReleasePeripheralReset(kGPIO2_RST_SHIFT_RSTn);
101+
CLOCK_EnableClock(kCLOCK_GateGPIO2);
102+
#endif
103+
104+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay)
105+
RESET_ReleasePeripheralReset(kGPIO3_RST_SHIFT_RSTn);
106+
CLOCK_EnableClock(kCLOCK_GateGPIO3);
107+
#endif
108+
109+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay)
110+
RESET_ReleasePeripheralReset(kGPIO4_RST_SHIFT_RSTn);
111+
CLOCK_EnableClock(kCLOCK_GateGPIO4);
112+
#endif
113+
114+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay)
115+
CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u);
116+
CLOCK_AttachClk(kFRO12M_to_LPUART0);
117+
#endif
118+
119+
/* Set SystemCoreClock variable. */
120+
SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
121+
122+
return 0;
123+
}
124+
125+
SYS_INIT(frdm_mcxa156_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright 2024 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
board_runner_args(jlink "--device=MCXA156")
8+
board_runner_args(linkserver "--device=MCXA156:FRDM-MCXA156")
9+
board_runner_args(pyocd "--target=mcxA156")
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_mcxa156/board.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
board:
2+
name: frdm_mcxa156
3+
vendor: nxp
4+
socs:
5+
- name: mcxa156
85.7 KB
Loading
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
.. _frdm_mcxa156:
2+
3+
NXP FRDM-MCXA156
4+
################
5+
6+
Overview
7+
********
8+
9+
FRDM-MCXA156 are compact and scalable development boards for rapid prototyping of
10+
MCX A15X MCUs. They offer industry standard headers for easy access to the
11+
MCUs I/Os, integrated open-standard serial interfaces, external flash memory and
12+
an on-board MCU-Link debugger. MCX N Series are high-performance, low-power
13+
microcontrollers with intelligent peripherals and accelerators providing multi-tasking
14+
capabilities and performance efficiency.
15+
16+
.. image:: frdm_mcxa156.webp
17+
:align: center
18+
:alt: FRDM-MCXA156
19+
20+
Hardware
21+
********
22+
23+
- MCX-A156 Arm Cortex-M33 microcontroller running at 96 MHz
24+
- 1MB dual-bank on chip Flash
25+
- 128 KB RAM
26+
- USB high-speed (Host/Device) with on-chip HS PHY. HS USB Type-C connectors
27+
- 2x FlexCAN with FD, 2x I3Cs, 2x SAI
28+
- On-board MCU-Link debugger with CMSIS-DAP
29+
- Arduino Header, FlexIO/LCD Header, SmartDMA/Camera Header, mikroBUS
30+
31+
For more information about the MCX-A156 SoC and FRDM-MCXA156 board, see:
32+
33+
- `MCX-A156 SoC Website`_
34+
- `MCX-A156 Datasheet`_
35+
- `MCX-A156 Reference Manual`_
36+
- `FRDM-MCXA156 Website`_
37+
- `FRDM-MCXA156 User Guide`_
38+
- `FRDM-MCXA156 Board User Manual`_
39+
- `FRDM-MCXA156 Schematics`_
40+
41+
Supported Features
42+
==================
43+
44+
The FRDM-MCXA156 board configuration supports the following hardware features:
45+
46+
+-----------+------------+-------------------------------------+
47+
| Interface | Controller | Driver/Component |
48+
+===========+============+=====================================+
49+
| NVIC | on-chip | nested vector interrupt controller |
50+
+-----------+------------+-------------------------------------+
51+
| SYSTICK | on-chip | systick |
52+
+-----------+------------+-------------------------------------+
53+
| PINMUX | on-chip | pinmux |
54+
+-----------+------------+-------------------------------------+
55+
| GPIO | on-chip | gpio |
56+
+-----------+------------+-------------------------------------+
57+
| UART | on-chip | serial port-polling; |
58+
| | | serial port-interrupt |
59+
+-----------+------------+-------------------------------------+
60+
| CLOCK | on-chip | clock_control |
61+
+-----------+------------+-------------------------------------+
62+
| FLASH | on-chip | soc flash |
63+
+-----------+------------+-------------------------------------+
64+
65+
Targets available
66+
==================
67+
68+
The default configuration file
69+
:zephyr_file:`boards/nxp/frdm_mcxa156/frdm_mcxa156_defconfig`
70+
71+
Other hardware features are not currently supported by the port.
72+
73+
Connections and IOs
74+
===================
75+
76+
The MCX-A156 SoC has 5 gpio controllers and has pinmux registers which
77+
can be used to configure the functionality of a pin.
78+
79+
+------------+-----------------+----------------------------+
80+
| Name | Function | Usage |
81+
+============+=================+============================+
82+
| PIO0_2 | UART | UART RX |
83+
+------------+-----------------+----------------------------+
84+
| PIO0_3 | UART | UART TX |
85+
+------------+-----------------+----------------------------+
86+
87+
System Clock
88+
============
89+
90+
The MCX-A156 SoC is configured to use FRO running at 96MHz as a source for
91+
the system clock.
92+
93+
Serial Port
94+
===========
95+
96+
The FRDM-MCXA156 SoC has 5 LPUART interfaces for serial communication.
97+
LPUART 0 is configured as UART for the console.
98+
99+
Programming and Debugging
100+
*************************
101+
102+
Build and flash applications as usual (see :ref:`build_an_application` and
103+
:ref:`application_run` for more details).
104+
105+
Configuring a Debug Probe
106+
=========================
107+
108+
A debug probe is used for both flashing and debugging the board. This board is
109+
configured by default to use the MCU-Link CMSIS-DAP Onboard Debug Probe.
110+
111+
Using LinkServer
112+
----------------
113+
114+
Linkserver is the default runner for this board, and supports the factory
115+
default MCU-Link firmware. Follow the instructions in
116+
:ref:`mcu-link-cmsis-onboard-debug-probe` to reprogram the default MCU-Link
117+
firmware. This only needs to be done if the default onboard debug circuit
118+
firmware was changed. To put the board in ``DFU mode`` to program the firmware,
119+
short jumper JP5.
120+
121+
Using J-Link
122+
------------
123+
124+
There are two options. The onboard debug circuit can be updated with Segger
125+
J-Link firmware by following the instructions in
126+
:ref:`mcu-link-jlink-onboard-debug-probe`.
127+
To be able to program the firmware, you need to put the board in ``DFU mode``
128+
by shortening the jumper JP5.
129+
The second option is to attach a :ref:`jlink-external-debug-probe` to the
130+
10-pin SWD connector (J24) of the board. Additionally, the jumper JP7 must
131+
be shortened.
132+
For both options use the ``-r jlink`` option with west to use the jlink runner.
133+
134+
.. code-block:: console
135+
136+
west flash -r jlink
137+
138+
Configuring a Console
139+
=====================
140+
141+
Connect a USB cable from your PC to J21, and use the serial terminal of your choice
142+
(minicom, putty, etc.) with the following settings:
143+
144+
- Speed: 115200
145+
- Data: 8 bits
146+
- Parity: None
147+
- Stop bits: 1
148+
149+
Flashing
150+
========
151+
152+
Here is an example for the :ref:`hello_world` application.
153+
154+
.. zephyr-app-commands::
155+
:zephyr-app: samples/hello_world
156+
:board: frdm_mcxa156
157+
:goals: flash
158+
159+
Open a serial terminal, reset the board (press the RESET button), and you should
160+
see the following message in the terminal:
161+
162+
.. code-block:: console
163+
164+
*** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 ***
165+
Hello World! frdm_mcxa156/mcxa156
166+
167+
Debugging
168+
=========
169+
170+
Here is an example for the :ref:`hello_world` application.
171+
172+
.. zephyr-app-commands::
173+
:zephyr-app: samples/hello_world
174+
:board: frdm_mcxa156/mcxa156
175+
:goals: debug
176+
177+
Open a serial terminal, step through the application in your debugger, and you
178+
should see the following message in the terminal:
179+
180+
.. code-block:: console
181+
182+
*** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 ***
183+
Hello World! frdm_mcxa156/mcxa156
184+
185+
.. _MCX-A156 SoC Website:
186+
https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-a-series-microcontrollers/mcx-a13x-14x-15x-mcus-with-arm-cortex-m33-scalable-device-options-low-power-and-intelligent-peripherals:MCX-A13X-A14X-A15X
187+
188+
.. _MCX-A156 Datasheet:
189+
https://www.nxp.com/docs/en/data-sheet/MCXAP100M96FS6.pdf
190+
191+
.. _MCX-A156 Reference Manual:
192+
https://www.nxp.com/webapp/Download?colCode=MCXAP100M96FS6RM
193+
194+
.. _FRDM-MCXA156 Website:
195+
https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/frdm-development-board-for-mcx-a144-5-6-a154-5-6-mcus:FRDM-MCXA156
196+
197+
.. _FRDM-MCXA156 User Guide:
198+
https://www.nxp.com/document/guide/getting-started-with-frdm-mcxa156:GS-FRDM-MCXA156
199+
200+
.. _FRDM-MCXA156 Board User Manual:
201+
https://www.nxp.com/docs/en/user-manual/UM12121.pdf
202+
203+
.. _FRDM-MCXA156 Schematics:
204+
https://www.nxp.com/webapp/Download?colCode=SPF-90841
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2024 NXP
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
7+
#include <nxp/mcx/MCXA156VLL-pinctrl.h>
8+
9+
&pinctrl {
10+
pinmux_lpuart0: pinmux_lpuart0 {
11+
group0 {
12+
pinmux = <LPUART0_RXD_P0_2>,
13+
<LPUART0_TXD_P0_3>;
14+
drive-strength = "low";
15+
slew-rate = "fast";
16+
};
17+
};
18+
19+
};

0 commit comments

Comments
 (0)