Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions boards/nxp/frdm_ke16z/Kconfig.frdm_ke16z
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

config BOARD_FRDM_KE16Z
select SOC_MKE16Z4
select SOC_PART_NUMBER_MKE16Z64VLF4
11 changes: 11 additions & 0 deletions boards/nxp/frdm_ke16z/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright 2024 NXP
#
# SPDX-License-Identifier: Apache-2.0
#

board_runner_args(linkserver "--device=MKE16Z64xxx4:FRDM-KE16Z")
board_runner_args(jlink "--device=MKE16Z64xxx4" "--reset-after-load")

include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
6 changes: 6 additions & 0 deletions boards/nxp/frdm_ke16z/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: frdm_ke16z
full_name: FRDM-KE16Z
vendor: nxp
socs:
- name: mke16z4
Binary file added boards/nxp/frdm_ke16z/doc/frdm_ke16z.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
163 changes: 163 additions & 0 deletions boards/nxp/frdm_ke16z/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
.. zephyr:board:: frdm_ke16z

Overview
********

The FRDM-KE16Z is a development board for NXP Kinetis KE1xZ 32-bit
MCU-based platforms. The FRDM-KE16Z contains a robust TSI module
with up to 25 channels which makes this board highly flexible
for touch keys. Offers options for serial
communication, flash programming, and run-control debugging.

Hardware
********

- MKE16Z64VLF4 MCU (up to 48 MHz, 64 KB flash memory, 8 KB RAM)
- OpenSDA Debug Circuit with a virtual serial port
- Touch electrodes in the self-capacitive mode
- Compatible with FRDM-TOUCH, FRDM-MC-LVBLDC, and Arduino® boards
- User Components such as Reset; RGB LED and two user buttons
- 6-axis FXOS8700CQ digital accelerometer and magnetometer

For more information about the KE1xZ SoC and the FRDM-KE16Z board, see
these NXP reference documents:

- `KE1XZ SOC Website`_
- `FRDM-KE16Z Datasheet`_
- `FRDM-KE16Z Reference Manual`_
- `FRDM-KE16Z Website`_
- `FRDM-KE16Z User Guide`_
- `FRDM-KE16Z Schematics`_

Supported Features
==================

.. zephyr:board-supported-hw::

System Clock
============

The KE16 SoC is configured to run at 48 MHz using the FIRC.

Serial Port
===========

The KE16 SoC has three UARTs. UART0 (PTB1, PTB0) is configured 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 Linkserver.

Early versions of this board have an outdated version of the OpenSDA bootloader
and require an update. Please see the `DAPLink Bootloader Update`_ page for
instructions to update from the CMSIS-DAP bootloader to the DAPLink bootloader.

Option 1: Linkserver
-------------------------------------------------------

Install the :ref:`linkserver-debug-host-tools` and make sure they are in your
search path. LinkServer works with the default CMSIS-DAP firmware included in
the on-board debugger.

Linkserver is the default for this board, ``west flash`` and ``west debug`` will
call the linkserver runner.

Option 2: :ref:`opensda-jlink-onboard-debug-probe`
--------------------------------------------------

Install the :ref:`jlink-debug-host-tools` and make sure they are in your search
path.

Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program
the `OpenSDA J-Link Firmware for FRDM-KE15Z`_.
Use the ``-r jlink`` option with west to use the jlink runner.

.. code-block:: console

west flash -r jlink

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 J6.

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_ke16z
: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-3478-gb923667860b1 ***
Hello World! frdm_ke16z/mke16z4

Debugging
=========

Here is an example for the :zephyr:code-sample:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: frdm_ke16z
: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 v3.6.0-xxx-gxxxxxxxxxxxx *****
Hello World! frdm_ke16z

.. include:: ../../common/board-footer.rst
:start-after: nxp-board-footer

.. _KE1XZ SoC Website:
https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/ke-series-arm-cortex-m4-m0-plus/ke1xz-arm-cortex-m0-plus-5v-main-stream-mcu-with-nxp-touch-and-can-control:KE1xZ

.. _FRDM-KE16Z Datasheet:
https://www.nxp.com/docs/en/data-sheet/KE1xZP48M48SF0.pdf

.. _FRDM-KE16Z Reference Manual:
https://www.nxp.com/docs/en/reference-manual/KE1xZP48M48SF0RM.pdf

.. _FRDM-KE16Z Website:
https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-ke1xmcus:FRDM-KE16Z

.. _FRDM-KE16Z User Guide:
https://www.nxp.com/document/guide/get-started-with-the-frdm-ke16z:NGS-FRDM-KE16Z

.. _FRDM-KE16Z Schematics:
https://www.nxp.com/downloads/en/schematics/FRDM-KE16ZSCH.zip

.. _DAPLink Bootloader Update:
https://os.mbed.com/blog/entry/DAPLink-bootloader-update/
17 changes: 17 additions & 0 deletions boards/nxp/frdm_ke16z/frdm_ke16z-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2024 NXP
* SPDX-License-Identifier: Apache-2.0
*/

#include <nxp/kinetis/MKE16Z64VLF4-pinctrl.h>

&pinctrl {
lpuart0_default: lpuart0_default {
group0 {
pinmux = <LPUART0_RX_PTB0>,
<LPUART0_TX_PTB1>;
drive-strength = "low";
slew-rate = "slow";
};
};
};
76 changes: 76 additions & 0 deletions boards/nxp/frdm_ke16z/frdm_ke16z.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <nxp/nxp_ke1xz64.dtsi>
#include "frdm_ke16z-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
model = "NXP Freedom KE16Z board";
compatible = "nxp,ke16z", "nxp,mke16z4";

