boards: nxp: frdm_k32l2b3: Add initial support

Adding initial support for NXP FRDM K32L2B3 board.

Signed-off-by: Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>

dts: arm: nxp: Fix SRAM node name

Fix address part of the SRAM node name.
Change the SRAM start address definition to lower
case hexadecimal to be consistent.

Signed-off-by: Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
This commit is contained in:
Ishraq Ibne Ashraf 2025-06-29 21:52:27 +02:00 committed by Anas Nashif
parent 79edfc0128
commit 7b49381227
10 changed files with 392 additions and 2 deletions

View File

@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_FRDM_K32L2B3
select SOC_K32L2B31A
select SOC_PART_NUMBER_K32L2B31VLH0A

View File

@ -0,0 +1,11 @@
#
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
board_runner_args(linkserver "--device=K32L2B31A:FRDM-K32L2B")
board_runner_args(pyocd "--target=k32l2b3")
include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)

View File

@ -0,0 +1,6 @@
board:
name: frdm_k32l2b3
full_name: FRDM-K32L2B3
vendor: nxp
socs:
- name: k32l2b31a

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,178 @@
.. zephyr:board:: frdm_k32l2b3
Overview
********
The FRDM-K32L2B3 FRDM development board provides a platform for evaluation and
development of the K32 L2B SoC Family. The board provides easy Access to K32 L2B
SoC I/O.
Hardware
********
- K32L2B31VLH0A SoC running at up to 48 MHz, 256 kB flash memory, 32 kB SRAM memory.
- Full-speed USB port with micro A/B connector for device functionality.
- NXP FXOS8700CQ digital sensor, 3D accelerometer (±2g/±4g/±8g) + 3D magnetometer.
- On-board segment LCD.
- Form factor compatible with Arduino® Rev3 pin layout.
- OpenSDA debug interface.
For more information about the K32L2B31VLH0A SoC and FRDM-K32L2B3 board:
- `FRDM-KL32L2B3 Website`_
- `KL32-L2 Website`_
Supported Features
==================
.. zephyr:board-supported-hw::
Connections and IOs
===================
The K32L2B31VLH0A SoC has five pairs of pinmux/gpio controllers, and all are currently
enabled (PORTA/GPIOA, PORTB/GPIOB, PORTC/GPIOC, PORTD/GPIOD, and PORTE/GPIOE) for the
FRDM-K32L2B3 board.
+-------+-------------+---------------------------+
| Name | Function | Usage |
+=======+=============+===========================+
| PTD5 | GPIO | Green LED |
+-------+-------------+---------------------------+
| PTE31 | GPIO | Red LED |
+-------+-------------+---------------------------+
| PTA4 | GPIO | User Button 1 (SW1) |
+-------+-------------+---------------------------+
| PTC3 | GPIO | User Button 2 (SW2) |
+-------+-------------+---------------------------+
| PTA1 | LPUART0_RX | UART Console |
+-------+-------------+---------------------------+
| PTA2 | LPUART0_TX | UART Console |
+-------+-------------+---------------------------+
| PTE24 | I2C0_SCL | I2C Accelerometer |
+-------+-------------+---------------------------+
| PTE25 | I2C0_SDA | I2C Accelerometer |
+-------+-------------+---------------------------+
System Clock
============
The K32L2B31VLH0A SoC is configured to use the 32.768 kHz external
oscillator on the board to generate a 48 MHz system clock.
Serial Port
===========
The K32L2B31VLH0A LPUART0 is used 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 :ref:`opensda-daplink-onboard-debug-probe`.
For more information about OpenSDA and firmware applications check `OpenSDA FRDM-K32L2B3`_.
Using LinkServer
----------------
Install the :ref:`linkserver-debug-host-tools` and make sure they are in your
search path. LinkServer works with the CMSIS-DAP firmware. Please follow the
instructions on :ref:`opensda-daplink-onboard-debug-probe` and select the latest
revision of the firmware image.
LinkServer is the default for this board, ``west flash`` and ``west debug`` will
call the linkserver runner.
.. code-block:: console
west flash
west debug
Using pyOCD
-----------
Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search
path. pyOCD works with the CMSIS-DAP firmware.
Add the arguments ``-DBOARD_FLASH_RUNNER=pyocd`` and
``-DBOARD_DEBUG_RUNNER=pyocd`` when you invoke ``west build`` to override the
default runner from linkserver to pyocd:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: frdm_k32l2b3
:gen-args: -DBOARD_FLASH_RUNNER=pyocd -DBOARD_DEBUG_RUNNER=pyocd
:goals: build
Configuring a Console
=====================
Regardless of your choice in debug probe, we will use the OpenSDA
microcontroller as a usb-to-serial adapter for the serial console.
Connect a USB cable from your PC to J13.
Use the following settings with your serial terminal of choice
(minicom, putty, etc.):
- 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_k32l2b3
:goals: flash
Open a serial terminal, reset the board (press the SW2 button), and you should
see the following message in the terminal:
.. code-block:: console
*** Booting Zephyr OS build v4.1.0-7032-g3198db1b1229 ***
Hello World! frdm_k32l2b3/k32l2b31a
Debugging
=========
Here is an example for the :zephyr:code-sample:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: frdm_k32l2b3
: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 v4.1.0-7032-g3198db1b1229 ***
Hello World! frdm_k32l2b3/k32l2b31a
.. include:: ../../common/board-footer.rst
:start-after: nxp-board-footer
.. _KL32-L2 Website:
https://www.nxp.com/products/K32-L2
.. _FRDM-KL32L2B3 Website:
https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/nxp-frdm-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3
.. _OpenSDA FRDM-K32L2B3:
https://www.nxp.com/design/design-center/development-boards-and-designs/OPENSDA#FRDM-K32L2B3

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <nxp/kinetis/K32L2B31VLH0A-pinctrl.h>
&pinctrl {
lpuart0_default: lpuart0_default {
group0 {
pinmux =
<LPUART0_RX_PTA1>,
<LPUART0_TX_PTA2>;
slew-rate = "slow";
drive-strength = "low";
};
};
i2c0_default: i2c0_default {
group0 {
pinmux =
<I2C0_SCL_PTE24>,
<I2C0_SDA_PTE25>;
bias-pull-up;
slew-rate = "fast";
drive-strength = "low";
};
};
};

