Skip to content

Commit 7b49381

Browse files
iianashif
authored andcommitted
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>
1 parent 79edfc0 commit 7b49381

File tree

10 files changed

+392
-2
lines changed

10 files changed

+392
-2
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
config BOARD_FRDM_K32L2B3
8+
select SOC_K32L2B31A
9+
select SOC_PART_NUMBER_K32L2B31VLH0A

boards/nxp/frdm_k32l2b3/board.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
board_runner_args(linkserver "--device=K32L2B31A:FRDM-K32L2B")
8+
board_runner_args(pyocd "--target=k32l2b3")
9+
10+
include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake)
11+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)

boards/nxp/frdm_k32l2b3/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: frdm_k32l2b3
3+
full_name: FRDM-K32L2B3
4+
vendor: nxp
5+
socs:
6+
- name: k32l2b31a
54.6 KB
Binary file not shown.

boards/nxp/frdm_k32l2b3/doc/index.rst

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
.. zephyr:board:: frdm_k32l2b3
2+
3+
Overview
4+
********
5+
6+
The FRDM-K32L2B3 FRDM development board provides a platform for evaluation and
7+
development of the K32 L2B SoC Family. The board provides easy Access to K32 L2B
8+
SoC I/O.
9+
10+
Hardware
11+
********
12+
13+
- K32L2B31VLH0A SoC running at up to 48 MHz, 256 kB flash memory, 32 kB SRAM memory.
14+
- Full-speed USB port with micro A/B connector for device functionality.
15+
- NXP FXOS8700CQ digital sensor, 3D accelerometer (±2g/±4g/±8g) + 3D magnetometer.
16+
- On-board segment LCD.
17+
- Form factor compatible with Arduino® Rev3 pin layout.
18+
- OpenSDA debug interface.
19+
20+
For more information about the K32L2B31VLH0A SoC and FRDM-K32L2B3 board:
21+
22+
- `FRDM-KL32L2B3 Website`_
23+
- `KL32-L2 Website`_
24+
25+
Supported Features
26+
==================
27+
28+
.. zephyr:board-supported-hw::
29+
30+
Connections and IOs
31+
===================
32+
33+
The K32L2B31VLH0A SoC has five pairs of pinmux/gpio controllers, and all are currently
34+
enabled (PORTA/GPIOA, PORTB/GPIOB, PORTC/GPIOC, PORTD/GPIOD, and PORTE/GPIOE) for the
35+
FRDM-K32L2B3 board.
36+
37+
+-------+-------------+---------------------------+
38+
| Name | Function | Usage |
39+
+=======+=============+===========================+
40+
| PTD5 | GPIO | Green LED |
41+
+-------+-------------+---------------------------+
42+
| PTE31 | GPIO | Red LED |
43+
+-------+-------------+---------------------------+
44+
| PTA4 | GPIO | User Button 1 (SW1) |
45+
+-------+-------------+---------------------------+
46+
| PTC3 | GPIO | User Button 2 (SW2) |
47+
+-------+-------------+---------------------------+
48+
| PTA1 | LPUART0_RX | UART Console |
49+
+-------+-------------+---------------------------+
50+
| PTA2 | LPUART0_TX | UART Console |
51+
+-------+-------------+---------------------------+
52+
| PTE24 | I2C0_SCL | I2C Accelerometer |
53+
+-------+-------------+---------------------------+
54+
| PTE25 | I2C0_SDA | I2C Accelerometer |
55+
+-------+-------------+---------------------------+
56+
57+
System Clock
58+
============
59+
60+
The K32L2B31VLH0A SoC is configured to use the 32.768 kHz external
61+
oscillator on the board to generate a 48 MHz system clock.
62+
63+
Serial Port
64+
===========
65+
66+
The K32L2B31VLH0A LPUART0 is used for the console.
67+
68+
Programming and Debugging
69+
*************************
70+
71+
.. zephyr:board-supported-runners::
72+
73+
Build and flash applications as usual (see :ref:`build_an_application` and
74+
:ref:`application_run` for more details).
75+
76+
Configuring a Debug Probe
77+
=========================
78+
79+
A debug probe is used for both flashing and debugging the board. This board is
80+
configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`.
81+
82+
For more information about OpenSDA and firmware applications check `OpenSDA FRDM-K32L2B3`_.
83+
84+
Using LinkServer
85+
----------------
86+
87+
Install the :ref:`linkserver-debug-host-tools` and make sure they are in your
88+
search path. LinkServer works with the CMSIS-DAP firmware. Please follow the
89+
instructions on :ref:`opensda-daplink-onboard-debug-probe` and select the latest
90+
revision of the firmware image.
91+
92+
LinkServer is the default for this board, ``west flash`` and ``west debug`` will
93+
call the linkserver runner.
94+
95+
.. code-block:: console
96+
97+
west flash
98+
west debug
99+
100+
Using pyOCD
101+
-----------
102+
103+
Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search
104+
path. pyOCD works with the CMSIS-DAP firmware.
105+
106+
Add the arguments ``-DBOARD_FLASH_RUNNER=pyocd`` and
107+
``-DBOARD_DEBUG_RUNNER=pyocd`` when you invoke ``west build`` to override the
108+
default runner from linkserver to pyocd:
109+
110+
.. zephyr-app-commands::
111+
:zephyr-app: samples/hello_world
112+
:board: frdm_k32l2b3
113+
:gen-args: -DBOARD_FLASH_RUNNER=pyocd -DBOARD_DEBUG_RUNNER=pyocd
114+
:goals: build
115+
116+
Configuring a Console
117+
=====================
118+
119+
Regardless of your choice in debug probe, we will use the OpenSDA
120+
microcontroller as a usb-to-serial adapter for the serial console.
121+
122+
Connect a USB cable from your PC to J13.
123+
124+
Use the following settings with your serial terminal of choice
125+
(minicom, putty, etc.):
126+
127+
- Speed: 115200
128+
- Data: 8 bits
129+
- Parity: None
130+
- Stop bits: 1
131+
132+
Flashing
133+
========
134+
135+
Here is an example for the :zephyr:code-sample:`hello_world` application.
136+
137+
.. zephyr-app-commands::
138+
:zephyr-app: samples/hello_world
139+
:board: frdm_k32l2b3
140+
:goals: flash
141+
142+
Open a serial terminal, reset the board (press the SW2 button), and you should
143+
see the following message in the terminal:
144+
145+
.. code-block:: console
146+
147+
*** Booting Zephyr OS build v4.1.0-7032-g3198db1b1229 ***
148+
Hello World! frdm_k32l2b3/k32l2b31a
149+
150+
Debugging
151+
=========
152+
153+
Here is an example for the :zephyr:code-sample:`hello_world` application.
154+
155+
.. zephyr-app-commands::
156+
:zephyr-app: samples/hello_world
157+
:board: frdm_k32l2b3
158+
:goals: debug
159+
160+
Open a serial terminal, step through the application in your debugger, and you
161+
should see the following message in the terminal:
162+
163+
.. code-block:: console
164+
165+
*** Booting Zephyr OS build v4.1.0-7032-g3198db1b1229 ***
166+
Hello World! frdm_k32l2b3/k32l2b31a
167+
168+
.. include:: ../../common/board-footer.rst
169+
:start-after: nxp-board-footer
170+
171+
.. _KL32-L2 Website:
172+
https://www.nxp.com/products/K32-L2
173+
174+
.. _FRDM-KL32L2B3 Website:
175+
https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/nxp-frdm-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3
176+
177+
.. _OpenSDA FRDM-K32L2B3:
178+
https://www.nxp.com/design/design-center/development-boards-and-designs/OPENSDA#FRDM-K32L2B3
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <nxp/kinetis/K32L2B31VLH0A-pinctrl.h>
8+
9+
&pinctrl {
10+
lpuart0_default: lpuart0_default {
11+
group0 {
12+
pinmux =
13+
<LPUART0_RX_PTA1>,
14+
<LPUART0_TX_PTA2>;
15+
slew-rate = "slow";
16+
drive-strength = "low";
17+
};
18+
};
19+
20+
i2c0_default: i2c0_default {
21+
group0 {
22+
pinmux =
23+
<I2C0_SCL_PTE24>,
24+
<I2C0_SDA_PTE25>;
25+
bias-pull-up;
26+
slew-rate = "fast";
27+
drive-strength = "low";
28+
};
29+
};
30+
};
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <nxp/nxp_k32l2b3.dtsi>
10+
#include <zephyr/dt-bindings/input/input-event-codes.h>
11+
12+
#include "frdm_k32l2b3-pinctrl.dtsi"
13+
14+
/ {
15+
model = "NXP FRDM-K32L2B3 board";
16+
compatible = "nxp,k32l2b3", "nxp,k32lx";
17+
18+
aliases {
19+
led0 = &led_green;
20+
led1 = &led_red;
21+
sw0 = &sw_1;
22+
sw1 = &sw_3;
23+
magn0 = &fxos8700;
24+
accel0 = &fxos8700;
25+
};
26+
27+
chosen {
28+
zephyr,sram = &sram0;
29+
zephyr,flash = &flash0;
30+
zephyr,console = &lpuart0;
31+
zephyr,shell-uart = &lpuart0;
32+
};
33+
34+
leds {
35+
compatible = "gpio-leds";
36+
37+
led_green: led_1 {
38+
label = "Green LED";
39+
gpios = <&gpiod 5 GPIO_ACTIVE_LOW>;
40+
};
41+
42+
led_red: led_2 {
43+
label = "Red LED";
44+
gpios = <&gpioe 31 GPIO_ACTIVE_LOW>;
45+
};
46+
};
47+
48+
gpio_keys {
49+
compatible = "gpio-keys";
50+
51+
sw_1: button_1 {
52+
label = "User Button 1 (SW1)";
53+
zephyr,code = <INPUT_KEY_0>;
54+
gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
55+
};
56+
57+
sw_3: button_2 {
58+
label = "User Button 2 (SW3)";
59+
zephyr,code = <INPUT_KEY_1>;
60+
gpios = <&gpioc 3 GPIO_ACTIVE_LOW>;
61+
};
62+
};
63+
};
64+
65+
&cpu0 {
66+
clock-frequency = <48000000>;
67+
};
68+
69+
&sim {
70+
er32k-select = <KINETIS_SIM_ER32KSEL_OSC32KCLK>;
71+
pllfll-select = <KINETIS_SIM_PLLFLLSEL_MCGPLLCLK>;
72+
};
73+
74+
&osc {
75+
mode = "low-power";
76+
clock-frequency = <32768>;
77+
};
78+
79+
&ftfa {
80+
status = "okay";
81+
};
82+
83+
&gpioa {
84+
status = "okay";
85+
};
86+
87+
&gpiob {
88+
status = "okay";
89+
};
90+
91+
&gpioc {
92+
status = "okay";
93+
};
94+
95+
&gpiod {
96+
status = "okay";
97+
};
98+
99+
&gpioe {
100+
status = "okay";
101+
};
102+
103+
&lpuart0 {
104+
status = "okay";
105+
current-speed = <115200>;
106+
pinctrl-0 = <&lpuart0_default>;
107+
pinctrl-names = "default";
108+
};
109+
110+
&i2c0 {
111+
status = "okay";
112+
pinctrl-0 = <&i2c0_default>;
113+
pinctrl-names = "default";
114+
115+
fxos8700: fxos8700@1c {
116+
compatible = "nxp,fxos8700";
117+
reg = <0x1c>;
118+
int1-gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;
119+
reset-gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
120+
};
121+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
identifier: frdm_k32l2b3
8+
name: NXP FRDM-K32L2B3
9+
type: mcu
10+
arch: arm
11+
ram: 32
12+
flash: 256
13+
toolchain:
14+
- zephyr
15+
- gnuarmemb
16+
supported:
17+
- led
18+
- i2c
19+
- gpio
20+
- sram
21+
- flash
22+
- lpuart
23+
- button
24+
- pinctrl
25+
vendor: nxp
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2025 Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
CONFIG_GPIO=y
8+
CONFIG_SERIAL=y
9+
CONFIG_CONSOLE=y
10+
CONFIG_UART_CONSOLE=y

0 commit comments

Comments
 (0)