Skip to content

Commit

Permalink
boards: add USB-KW24D512 support
Browse files Browse the repository at this point in the history
Jira: ZEP-1472

Signed-off-by: Johann Fischer <[email protected]>
  • Loading branch information
jfischer-no authored and galak committed Oct 10, 2017
1 parent af1a8fc commit 52923e6
Show file tree
Hide file tree
Showing 12 changed files with 535 additions and 0 deletions.
11 changes: 11 additions & 0 deletions boards/arm/usb_kw24d512/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Kconfig - USB-KW24D512 board
#
# Copyright (c) 2017, Phytec Messtechnik GmbH
#
# SPDX-License-Identifier: Apache-2.0
#

config BOARD_USB_KW24D512
bool "NXP USB-KW24D512"
depends on SOC_SERIES_KINETIS_KWX
select SOC_PART_NUMBER_MKW24D512VHA5
135 changes: 135 additions & 0 deletions boards/arm/usb_kw24d512/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Kconfig - USB-KW24D512 board
#
# Copyright (c) 2017, Phytec Messtechnik GmbH
#
# SPDX-License-Identifier: Apache-2.0
#

if BOARD_USB_KW24D512

config BOARD
default usb_kw24d512

config OSC_XTAL0_FREQ
# The MCU is configured to use 4 MHz external
# clock from the transceiver provided at the CLK_OUT output.
# CLK_OUT is internally connected to the input pin EXTAL0
# of the MCU.
default 4000000

config MCG_PRDIV0
default 0x1

config MCG_VDIV0
default 0x0

config MCG_FCRDIV
default 2

if UART_MCUX

config UART_MCUX_0
def_bool y

endif # UART_MCUX


config PINMUX
def_bool y

if PINMUX_MCUX

config PINMUX_MCUX_PORTA
def_bool y if UART_MCUX_0

config PINMUX_MCUX_PORTB
def_bool y if SPI_1

config PINMUX_MCUX_PORTC
def_bool y

config PINMUX_MCUX_PORTD
def_bool y

endif # PINMUX_MCUX

if GPIO_MCUX

config GPIO_MCUX_PORTA
def_bool y

config GPIO_MCUX_PORTB
def_bool y

config GPIO_MCUX_PORTC
def_bool y

config GPIO_MCUX_PORTD
def_bool y

config GPIO_MCUX_PORTE
def_bool y

endif # GPIO_MCUX

if I2C

config I2C_0
def_bool y

config I2C_1
def_bool n

endif # I2C

if ADC

config ADC_0
def_bool y

endif # ADC

if PWM_MCUX_FTM

config PWM_1
def_bool y

endif # PWM_MCUX_FTM

if SPI

config SPI_1
def_bool y

config SPI_1_IRQ_PRI
default 3

endif # SPI

if IEEE802154_MCR20A || IEEE802154_MCR20A_RAW

config IEEE802154_MCR20A_SPI_DRV_NAME
default SPI_1_NAME

config MCR20A_GPIO_IRQ_B_NAME
default GPIO_MCUX_PORTB_NAME

config MCR20A_GPIO_IRQ_B_PIN
default 3

config MCR20A_GPIO_RESET_NAME
default GPIO_MCUX_PORTB_NAME

config MCR20A_GPIO_RESET_PIN
default 19

config IEEE802154_MCR20A_SPI_FREQ
default 8000000

config MCR20A_IS_PART_OF_KW2XD_SIP
default y

endif # IEEE802154_MCR20A || IEEE802154_MCR20A_RAW


endif # BOARD_USB_KW24D512
3 changes: 3 additions & 0 deletions boards/arm/usb_kw24d512/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ccflags-y +=-I$(srctree)/drivers

obj-$(CONFIG_PINMUX_MCUX) += pinmux.o
5 changes: 5 additions & 0 deletions boards/arm/usb_kw24d512/Makefile.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DEBUG_SCRIPT = jlink.sh

JLINK_DEVICE = MKW24D512xxx5

export JLINK_DEVICE
24 changes: 24 additions & 0 deletions boards/arm/usb_kw24d512/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2017 Phytec Messtechnik GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __INC_BOARD_H
#define __INC_BOARD_H

#include <soc.h>

/* Push button switch (SW1) */
#define SW0_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME
#define SW0_GPIO_PIN 4

/* LED0 (D2) */
#define LED0_GPIO_PORT CONFIG_GPIO_MCUX_PORTD_NAME
#define LED0_GPIO_PIN 4

/* LED1 (D3) */
#define LED1_GPIO_PORT CONFIG_GPIO_MCUX_PORTD_NAME
#define LED1_GPIO_PIN 5

#endif /* __INC_BOARD_H */
181 changes: 181 additions & 0 deletions boards/arm/usb_kw24d512/doc/usb_kw24d512.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
.. _usb_kw24d512:

NXP USB-KW24D512
################

Overview
********

The USB-KW24D512 is an evaluation board in a convenient USB dongle
form factor based on the NXP MKW24D512 System-in-Package (SiP) device
(KW2xD wireless MCU series).
MKW24D512 wireless MCU provides a low-power, compact device with
integrated IEEE 802.15.4 radio. The board can be used as a packet sniffer,
network node, border router or as a development board.

Hardware
********

