Skip to content

Commit 33407bf

Browse files
michal-smolanashif
authored andcommitted
boards: frdm_mcxc242: Add basic support for board
Add basic support for NXP frdm_mcxc242 board. Signed-off-by: Michal Smola <[email protected]>
1 parent dd05205 commit 33407bf

File tree

9 files changed

+395
-0
lines changed

9 files changed

+395
-0
lines changed
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_MCXC242
5+
select SOC_MCXC242
6+
select SOC_PART_NUMBER_MCXC242VLH
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=MCXC242")
8+
board_runner_args(linkserver "--device=MCXC242:FRDM-MCXC242")
9+
board_runner_args(pyocd "--target=mcxc242")
10+
11+
include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake)
12+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
13+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/nxp/frdm_mcxc242/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_mcxc242
3+
vendor: nxp
4+
socs:
5+
- name: mcxc242
66.5 KB
Loading
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
.. _frdm_mcxc242:
2+
3+
NXP FRDM-MCXC242
4+
################
5+
6+
Overview
7+
********
8+
9+
FRDM-MCXC242 is a compact and scalable development board for rapid
10+
prototyping of MCX C242 MCU. It offers industry standard headers
11+
for easy access to the MCU’s I/Os, integrated open-standard serial
12+
interfaces and on-board MCU-Link debugger.
13+
The MCXC is a general purpose ultra-low-power MCU family,
14+
providing additional memory, communications and analog peripheral.
15+
16+
17+
.. image:: frdm_mcxc242.webp
18+
:align: center
19+
:alt: FRDM-MCXC242
20+
21+
Hardware
22+
********
23+
24+
- MCXC242VLH Arm Cortex-M0+ microcontroller running at 48 MHz
25+
- 64LQFP package
26+
- 64KB flash
27+
- 16KB SRAM
28+
- USB FS 2.0
29+
- 2x low-power UART, 1x UART, 2x I2C, 2x SPI
30+
- FXLS8974CF accelerometer
31+
- NTC temperature sensor
32+
- RGB user LED
33+
- On-board MCU-Link debugger with CMSIS-DAP
34+
- Arduino Header, mikroBUS, Pmod
35+
36+
For more information about the MCXC242 SoC and FRDM-MCXC242 board, see
37+
these references:
38+
39+
- `MCX C14x/24x/44x Website`_
40+
- `MCX C24x Datasheet`_
41+
- `MCX C24x Reference Manual`_
42+
- `FRDM-MCXC242 Website`_
43+
- `FRDM-MCXC242 User Manual`_
44+
- `FRDM-MCXC242 Design Files`_
45+
46+
Supported Features
47+
==================
48+
49+
The ``frdm_mcxc242`` board target supports the following hardware features:
50+
51+
+-----------+------------+-------------------------------------+
52+
| Interface | Controller | Driver/Component |
53+
+===========+============+=====================================+
54+
| NVIC | on-chip | nested vector interrupt controller |
55+
+-----------+------------+-------------------------------------+
56+
| SYSTICK | on-chip | systick |
57+
+-----------+------------+-------------------------------------+
58+
| PINMUX | on-chip | pinmux |
59+
+-----------+------------+-------------------------------------+
60+
| GPIO | on-chip | gpio |
61+
+-----------+------------+-------------------------------------+
62+
| UART | on-chip | serial port-polling |
63+
| | | serial port-interrupt |
64+
+-----------+------------+-------------------------------------+
65+
| FLASH | on-chip | soc flash |
66+
+-----------+------------+-------------------------------------+
67+
68+
69+
Targets available
70+
==================
71+
72+
The default configuration can be found in
73+
:zephyr_file:`boards/nxp/frdm_mcxc242/frdm_mcxc242_defconfig`
74+
75+
Other hardware features are not currently supported by the port.
76+
77+
Connections and IOs
78+
===================
79+
80+
The MCXC242 SoC has five pairs of pinmux/gpio controllers (PORTA/GPIOA,
81+
PORTB/GPIOB, PORTC/GPIOC, PORTD/GPIOD, and PORTE/GPIOE) for the FRDM-MCXC242 board.
82+
83+
+-------+-------------+---------------------------+
84+
| Name | Function | Usage |
85+
+=======+=============+===========================+
86+
| PTE16 | ADC | ADC0 channel 1 |
87+
+-------+-------------+---------------------------+
88+
| PTB18 | GPIO | Red LED |
89+
+-------+-------------+---------------------------+
90+
| PTB19 | GPIO | Green LED |
91+
+-------+-------------+---------------------------+
92+
| PTA13 | GPIO | Blue LED |
93+
+-------+-------------+---------------------------+
94+
| PTA1 | LPUART0_RX | UART Console |
95+
+-------+-------------+---------------------------+
96+
| PTA2 | LPUART0_TX | UART Console |
97+
+-------+-------------+---------------------------+
98+
| PTA20 | RESET | RESET Button SW1 |
99+
+-------+-------------+---------------------------+
100+
| PTC1 | GPIO | User button SW2 |
101+
+-------+-------------+---------------------------+
102+
| PTA4 | GPIO | User button SW3 |
103+
+-------+-------------+---------------------------+
104+
| PTD6 | I2C1_SDA | I2C accelerometer |
105+
+-------+-------------+---------------------------+
106+
| PTD7 | I2C1_SCL | I2C accelerometer |
107+
+-------+-------------+---------------------------+
108+
109+
System Clock
110+
============
111+
112+
The MCXC242 SoC is configured to use HIRC running at 48 MHz as a system clock source.
113+
114+
Serial Port
115+
===========
116+
117+
The MCXC242 LPUART0 is used for the console.
118+
119+
Programming and Debugging
120+
*************************
121+
122+
Build and flash applications as usual (see :ref:`build_an_application` and
123+
:ref:`application_run` for more details).
124+
125+
Configuring a Debug Probe
126+
=========================
127+
128+
A debug probe is used for both flashing and debugging the board. This board is
129+
configured by default to use the MCU-Link CMSIS-DAP Onboard Debug Probe.
130+
131+
Using LinkServer
132+
----------------
133+
134+
Linkserver is the default runner for this board, and supports the factory
135+
default MCU-Link firmware. Follow the instructions in
136+
:ref:`mcu-link-cmsis-onboard-debug-probe` to reprogram the default MCU-Link
137+
firmware. This only needs to be done if the default onboard debug circuit
138+
firmware was changed. To put the board in ``DFU mode`` to program the firmware,
139+
short jumper JP1.
140+
141+
Using J-Link
142+
------------
143+
144+
There are two options. The onboard debug circuit can be updated with Segger
145+
J-Link firmware by following the instructions in
146+
:ref:`mcu-link-jlink-onboard-debug-probe`.
147+
To be able to program the firmware, you need to put the board in ``DFU mode``
148+
by shortening the jumper JP1.
149+
The second option is to attach a :ref:`jlink-external-debug-probe` to the
150+
10-pin SWD connector (J10) of the board. Additionally, the jumper JP3 must
151+
be shortened.
152+
For both options use the ``-r jlink`` option with west to use the jlink runner.
153+
154+
.. code-block:: console
155+
156+
west flash -r jlink
157+
158+
Configuring a Console
159+
=====================
160+
161+
Connect a USB cable from your PC to J9, and use the serial terminal of your choice
162+
(minicom, putty, etc.) with the following settings:
163+
164+
- Speed: 115200
165+
- Data: 8 bits
166+
- Parity: None
167+
- Stop bits: 1
168+
169+
Flashing
170+
========
171+
172+
Here is an example for the :ref:`hello_world` application.
173+
174+
.. zephyr-app-commands::
175+
:zephyr-app: samples/hello_world
176+
:board: frdm_mcxc242
177+
:goals: flash
178+
179+
Open a serial terminal, reset the board (press the SW1 button), and you should
180+
see the following message in the terminal:
181+
182+
.. code-block:: console
183+
184+
*** Booting Zephyr OS build v3.6.0-4475-gfa5bd8bb098e ***
185+
Hello World! frdm_mcxc242/mcxc242
186+
187+
Debugging
188+
=========
189+
190+
Here is an example for the :ref:`hello_world` application.
191+
192+
.. zephyr-app-commands::
193+
:zephyr-app: samples/hello_world
194+
:board: frdm_mcxc242
195+
:goals: debug
196+
197+
Open a serial terminal, step through the application in your debugger, and you
198+
should see the following message in the terminal:
199+
200+
.. code-block:: console
201+
202+
*** Booting Zephyr OS build v3.6.0-4475-gfa5bd8bb098e ***
203+
Hello World! frdm_mcxc242/mcxc242
204+
205+
.. _MCX C14x/24x/44x Website:
206+
https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-c-series-microcontrollers/mcx-c14x-24x-44x-mcus-with-arm-cortex-m0-plus-entry-level-mcus-with-usb-segment-lcd-and-classical-peripherals:MCX-C14x-24x-44x
207+
208+
.. _MCX C24x Datasheet:
209+
https://www.nxp.com/docs/en/data-sheet/MCXC24XP64M48SF2.pdf
210+
211+
.. _MCX C24x Reference Manual:
212+
https://www.nxp.com/webapp/Download?colCode=MCXC24XP64M48RM
213+
214+
.. _FRDM-MCXC242 Website:
215+
https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/frdm-development-board-for-mcx-c242-mcus:FRDM-MCXC242
216+
217+
.. _FRDM-MCXC242 User Manual:
218+
https://www.nxp.com/webapp/Download?colCode=UM12119
219+
220+
.. _FRDM-MCXC242 Design Files:
221+
https://www.nxp.com/webapp/Download?colCode=FRDM-MCXC242-DESIGN-FILES
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
8+
#include <nxp/mcx/MCXC242VLH-pinctrl.h>
9+
10+
&pinctrl {
11+
pinmux_lpuart0: pinmux_lpuart0 {
12+
group0 {
13+
pinmux = <LPUART0_RX_PTA1>,
14+
<LPUART0_TX_PTA2>;
15+
drive-strength = "low";
16+
slew-rate = "slow";
17+
};
18+
};
19+
};
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <nxp/nxp_mcxc242.dtsi>
10+
#include "frdm_mcxc242-pinctrl.dtsi"
11+
#include <zephyr/dt-bindings/input/input-event-codes.h>
12+
13+
/ {
14+
model = "NXP FRDM-MCXC242 board";
15+
compatible = "nxp,mcxc242", "nxp,mcx";
16+
17+
aliases {
18+
led0 = &red_led;
19+
led1 = &green_led;
20+
led2 = &red_led;
21+
sw0 = &user_button_2;
22+
sw1 = &user_button_3;
23+
};
24+
25+
chosen {
26+
zephyr,sram = &sram0;
27+
zephyr,flash = &flash0;
28+
zephyr,console = &lpuart0;
29+
zephyr,shell-uart = &lpuart0;
30+
};
31+
32+
leds {
33+
compatible = "gpio-leds";
34+
red_led: led_0 {
35+
gpios = <&gpiob 18 GPIO_ACTIVE_LOW>;
36+
label = "Red LED";
37+
};
38+
green_led: led_1 {
39+
gpios = <&gpiob 19 GPIO_ACTIVE_LOW>;
40+
label = "Green LED";
41+
};
42+
blue_led: led_2 {
43+
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
44+
label = "Blue LED";
45+
};
46+
};
47+
48+
gpio_keys {
49+
compatible = "gpio-keys";
50+
user_button_2: button_2 {
51+
label = "User SW2";
52+
gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
53+
zephyr,code = <INPUT_KEY_0>;
54+
};
55+
user_button_3: button_3 {
56+
label = "User SW3";
57+
gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
58+
zephyr,code = <INPUT_KEY_1>;
59+
};
60+
};
61+
};
62+
63+
&sim {
64+
pllfll-select = <KINETIS_SIM_PLLFLLSEL_MCGPLLCLK>;
65+
er32k-select = <KINETIS_SIM_ER32KSEL_LPO1KHZ>;
66+
};
67+
68+
&cpu0 {
69+
clock-frequency = <48000000>;
70+
};
71+
72+
&osc {
73+
clock-frequency = <32768>;
74+
mode = "low-power";
75+
};
76+
77+
&gpioa {
78+
status = "okay";
79+
};
80+
81+
&gpiob {
82+
status = "okay";
83+
};
84+
85+
&gpioc {
86+
status = "okay";
87+
};
88+
89+
&gpioe {
90+
status = "okay";
91+
};
92+
93+
&lpuart0 {
94+
status = "okay";
95+
current-speed = <115200>;
96+
pinctrl-0 = <&pinmux_lpuart0>;
97+
pinctrl-names = "default";
98+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright 2024 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
identifier: frdm_mcxc242
8+
name: NXP FRDM-MCXC242
9+
type: mcu
10+
arch: arm
11+
ram: 16
12+
flash: 64
13+
toolchain:
14+
- zephyr
15+
- gnuarmemb
16+
- xtools
17+
supported:
18+
- gpio
19+
testing:
20+
ignore_tags:
21+
- net
22+
- bluetooth
23+
vendor: nxp

0 commit comments

Comments
 (0)