View File

@ -0,0 +1,121 @@
/*
* Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nxp/nxp_k32l2b3.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include "frdm_k32l2b3-pinctrl.dtsi"
/ {
model = "NXP FRDM-K32L2B3 board";
compatible = "nxp,k32l2b3", "nxp,k32lx";
aliases {
led0 = &led_green;
led1 = &led_red;
sw0 = &sw_1;
sw1 = &sw_3;
magn0 = &fxos8700;
accel0 = &fxos8700;
};
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &lpuart0;
zephyr,shell-uart = &lpuart0;
};
leds {
compatible = "gpio-leds";
led_green: led_1 {
label = "Green LED";
gpios = <&gpiod 5 GPIO_ACTIVE_LOW>;
};
led_red: led_2 {
label = "Red LED";
gpios = <&gpioe 31 GPIO_ACTIVE_LOW>;
};
};
gpio_keys {
compatible = "gpio-keys";
sw_1: button_1 {
label = "User Button 1 (SW1)";
zephyr,code = <INPUT_KEY_0>;
gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
};
sw_3: button_2 {
label = "User Button 2 (SW3)";
zephyr,code = <INPUT_KEY_1>;
gpios = <&gpioc 3 GPIO_ACTIVE_LOW>;
};
};
};
&cpu0 {
clock-frequency = <48000000>;
};
&sim {
er32k-select = <KINETIS_SIM_ER32KSEL_OSC32KCLK>;
pllfll-select = <KINETIS_SIM_PLLFLLSEL_MCGPLLCLK>;
};
&osc {
mode = "low-power";
clock-frequency = <32768>;
};
&ftfa {
status = "okay";
};
&gpioa {
status = "okay";
};
&gpiob {
status = "okay";
};
&gpioc {
status = "okay";
};
&gpiod {
status = "okay";
};
&gpioe {
status = "okay";
};
&lpuart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&lpuart0_default>;
pinctrl-names = "default";
};
&i2c0 {
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
fxos8700: fxos8700@1c {
compatible = "nxp,fxos8700";
reg = <0x1c>;
int1-gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
};
};

View File

@ -0,0 +1,25 @@
#
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
identifier: frdm_k32l2b3
name: NXP FRDM-K32L2B3
type: mcu
arch: arm
ram: 32
flash: 256
toolchain:
- zephyr
- gnuarmemb
supported:
- led
- i2c
- gpio
- sram
- flash
- lpuart
- button
- pinctrl
vendor: nxp

View File

@ -0,0 +1,10 @@
#
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

View File

@ -29,7 +29,7 @@
};
};
sram0: memory@1FFFF000 {
sram0: memory@1fffe000 {
compatible = "mmio-sram";
};
@ -329,7 +329,7 @@
};
&sram0 {
reg = <0x1FFFE000 DT_SIZE_K(32)>;
reg = <0x1fffe000 DT_SIZE_K(32)>;
};
&flash0 {