diff --git a/boards/nxp/frdm_mcxc242/Kconfig.frdm_mcxc242 b/boards/nxp/frdm_mcxc242/Kconfig.frdm_mcxc242 new file mode 100644 index 00000000000..bcfd4b1a229 --- /dev/null +++ b/boards/nxp/frdm_mcxc242/Kconfig.frdm_mcxc242 @@ -0,0 +1,6 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_FRDM_MCXC242 + select SOC_MCXC242 + select SOC_PART_NUMBER_MCXC242VLH diff --git a/boards/nxp/frdm_mcxc242/board.cmake b/boards/nxp/frdm_mcxc242/board.cmake new file mode 100644 index 00000000000..4ebdbf562c2 --- /dev/null +++ b/boards/nxp/frdm_mcxc242/board.cmake @@ -0,0 +1,13 @@ +# +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +board_runner_args(jlink "--device=MCXC242") +board_runner_args(linkserver "--device=MCXC242:FRDM-MCXC242") +board_runner_args(pyocd "--target=mcxc242") + +include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nxp/frdm_mcxc242/board.yml b/boards/nxp/frdm_mcxc242/board.yml new file mode 100644 index 00000000000..2aa0aaa3da1 --- /dev/null +++ b/boards/nxp/frdm_mcxc242/board.yml @@ -0,0 +1,5 @@ +board: + name: frdm_mcxc242 + vendor: nxp + socs: + - name: mcxc242 diff --git a/boards/nxp/frdm_mcxc242/doc/frdm_mcxc242.webp b/boards/nxp/frdm_mcxc242/doc/frdm_mcxc242.webp new file mode 100644 index 00000000000..1ca95ad0bef Binary files /dev/null and b/boards/nxp/frdm_mcxc242/doc/frdm_mcxc242.webp differ diff --git a/boards/nxp/frdm_mcxc242/doc/index.rst b/boards/nxp/frdm_mcxc242/doc/index.rst new file mode 100644 index 00000000000..a2bf385fe4a --- /dev/null +++ b/boards/nxp/frdm_mcxc242/doc/index.rst @@ -0,0 +1,221 @@ +.. _frdm_mcxc242: + +NXP FRDM-MCXC242 +################ + +Overview +******** + +FRDM-MCXC242 is a compact and scalable development board for rapid +prototyping of MCX C242 MCU. It offers industry standard headers +for easy access to the MCU’s I/Os, integrated open-standard serial +interfaces and on-board MCU-Link debugger. +The MCXC is a general purpose ultra-low-power MCU family, +providing additional memory, communications and analog peripheral. + + +.. image:: frdm_mcxc242.webp + :align: center + :alt: FRDM-MCXC242 + +Hardware +******** + +- MCXC242VLH Arm Cortex-M0+ microcontroller running at 48 MHz +- 64LQFP package +- 64KB flash +- 16KB SRAM +- USB FS 2.0 +- 2x low-power UART, 1x UART, 2x I2C, 2x SPI +- FXLS8974CF accelerometer +- NTC temperature sensor +- RGB user LED +- On-board MCU-Link debugger with CMSIS-DAP +- Arduino Header, mikroBUS, Pmod + +For more information about the MCXC242 SoC and FRDM-MCXC242 board, see +these references: + +- `MCX C14x/24x/44x Website`_ +- `MCX C24x Datasheet`_ +- `MCX C24x Reference Manual`_ +- `FRDM-MCXC242 Website`_ +- `FRDM-MCXC242 User Manual`_ +- `FRDM-MCXC242 Design Files`_ + +Supported Features +================== + +The ``frdm_mcxc242`` board target supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| SYSTICK | on-chip | systick | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | soc flash | ++-----------+------------+-------------------------------------+ + + +Targets available +================== + +The default configuration can be found in +:zephyr_file:`boards/nxp/frdm_mcxc242/frdm_mcxc242_defconfig` + +Other hardware features are not currently supported by the port. + +Connections and IOs +=================== + +The MCXC242 SoC has five pairs of pinmux/gpio controllers (PORTA/GPIOA, +PORTB/GPIOB, PORTC/GPIOC, PORTD/GPIOD, and PORTE/GPIOE) for the FRDM-MCXC242 board. + ++-------+-------------+---------------------------+ +| Name | Function | Usage | ++=======+=============+===========================+ +| PTE16 | ADC | ADC0 channel 1 | ++-------+-------------+---------------------------+ +| PTB18 | GPIO | Red LED | ++-------+-------------+---------------------------+ +| PTB19 | GPIO | Green LED | ++-------+-------------+---------------------------+ +| PTA13 | GPIO | Blue LED | ++-------+-------------+---------------------------+ +| PTA1 | LPUART0_RX | UART Console | ++-------+-------------+---------------------------+ +| PTA2 | LPUART0_TX | UART Console | ++-------+-------------+---------------------------+ +| PTA20 | RESET | RESET Button SW1 | ++-------+-------------+---------------------------+ +| PTC1 | GPIO | User button SW2 | ++-------+-------------+---------------------------+ +| PTA4 | GPIO | User button SW3 | ++-------+-------------+---------------------------+ +| PTD6 | I2C1_SDA | I2C accelerometer | ++-------+-------------+---------------------------+ +| PTD7 | I2C1_SCL | I2C accelerometer | ++-------+-------------+---------------------------+ + +System Clock +============ + +The MCXC242 SoC is configured to use HIRC running at 48 MHz as a system clock source. + +Serial Port +=========== + +The MCXC242 LPUART0 is used for the console. + +Programming and Debugging +************************* + +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 ``DFU mode`` to program the firmware, +short jumper JP1. + +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 ``DFU mode`` +by shortening the jumper JP1. +The second option is to attach a :ref:`jlink-external-debug-probe` to the +10-pin SWD connector (J10) of the board. Additionally, the jumper JP3 must +be shortened. +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 J9, 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 :ref:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: frdm_mcxc242 + :goals: flash + +Open a serial terminal, reset the board (press the SW1 button), and you should +see the following message in the terminal: + +.. code-block:: console + + *** Booting Zephyr OS build v3.6.0-4475-gfa5bd8bb098e *** + Hello World! frdm_mcxc242/mcxc242 + +Debugging +========= + +Here is an example for the :ref:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: frdm_mcxc242 + :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-4475-gfa5bd8bb098e *** + Hello World! frdm_mcxc242/mcxc242 + +.. _MCX C14x/24x/44x Website: + 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 + +.. _MCX C24x Datasheet: + https://www.nxp.com/docs/en/data-sheet/MCXC24XP64M48SF2.pdf + +.. _MCX C24x Reference Manual: + https://www.nxp.com/webapp/Download?colCode=MCXC24XP64M48RM + +.. _FRDM-MCXC242 Website: + https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/frdm-development-board-for-mcx-c242-mcus:FRDM-MCXC242 + +.. _FRDM-MCXC242 User Manual: + https://www.nxp.com/webapp/Download?colCode=UM12119 + +.. _FRDM-MCXC242 Design Files: + https://www.nxp.com/webapp/Download?colCode=FRDM-MCXC242-DESIGN-FILES diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi b/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi new file mode 100644 index 00000000000..0effd6aeffc --- /dev/null +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi @@ -0,0 +1,19 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + + +#include + +&pinctrl { + pinmux_lpuart0: pinmux_lpuart0 { + group0 { + pinmux = , + ; + drive-strength = "low"; + slew-rate = "slow"; + }; + }; +}; diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts new file mode 100644 index 00000000000..5956ca468c9 --- /dev/null +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts @@ -0,0 +1,98 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "frdm_mcxc242-pinctrl.dtsi" +#include + +/ { + model = "NXP FRDM-MCXC242 board"; + compatible = "nxp,mcxc242", "nxp,mcx"; + + aliases { + led0 = &red_led; + led1 = &green_led; + led2 = &red_led; + sw0 = &user_button_2; + sw1 = &user_button_3; + }; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &lpuart0; + zephyr,shell-uart = &lpuart0; + }; + + leds { + compatible = "gpio-leds"; + red_led: led_0 { + gpios = <&gpiob 18 GPIO_ACTIVE_LOW>; + label = "Red LED"; + }; + green_led: led_1 { + gpios = <&gpiob 19 GPIO_ACTIVE_LOW>; + label = "Green LED"; + }; + blue_led: led_2 { + gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; + label = "Blue LED"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + user_button_2: button_2 { + label = "User SW2"; + gpios = <&gpioc 1 GPIO_ACTIVE_LOW>; + zephyr,code = ; + }; + user_button_3: button_3 { + label = "User SW3"; + gpios = <&gpioa 4 GPIO_ACTIVE_LOW>; + zephyr,code = ; + }; + }; +}; + +&sim { + pllfll-select = ; + er32k-select = ; +}; + +&cpu0 { + clock-frequency = <48000000>; +}; + +&osc { + clock-frequency = <32768>; + mode = "low-power"; +}; + +&gpioa { + status = "okay"; +}; + +&gpiob { + status = "okay"; +}; + +&gpioc { + status = "okay"; +}; + +&gpioe { + status = "okay"; +}; + +&lpuart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_lpuart0>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml new file mode 100644 index 00000000000..3b0a8b9d6ba --- /dev/null +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml @@ -0,0 +1,23 @@ +# +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +identifier: frdm_mcxc242 +name: NXP FRDM-MCXC242 +type: mcu +arch: arm +ram: 16 +flash: 64 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - gpio +testing: + ignore_tags: + - net + - bluetooth +vendor: nxp diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242_defconfig b/boards/nxp/frdm_mcxc242/frdm_mcxc242_defconfig new file mode 100644 index 00000000000..3d640c35842 --- /dev/null +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242_defconfig @@ -0,0 +1,10 @@ +# +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_GPIO=y