aliases {
led0 = &red_led;
led1 = &green_led;
led2 = &blue_led;
sw0 = &user_button_0;
sw1 = &user_button_1;
};

chosen {
zephyr,sram = &sram_u;
zephyr,flash = &flash0;
zephyr,console = &lpuart0;
zephyr,shell-uart = &lpuart0;
};

leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpiob 5 GPIO_ACTIVE_LOW>;
label = "RED LED";
};
green_led: led_1 {
gpios = <&gpiob 4 GPIO_ACTIVE_LOW>;
label = "GREEN LED";
};
blue_led: led_2 {
gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;
label = "BLUE LED";
};
};

gpio_keys {
compatible = "gpio-keys";
user_button_0: button_0 {
label = "User SW2";
gpios = <&gpiod 3 GPIO_ACTIVE_LOW>;
zephyr,code = <INPUT_KEY_0>;
};
user_button_1: button_1 {
label = "User SW3";
gpios = <&gpiod 2 GPIO_ACTIVE_LOW>;
zephyr,code = <INPUT_KEY_1>;
};
};
};

&lpuart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&lpuart0_default>;
pinctrl-names = "default";
};

&gpiob {
status = "okay";
};

&gpiod {
status = "okay";
};
13 changes: 13 additions & 0 deletions boards/nxp/frdm_ke16z/frdm_ke16z.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
identifier: frdm_ke16z
name: NXP FRDM-KE16Z
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
flash: 64
ram: 8
supported:
- flash
- gpio
- uart
14 changes: 14 additions & 0 deletions boards/nxp/frdm_ke16z/frdm_ke16z_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# GPIO Controller
CONFIG_GPIO=y

# Clock Control
CONFIG_CLOCK_CONTROL=y
2 changes: 1 addition & 1 deletion boards/nxp/frdm_ke17z512/frdm_ke17z512.dts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

&scg {
bus_clk {
clock-div = <2>;
clock-div = <4>;
};
};

Expand Down
7 changes: 5 additions & 2 deletions drivers/clock_control/clock_control_mcux_scg.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ static int mcux_scg_get_rate(const struct device *dev,
case KINETIS_SCG_BUS_CLK:
clock_name = kCLOCK_BusClk;
break;
#if !(defined(CONFIG_SOC_MKE17Z7) || defined(CONFIG_SOC_MKE17Z9))
#if !(defined(CONFIG_SOC_MKE17Z7) || defined(CONFIG_SOC_MKE17Z9) || defined(CONFIG_SOC_MKE15Z7)\
|| defined(CONFIG_SOC_MKE15Z4) || defined(CONFIG_SOC_MKE16Z4))
case KINETIS_SCG_FLEXBUS_CLK:
clock_name = kCLOCK_FlexBusClk;
break;
Expand All @@ -69,7 +70,7 @@ static int mcux_scg_get_rate(const struct device *dev,
break;
#endif /* (defined(FSL_FEATURE_SCG_HAS_SPLL) && FSL_FEATURE_SCG_HAS_SPLL) */
#if (defined(FSL_FEATURE_SCG_HAS_LPFLL) && FSL_FEATURE_SCG_HAS_LPFLL)
case KINETIS_SCG_SPLL_CLK:
case KINETIS_SCG_LPFLL_CLK:
clock_name = kCLOCK_ScgLpFllClk;
break;
#endif /* (defined(FSL_FEATURE_SCG_HAS_LPFLL) && FSL_FEATURE_SCG_HAS_LPFLL) */
Expand Down Expand Up @@ -136,6 +137,8 @@ static int mcux_scg_init(const struct device *dev)
CLOCK_SetClkOutSel(kClockClkoutSelFirc);
#elif DT_SAME_NODE(DT_CLOCKS_CTLR(MCUX_SCG_CLOCK_NODE(clkout_clk)), MCUX_SCG_CLOCK_NODE(spll_clk))
CLOCK_SetClkOutSel(kClockClkoutSelSysPll);
#elif DT_SAME_NODE(DT_CLOCKS_CTLR(MCUX_SCG_CLOCK_NODE(clkout_clk)), MCUX_SCG_CLOCK_NODE(lpfll_clk))
CLOCK_SetClkOutSel(kClockClkoutSelSysLpfll);
#else
#error Unsupported SCG clkout clock source
#endif
Expand Down
8 changes: 8 additions & 0 deletions dts/arm/nxp/nxp_ke17z.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
};
};

tsi1: tsi@40047000 {
compatible = "nxp,tsi";
reg = <0x40047000 0x1000>;
status = "okay";
interrupts = <25 0>;
clocks = <&scg KINETIS_SCG_BUS_CLK>;
};

/* Remove rtc, it doesn't exist on KE17Z */
/delete-node/ rtc@4003d000;
};
Expand Down
20 changes: 19 additions & 1 deletion dts/arm/nxp/nxp_ke17z512.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 NXP
* Copyright 2024-2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -61,5 +61,23 @@
clocks = <&scg KINETIS_SCG_BUS_CLK>;
status = "disabled";
};

scg@40064000 {
/delete-node/ lpfll_clk;

lpfll_clk: lpfll_clk {
compatible = "fixed-clock";
clock-frequency = <96000000>;
#clock-cells = <0>;
};
};

tsi1: tsi@40047000 {
compatible = "nxp,tsi";
reg = <0x40047000 0x1000>;
status = "okay";
interrupts = <25 0>;
clocks = <&scg KINETIS_SCG_BUS_CLK>;
};
};
};
Loading