-
Notifications
You must be signed in to change notification settings - Fork 8k
Add mcxa344 baseline support #96405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NeilChen93
wants to merge
4
commits into
zephyrproject-rtos:main
Choose a base branch
from
nxp-upstream:add_mcxa344_baseline_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add mcxa344 baseline support #96405
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Copyright 2025 NXP | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
zephyr_library() | ||
zephyr_library_sources(board.c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2025 NXP | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_FRDM_MCXA344 | ||
select BOARD_EARLY_INIT_HOOK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright 2025 NXP | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_FRDM_MCXA344 | ||
select SOC_MCXA344 | ||
select SOC_PART_NUMBER_MCXA344VLL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* | ||
* Copyright 2025 NXP | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <zephyr/init.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h> | ||
#include <fsl_clock.h> | ||
#include <fsl_spc.h> | ||
#include <soc.h> | ||
|
||
/* Core clock frequency: 180MHz */ | ||
#define CLOCK_INIT_CORE_CLOCK 180000000U | ||
#define BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK 180000000U | ||
/* System clock frequency. */ | ||
extern uint32_t SystemCoreClock; | ||
|
||
void board_early_init_hook(void) | ||
{ | ||
uint32_t coreFreq; | ||
spc_active_mode_core_ldo_option_t ldoOption; | ||
spc_sram_voltage_config_t sramOption; | ||
|
||
/* Get the CPU Core frequency */ | ||
coreFreq = CLOCK_GetCoreSysClkFreq(); | ||
|
||
/* The flow of increasing voltage and frequency */ | ||
if (coreFreq <= BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK) { | ||
/* Set the LDO_CORE VDD regulator level */ | ||
ldoOption.CoreLDOVoltage = kSPC_CoreLDO_OverDriveVoltage; | ||
ldoOption.CoreLDODriveStrength = kSPC_CoreLDO_NormalDriveStrength; | ||
(void)SPC_SetActiveModeCoreLDORegulatorConfig(SPC0, &ldoOption); | ||
/* Configure Flash to support different voltage level and frequency */ | ||
FMU0->FCTRL = | ||
(FMU0->FCTRL & ~((uint32_t)FMU_FCTRL_RWSC_MASK)) | (FMU_FCTRL_RWSC(0x4U)); | ||
/* Specifies the operating voltage for the SRAM's read/write timing margin */ | ||
sramOption.operateVoltage = kSPC_sramOperateAt1P2V; | ||
sramOption.requestVoltageUpdate = true; | ||
(void)SPC_SetSRAMOperateVoltage(SPC0, &sramOption); | ||
} | ||
|
||
/*!< Set up system dividers */ | ||
CLOCK_SetClockDiv(kCLOCK_DivAHBCLK, 1U); /* !< Set SYSCON.AHBCLKDIV divider to value 1 */ | ||
CLOCK_SetClockDiv(kCLOCK_DivFRO_HF, 1U); /* !< Set SYSCON.FROHFDIV divider to value 1 */ | ||
CLOCK_SetupFROHFClocking(BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK); /*!< Enable FRO HF */ | ||
CLOCK_SetupFRO12MClocking(); /*!< Setup FRO12M clock */ | ||
|
||
CLOCK_AttachClk(kFRO_HF_to_MAIN_CLK); /* !< Switch MAIN_CLK to kFRO_HF */ | ||
|
||
/* The flow of decreasing voltage and frequency */ | ||
if (coreFreq > BOARD_BOOTCLOCKFROHF180M_CORE_CLOCK) { | ||
/* Configure Flash to support different voltage level and frequency */ | ||
FMU0->FCTRL = | ||
(FMU0->FCTRL & ~((uint32_t)FMU_FCTRL_RWSC_MASK)) | (FMU_FCTRL_RWSC(0x4U)); | ||
/* Specifies the operating voltage for the SRAM's read/write timing margin */ | ||
sramOption.operateVoltage = kSPC_sramOperateAt1P2V; | ||
sramOption.requestVoltageUpdate = true; | ||
(void)SPC_SetSRAMOperateVoltage(SPC0, &sramOption); | ||
/* Set the LDO_CORE VDD regulator level */ | ||
ldoOption.CoreLDOVoltage = kSPC_CoreLDO_OverDriveVoltage; | ||
ldoOption.CoreLDODriveStrength = kSPC_CoreLDO_NormalDriveStrength; | ||
(void)SPC_SetActiveModeCoreLDORegulatorConfig(SPC0, &ldoOption); | ||
} | ||
|
||
/*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
CLOCK_AttachClk(kCPU_CLK_to_TRACE); /* !< Switch TRACE to CPU_CLK */ | ||
|
||
/*!< Set up dividers */ | ||
CLOCK_SetClockDiv(kCLOCK_DivFRO_LF, 1U); /* !< Set SYSCON.FROLFDIV divider to value 1 */ | ||
CLOCK_SetClockDiv(kCLOCK_DivTRACE, 2U); /* !< Set MRCC.TRACE_CLKDIV divider to value 2 */ | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porta)) | ||
RESET_ReleasePeripheralReset(kPORT0_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GatePORT0); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portb)) | ||
RESET_ReleasePeripheralReset(kPORT1_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GatePORT1); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portc)) | ||
RESET_ReleasePeripheralReset(kPORT2_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GatePORT2); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portd)) | ||
RESET_ReleasePeripheralReset(kPORT3_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GatePORT3); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porte)) | ||
RESET_ReleasePeripheralReset(kPORT4_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GatePORT4); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) | ||
RESET_ReleasePeripheralReset(kGPIO0_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GateGPIO0); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) | ||
RESET_ReleasePeripheralReset(kGPIO1_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GateGPIO1); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) | ||
RESET_ReleasePeripheralReset(kGPIO2_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GateGPIO2); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) | ||
RESET_ReleasePeripheralReset(kGPIO3_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GateGPIO3); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) | ||
RESET_ReleasePeripheralReset(kGPIO4_RST_SHIFT_RSTn); | ||
CLOCK_EnableClock(kCLOCK_GateGPIO4); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) | ||
CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u); | ||
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART0); | ||
RESET_ReleasePeripheralReset(kLPUART0_RST_SHIFT_RSTn); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) | ||
CLOCK_SetClockDiv(kCLOCK_DivLPUART1, 1u); | ||
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART1); | ||
RESET_ReleasePeripheralReset(kLPUART1_RST_SHIFT_RSTn); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2)) | ||
CLOCK_SetClockDiv(kCLOCK_DivLPUART2, 1u); | ||
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART2); | ||
RESET_ReleasePeripheralReset(kLPUART2_RST_SHIFT_RSTn); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart3)) | ||
CLOCK_SetClockDiv(kCLOCK_DivLPUART3, 1u); | ||
CLOCK_AttachClk(kFRO_LF_DIV_to_LPUART3); | ||
RESET_ReleasePeripheralReset(kLPUART3_RST_SHIFT_RSTn); | ||
#endif | ||
|
||
/* Set SystemCoreClock variable. */ | ||
SystemCoreClock = CLOCK_INIT_CORE_CLOCK; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Copyright 2025 NXP | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
board_runner_args(jlink "--device=MCXA344") | ||
board_runner_args(linkserver "--device=MCXA344:FRDM-MCXA344") | ||
board_runner_args(pyocd "--target=MCXA344") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
board: | ||
name: frdm_mcxa344 | ||
full_name: FRDM-MCXA344 | ||
vendor: nxp | ||
socs: | ||
- name: mcxa344 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
.. zephyr:board:: frdm_mcxa344 | ||
|
||
Overview | ||
******** | ||
|
||
The MCXA344 Mixed-Signal MCUs, featuring an Arm® Cortex®-M33, support running up to | ||
180 MHz, 256 KB Flash and 64 kB RAM. The MCX A344 targets motor control applications, | ||
optimized with high performance and MAU engine, integrated 2x FlexPWM with 4x submodule | ||
combined with AOI, up to 2x ADC and rich serial peripheral and SmartDMA. The MCX MCX-A344 | ||
devices are supported by the MCUXpresso Developer Experience to optimize, ease and help | ||
accelerate embedded system development. | ||
|
||
Hardware | ||
******** | ||
|
||
- MCX-A344 Arm Cortex-M33 microcontroller running at 180 MHz | ||
- 256KB dual-bank on chip Flash | ||
- 64 KB RAM | ||
- 1x FlexCAN with FD, 1x RGB LED, 3x SW buttons | ||
- On-board MCU-Link debugger with CMSIS-DAP | ||
- Arduino Header, SmartDMA/Camera Header, mikroBUS | ||
|
||
For more information about the MCX-A344 SoC and FRDM-MCXA344 board, see: | ||
|
||
- `MCX-A344 SoC Website`_ | ||
- `MCX-A344 Datasheet`_ | ||
- `MCX-A344 Reference Manual`_ | ||
- `FRDM-MCXA344 Website`_ | ||
- `FRDM-MCXA344 User Guide`_ | ||
- `FRDM-MCXA344 Board User Manual`_ | ||
- `FRDM-MCXA344 Schematics`_ | ||
|
||
Supported Features | ||
================== | ||
|
||
.. zephyr:board-supported-hw:: | ||
|
||
Connections and IOs | ||
=================== | ||
|
||
The MCX-A344 SoC has 5 gpio controllers and has pinmux registers which | ||
can be used to configure the functionality of a pin. | ||
|
||
+------------+-----------------+----------------------------+ | ||
| Name | Function | Usage | | ||
+============+=================+============================+ | ||
| PIO2_3 | UART | UART RX | | ||
+------------+-----------------+----------------------------+ | ||
| PIO2_2 | UART | UART TX | | ||
+------------+-----------------+----------------------------+ | ||
|
||
System Clock | ||
============ | ||
|
||
The MCX-A344 SoC is configured to use FRO running at 180MHz as a source for | ||
the system clock. | ||
|
||
Serial Port | ||
=========== | ||
|
||
The FRDM-MCXA344 SoC has 4 LPUART interfaces for serial communication. | ||
LPUART 2 is configured as UART for the console. | ||
|
||
Programming and Debugging | ||
************************* | ||
|
||
.. zephyr:board-supported-runners:: | ||
|
||
Build and flash applications as usual (see :ref:`build_an_application` and | ||
:ref:`application_run` for more details). | ||
|
||
Configuring a Debug Probe | ||
========================= | ||
|
||
A debug probe is used for both flashing and debugging the board. This board is | ||
configured by default to use the MCU-Link CMSIS-DAP Onboard Debug Probe. | ||
|
||
Using LinkServer | ||
---------------- | ||
|
||
Linkserver is the default runner for this board, and supports the factory | ||
default MCU-Link firmware. Follow the instructions in | ||
:ref:`mcu-link-cmsis-onboard-debug-probe` to reprogram the default MCU-Link | ||
firmware. This only needs to be done if the default onboard debug circuit | ||
firmware was changed. To put the board in ``ISP mode`` to program the firmware, | ||
short jumper JP4. | ||
|
||
Using J-Link | ||
------------ | ||
|
||
There are two options. The onboard debug circuit can be updated with Segger | ||
J-Link firmware by following the instructions in | ||
:ref:`mcu-link-jlink-onboard-debug-probe`. | ||
To be able to program the firmware, you need to put the board in ``ISP mode`` | ||
by shortening the jumper JP4. | ||
The second option is to attach a :ref:`jlink-external-debug-probe` to the | ||
10-pin SWD connector (J11) of the board. Additionally, the jumper JP6 must | ||
be shorted. | ||
For both options use the ``-r jlink`` option with west to use the jlink runner. | ||
|
||
.. code-block:: console | ||
|
||
west flash -r jlink | ||
|
||
Configuring a Console | ||
===================== | ||
|
||
Connect a USB cable from your PC to J13, and use the serial terminal of your choice | ||
(minicom, putty, etc.) with the following settings: | ||
|
||
- Speed: 115200 | ||
- Data: 8 bits | ||
- Parity: None | ||
- Stop bits: 1 | ||
|
||
Flashing | ||
======== | ||
|
||
Here is an example for the :zephyr:code-sample:`hello_world` application. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/hello_world | ||
:board: frdm_mcxa344 | ||
:goals: flash | ||
|
||
Open a serial terminal, reset the board (press the RESET button), and you should | ||
see the following message in the terminal: | ||
|
||
.. code-block:: console | ||
|
||
*** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 *** | ||
Hello World! frdm_mcxa344/mcxa344 | ||
|
||
Debugging | ||
========= | ||
|
||
Here is an example for the :zephyr:code-sample:`hello_world` application. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/hello_world | ||
:board: frdm_mcxa344/mcxa344 | ||
:goals: debug | ||
|
||
Open a serial terminal, step through the application in your debugger, and you | ||
should see the following message in the terminal: | ||
|
||
.. code-block:: console | ||
|
||
*** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 *** | ||
Hello World! frdm_mcxa344/mcxa344 | ||
|
||
Troubleshooting | ||
=============== | ||
|
||
.. include:: ../../common/segger-ecc-systemview.rst | ||
:start-after: segger-ecc-systemview | ||
|
||
.. include:: ../../common/board-footer.rst | ||
:start-after: nxp-board-footer | ||
|
||
.. _MCX-A344 SoC Website: | ||
TBD | ||
|
||
.. _MCX-A344 Datasheet: | ||
TBD | ||
|
||
.. _MCX-A344 Reference Manual: | ||
TBD | ||
|
||
.. _FRDM-MCXA344 Website: | ||
TBD | ||
|
||
.. _FRDM-MCXA344 User Guide: | ||
TBD | ||
|
||
.. _FRDM-MCXA344 Board User Manual: | ||
TBD | ||
|
||
.. _FRDM-MCXA344 Schematics: | ||
TBD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright 2025 NXP | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
||
#include <nxp/mcx/MCXA344VLL-pinctrl.h> | ||
|
||
&pinctrl { | ||
pinmux_lpuart2: pinmux_lpuart2 { | ||
group0 { | ||
pinmux = <LPUART2_RXD_P2_3>, | ||
<LPUART2_TXD_P2_2>; | ||
drive-strength = "low"; | ||
slew-rate = "fast"; | ||
input-enable; | ||
}; | ||
}; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems these need to be added