- Kinetis KW2xD-2.4 GHz 802.15.4 Wireless Radio Microcontroller
(50 MHz, 512 KB flash memory, 64 KB RAM, low-power, crystal-less USB)
- USB Type A Connector
- Two blue LEDs
- One user push button
- One reset button
- Integrated PCB Folded F-type antenna
- 10-pin (0.05”) JTAG debug port for target MCU

For more information about the KW2xD SiP and USB-KW24D512 board:

- `KW2xD Website`_
- `KW2xD Datasheet`_
- `KW2xD Reference Manual`_
- `USB-KW24D512 Website`_
- `USB-KW24D512 Hardware Reference Manual`_

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

The USB-KW24D512 board configuration 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 |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SPI | on-chip | spi |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | soc flash |
+-----------+------------+-------------------------------------+

The default configuration can be found in the defconfig file:

``boards/arm/usb_kw24d512/usb_kw24d512_defconfig``

Other hardware features are not currently supported by the port.

Connections and IOs
===================

The KW2xD SoC has five pairs of pinmux/gpio controllers.

+-------+-----------------+--------------------------------------+
| Name | Function | Usage |
+=======+=================+======================================+
| PTA1 | UART0_RX | UART Console |
+-------+-----------------+--------------------------------------+
| PTA2 | UART0_TX | UART Console |
+-------+-----------------+--------------------------------------+
| PTC4 | GPIO | SW1 |
+-------+-----------------+--------------------------------------+
| PTD4 | GPIO | Blue LED (D2) |
+-------+-----------------+--------------------------------------+
| PTD5 | GPIO | Blue LED (D3) |
+-------+-----------------+--------------------------------------+
| PTB10 | SPI1_PCS0 | internal connected to MCR20A |
+-------+-----------------+--------------------------------------+
| PTB11 | SPI1_SCK | internal connected to MCR20A |
+-------+-----------------+--------------------------------------+
| PTB16 | SPI1_SOUT | internal connected to MCR20A |
+-------+-----------------+--------------------------------------+
| PTB17 | SPI1_SIN | internal connected to MCR20A |
+-------+-----------------+--------------------------------------+
| PTB19 | GPIO | internal connected to MCR20A (Reset) |
+-------+-----------------+--------------------------------------+
| PTB3 | GPIO | internal connected to MCR20A (IRQ_B) |
+-------+-----------------+--------------------------------------+
| PTC0 | GPIO | internal connected to MCR20A (GPIO5) |
+-------+-----------------+--------------------------------------+

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

USB-KW24D512 contains 32 MHz oscillator crystal, which is connected to the
clock pins of the radio transceiver. The MCU is configured to
use the 4 MHz external clock from the transceiver with the on-chip PLL
to generate a 48 MHz system clock.

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

The KW2xD SoC has three UARTs. One is configured and can be used for the
console, but it uses the same pins as the JTAG interface and is only
accessible via the JTAG SWD connector.

Programming and Debugging
*************************

Currently only the J-Link tools and the `Segger J-Link debug probe`_ are
supported. The J-Link probe should be connected to the JTAG-SWD connector on
the USB-KW24D512 board. To use the Segger J-Link tools, follow the instructions
in the :ref:`nxp_opensda_jlink` page.

Flashing
========

The Segger J-Link firmware does not support command line flashing, therefore
the ``make flash`` build target is not supported.

Debugging
=========

This example uses the :ref:`hello_world` sample with the
:ref:`nxp_opensda_jlink` tools. Use the ``make debug`` build target to build
your Zephyr application, invoke the J-Link GDB server, attach a GDB client, and
program your Zephyr application to flash. It will leave you at a gdb prompt.

.. code-block:: console
$ cd <zephyr_root_path>
$ . zephyr-env.sh
$ cd samples/hello_world/
$ make BOARD=usb_kw24d512 debug
In a second terminal, open telnet:

.. code-block:: console
$ telnet localhost 19021
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SEGGER J-Link V6.16j - Real time terminal output
SEGGER J-Link ARM V6.0, SN=xxxxxxxx
Process: JLinkGDBServer
Continue program execution in GDB, then in the telnet terminal you should see:

.. code-block:: console
***** BOOTING ZEPHYR OS v1.8.99 - BUILD: Jul 26 2017 15:39:04 *****
Hello World! arm
.. _USB-KW24D512 Website:
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/w-series-wireless-m0-plus-m4/ieee-802.15.4-packet-sniffer-usb-dongle-form-factor:USB-KW24D512

.. _USB-KW24D512 Hardware Reference Manual:
http://www.nxp.com/docs/en/reference-manual/USB-KW2XHWRM.pdf

.. _KW2xD Website:
http://www.nxp.com/products/wireless-connectivity/2.4-ghz-wireless-solutions/ieee-802.15.4-wireless-mcus/kinetis-kw2xd-2.4-ghz-802.15.4-wireless-radio-microcontroller-mcu-based-on-arm-cortex-m4-core:KW2xD

.. _KW2xD Datasheet:
http://www.nxp.com/docs/en/data-sheet/MKW2xDxxx.pdf

.. _KW2xD Reference Manual:
http://www.nxp.com/docs/en/reference-manual/MKW2xDxxxRM.pdf

.. _Segger J-Link debug probe:
https://www.segger.com/products/debug-probes/j-link/models/j-link-base/
Loading

0 comments on commit 52923e6

Please sign in to comment.