From 2c1e3183896542057066eec6d5b2087e72d7fc71 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Tue, 17 Jan 2017 19:55:53 -0600 Subject: frdm_kw41z: Add frdm_kw41z board Adds initial support and documentation for the frdm_kw41z board. - Configures the kw41 to use the 32 MHz external oscillator on the board to generate a 40 MHz system clock. The clock settings match the MCUX SDK hello_world example project. - Provides pinmux settings for the uart, i2c, LEDs, and switches - Enables pinmux, gpio, uart, and i2c driver instances - Configures the fxos8700 accelerometer/magnetometer driver Jira: ZEP-1390 Change-Id: I025a0eae3d380eaf90b02683acf5c592e2204a2e Signed-off-by: Maureen Helm --- boards/arm/frdm_kw41z/Kconfig.board | 11 ++ boards/arm/frdm_kw41z/Kconfig.defconfig | 100 ++++++++++++++++ boards/arm/frdm_kw41z/Makefile | 10 ++ boards/arm/frdm_kw41z/board.h | 44 +++++++ boards/arm/frdm_kw41z/doc/frdm_kw41z.jpg | Bin 0 -> 161842 bytes boards/arm/frdm_kw41z/doc/frdm_kw41z.rst | 180 +++++++++++++++++++++++++++++ boards/arm/frdm_kw41z/frdm_kw41z_defconfig | 11 ++ boards/arm/frdm_kw41z/pinmux.c | 52 +++++++++ scripts/sanity_chk/arches/arm.ini | 2 +- 9 files changed, 409 insertions(+), 1 deletion(-) create mode 100644 boards/arm/frdm_kw41z/Kconfig.board create mode 100644 boards/arm/frdm_kw41z/Kconfig.defconfig create mode 100644 boards/arm/frdm_kw41z/Makefile create mode 100644 boards/arm/frdm_kw41z/board.h create mode 100644 boards/arm/frdm_kw41z/doc/frdm_kw41z.jpg create mode 100644 boards/arm/frdm_kw41z/doc/frdm_kw41z.rst create mode 100644 boards/arm/frdm_kw41z/frdm_kw41z_defconfig create mode 100644 boards/arm/frdm_kw41z/pinmux.c diff --git a/boards/arm/frdm_kw41z/Kconfig.board b/boards/arm/frdm_kw41z/Kconfig.board new file mode 100644 index 000000000..195a1dc8c --- /dev/null +++ b/boards/arm/frdm_kw41z/Kconfig.board @@ -0,0 +1,11 @@ +# Kconfig - FRDM-KW41Z board +# +# Copyright (c) 2017, NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +config BOARD_FRDM_KW41Z + bool "NXP FRDM-KW41Z" + depends on SOC_SERIES_KINETIS_KWX + select SOC_PART_NUMBER_MKW41Z512VHT4 diff --git a/boards/arm/frdm_kw41z/Kconfig.defconfig b/boards/arm/frdm_kw41z/Kconfig.defconfig new file mode 100644 index 000000000..e443d9875 --- /dev/null +++ b/boards/arm/frdm_kw41z/Kconfig.defconfig @@ -0,0 +1,100 @@ +# Kconfig - FRDM-KW41Z board +# +# Copyright (c) 2017, NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +if BOARD_FRDM_KW41Z + +config BOARD + default frdm_kw41z + +config FLASH_SIZE + default 512 + +config SRAM_SIZE + default 128 + +config OSC_XTAL0_FREQ + default 32000000 + +config MCG_FRDIV + default 5 + +config MCG_FCRDIV + default 0 + +config PINMUX + def_bool y + +if PINMUX_MCUX + +config PINMUX_MCUX_PORTA + def_bool y + +config PINMUX_MCUX_PORTB + def_bool n + +config PINMUX_MCUX_PORTC + def_bool y + +endif # PINMUX_MCUX + +if GPIO_MCUX + +config GPIO_MCUX_PORTA + def_bool y + +config GPIO_MCUX_PORTB + def_bool n + +config GPIO_MCUX_PORTC + def_bool y + +endif # GPIO_MCUX + +if UART_MCUX_LPUART + +config UART_MCUX_LPUART_0 + def_bool y if UART_CONSOLE + +endif # UART_MCUX + +if I2C + +config I2C_1 + def_bool y + +if I2C_1 + +config I2C_1_DEFAULT_CFG + default 0x12 + +config I2C_1_IRQ_PRI + default 0 + +endif # I2C_1 + +endif # I2C + +if FXOS8700 + +config FXOS8700_I2C_NAME + default I2C_1_NAME + +config FXOS8700_I2C_ADDRESS + default 0x1f + +config FXOS8700_GPIO_NAME + default GPIO_MCUX_PORTC_NAME + +config FXOS8700_GPIO_PIN + default 1 + +config FXOS8700_DRDY_INT1 + def_bool y + +endif # FXOS8700 + +endif # BOARD_FRDM_KW41Z diff --git a/boards/arm/frdm_kw41z/Makefile b/boards/arm/frdm_kw41z/Makefile new file mode 100644 index 000000000..f121cc852 --- /dev/null +++ b/boards/arm/frdm_kw41z/Makefile @@ -0,0 +1,10 @@ +# Makefile - FRDM-KW41Z board +# +# Copyright (c) 2017, NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +ccflags-y +=-I$(srctree)/drivers + +obj-$(CONFIG_PINMUX_MCUX) += pinmux.o diff --git a/boards/arm/frdm_kw41z/board.h b/boards/arm/frdm_kw41z/board.h new file mode 100644 index 000000000..429416478 --- /dev/null +++ b/boards/arm/frdm_kw41z/board.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017, NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +/* Push button switch 3 */ +#define SW3_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME +#define SW3_GPIO_PIN 4 + +/* Push button switch 4 */ +#define SW4_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME +#define SW4_GPIO_PIN 5 + +/* Red LED */ +#define RED_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME +#define RED_GPIO_PIN 1 + +/* Green LED */ +#define GREEN_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME +#define GREEN_GPIO_PIN 19 + +/* Blue LED */ +#define BLUE_GPIO_NAME CONFIG_GPIO_MCUX_PORTA_NAME +#define BLUE_GPIO_PIN 18 + +/* LED0. There is no physical LED on the board with this name, so create an + * alias to the green LED to make the basic blinky sample work. + */ +#define LED0_GPIO_PORT GREEN_GPIO_NAME +#define LED0_GPIO_PIN GREEN_GPIO_PIN + +/* Push button switch 0. There is no physical switch on the board with this + * name, so create an alias to SW3 to make the basic button sample work. + */ +#define SW0_GPIO_NAME SW3_GPIO_NAME +#define SW0_GPIO_PIN SW3_GPIO_PIN + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/frdm_kw41z/doc/frdm_kw41z.jpg b/boards/arm/frdm_kw41z/doc/frdm_kw41z.jpg new file mode 100644 index 000000000..31ab05a68 Binary files /dev/null and b/boards/arm/frdm_kw41z/doc/frdm_kw41z.jpg differ diff --git a/boards/arm/frdm_kw41z/doc/frdm_kw41z.rst b/boards/arm/frdm_kw41z/doc/frdm_kw41z.rst new file mode 100644 index 000000000..734bc856b --- /dev/null +++ b/boards/arm/frdm_kw41z/doc/frdm_kw41z.rst @@ -0,0 +1,180 @@ +.. _frdm_kw41z: + +NXP FRDM-KW41Z +############## + +Overview +******** + +The FRDM-KW41Z is a development kit enabled by the Kinetis® W series +KW41Z/31Z/21Z (KW41Z) family built on ARM® Cortex®-M0+ processor with +integrated 2.4 GHz transceiver supporting Bluetooth® Smart/Bluetooth®Low Energy +(BLE) v4.2, Generic FSK, IEEE® 802.15.4 and Thread. + +The FRDM-KW41Z kit contains two Freedom boards that can be used as a +development board or a shield to connect to a host processor. The FRDM-KW41Z is +form-factor compatible with the Arduino™ R3 pin layout for more expansion +options. + +The FRDM-KW41Z highly-sensitive, optimized 2.4 GHz radio features a PCB +F-antenna which can be bypassed to test via SMA connection, multiple power +supply options, push/capacitive touch buttons, switches, LEDs and integrated +sensors. + +.. image:: frdm_kw41z.jpg + :width: 720px + :align: center + :alt: FRDM-KW41Z + +Hardware +******** + +- Can be configured as Host or Shield for connection to Host Processor +- Supports all DC-DC configurations (Buck, Boost, Bypass) +- PCB inverted F-type antenna +- SMA RF Connector +- RF regulatory certified +- Serial Flash for OTA firmware upgrades +- On board NXP FXOS8700CQ digital sensor, 3D Accelerometer (±2g/±4g/±8g) + 3D + Magnetometer +- OpenSDA and JTAG debug + +For more information about the KW41Z SoC and FRDM-KW41Z board: + +- `KW41Z Website`_ +- `KW41Z Datasheet`_ +- `KW41Z Reference Manual`_ +- `FRDM-KW41Z Website`_ +- `FRDM-KW41Z User Guide`_ +- `FRDM-KW41Z Schematics`_ + +Supported Features +================== + +The frdm_kw41z 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 | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | soc flash | ++-----------+------------+-------------------------------------+ +| SENSOR | off-chip | fxos8700 polling: | +| | | fxos8700 trigger | ++-----------+------------+-------------------------------------+ + +The default configuration can be found in the defconfig file: + + ``boards/arm/frdm_kw41z/frdm_kw41z_defconfig`` + +Other hardware features are not currently supported by the port. + +Connections and IOs +=================== + +The KW41Z SoC has three pairs of pinmux/gpio controllers, but only two are +currently enabled (PORTA/GPIOA and PORTC/GPIOC) for the FRDM-KW41Z board. + ++-------+-------------+---------------------------+ +| Name | Function | Usage | ++=======+=============+===========================+ +| PTC1 | GPIO | Red LED / FXOS8700 INT1 | ++-------+-------------+---------------------------+ +| PTA19 | GPIO | Green LED | ++-------+-------------+---------------------------+ +| PTA18 | GPIO | Blue LED | ++-------+-------------+---------------------------+ +| PTC2 | I2C1_SCL | I2C / FXOS8700 | ++-------+-------------+---------------------------+ +| PTC3 | I2C1_SDA | I2C / FXOS8700 | ++-------+-------------+---------------------------+ +| PTC4 | GPIO | SW3 | ++-------+-------------+---------------------------+ +| PTC5 | GPIO | SW4 | ++-------+-------------+---------------------------+ +| PTC6 | LPUART0_RX | UART Console | ++-------+-------------+---------------------------+ +| PTC7 | LPUART0_TX | UART Console | ++-------+-------------+---------------------------+ + +System Clock +============ + +The KW41Z SoC is configured to use the 32 MHz external oscillator on the board +with the on-chip FLL to generate a 40 MHz system clock. + +Serial Port +=========== + +The KW41Z SoC has one UART, which is used for the console. + +Programming and Debugging +************************* + +Flashing +======== + +The FRDM-KW41Z includes an `OpenSDA`_ serial and debug adaptor built into the +board. The adaptor provides: + +- A USB connection to the host computer, which exposes a Mass Storage and an + USB Serial Port. +- A Serial Flash device, which implements the USB flash disk file storage. +- A physical UART connection which is relayed over interface USB Serial port. + +Flashing an application to FRDM-KW41Z +------------------------------------- + +Build the Zephyr kernel and application: + +.. code-block:: console + + $ cd $ZEPHYR_BASE + $ . zephyr-env.sh + $ cd $ZEPHYR_BASE/samples/hello_world/ + $ make BOARD=frdm_kw41z + +Connect the FRDM-KW41Z to your host computer using the USB port and you should +see a USB connection which exposes a Mass Storage (DAPLINK) and a USB Serial +Port. Copy the generated zephyr.bin in the DAPLINK drive. + +Reset the board and you should be able to see on the corresponding Serial Port +the following message: + +.. code-block:: console + + Hello World! arm + + +.. _FRDM-KW41Z Website: + http://www.nxp.com/products/microcontrollers-and-processors/more-processors/application-specific-mcus-mpus/bluetooth-low-energy-ble/nxp-freedom-development-kit-for-kinetis-kw41z-31z-21z-mcus:FRDM-KW41Z + +.. _FRDM-KW41Z User Guide: + http://www.nxp.com/assets/documents/data/en/user-guides/FRDMKW41ZUG.pdf + +.. _FRDM-KW41Z Schematics: + http://www.nxp.com/assets/downloads/data/en/schematics/FRDM-KW41Z-SCH.pdf + +.. _OpenSDA: + http://www.nxp.com/products/software-and-tools/hardware-development-tools/startertrak-development-boards/opensda-serial-and-debug-adapter:OPENSDA#FRDM-KW41Z + +.. _KW41Z Website: + http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/w-series-wireless-m0-plus-m4/kinetis-kw41z-2.4-ghz-dual-mode-ble-and-802.15.4-wireless-radio-microcontroller-mcu-based-on-arm-cortex-m0-plus-core:KW41Z + +.. _KW41Z Datasheet: + http://www.nxp.com/assets/documents/data/en/data-sheets/MKW41Z512.pdf + +.. _KW41Z Reference Manual: + http://www.nxp.com/assets/documents/data/en/reference-manuals/MKW41Z512RM.pdf diff --git a/boards/arm/frdm_kw41z/frdm_kw41z_defconfig b/boards/arm/frdm_kw41z/frdm_kw41z_defconfig new file mode 100644 index 000000000..b9de9b986 --- /dev/null +++ b/boards/arm/frdm_kw41z/frdm_kw41z_defconfig @@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_SOC_MKW41Z4=y +CONFIG_SOC_SERIES_KINETIS_KWX=y +CONFIG_BOARD_FRDM_KW41Z=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_CORTEX_M_SYSTICK=y +CONFIG_GPIO=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=40000000 +CONFIG_OSC_EXTERNAL=y diff --git a/boards/arm/frdm_kw41z/pinmux.c b/boards/arm/frdm_kw41z/pinmux.c new file mode 100644 index 000000000..26bdf6a7b --- /dev/null +++ b/boards/arm/frdm_kw41z/pinmux.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +static int frdm_kw41z_pinmux_init(struct device *dev) +{ + ARG_UNUSED(dev); + +#ifdef CONFIG_PINMUX_MCUX_PORTA + struct device *porta = + device_get_binding(CONFIG_PINMUX_MCUX_PORTA_NAME); +#endif +#ifdef CONFIG_PINMUX_MCUX_PORTC + struct device *portc = + device_get_binding(CONFIG_PINMUX_MCUX_PORTC_NAME); +#endif + + /* Red, green, blue LEDs. Note the red LED and accel INT1 are both + * wired to PTC1. + */ + pinmux_pin_set(portc, 1, PORT_PCR_MUX(kPORT_MuxAsGpio)); + pinmux_pin_set(porta, 19, PORT_PCR_MUX(kPORT_MuxAsGpio)); + pinmux_pin_set(porta, 18, PORT_PCR_MUX(kPORT_MuxAsGpio)); + +#if CONFIG_I2C_1 + /* I2C1 SCL, SDA */ + pinmux_pin_set(portc, 2, PORT_PCR_MUX(kPORT_MuxAlt3) + | PORT_PCR_PS_MASK); + pinmux_pin_set(portc, 3, PORT_PCR_MUX(kPORT_MuxAlt3) + | PORT_PCR_PS_MASK); +#endif + + /* SW3, SW4 */ + pinmux_pin_set(portc, 4, PORT_PCR_MUX(kPORT_MuxAsGpio)); + pinmux_pin_set(portc, 5, PORT_PCR_MUX(kPORT_MuxAsGpio)); + +#ifdef CONFIG_UART_MCUX_LPUART_0 + /* UART0 RX, TX */ + pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt4)); + pinmux_pin_set(portc, 7, PORT_PCR_MUX(kPORT_MuxAlt4)); +#endif + + return 0; +} + +SYS_INIT(frdm_kw41z_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY); diff --git a/scripts/sanity_chk/arches/arm.ini b/scripts/sanity_chk/arches/arm.ini index 01200fdf6..5009611a6 100644 --- a/scripts/sanity_chk/arches/arm.ini +++ b/scripts/sanity_chk/arches/arm.ini @@ -5,7 +5,7 @@ platforms = qemu_cortex_m3 frdm_k64f arduino_due nucleo_f103rb stm32_mini_a15 nrf51_pca10028 nucleo_f401re 96b_carbon nrf51_blenano arduino_101_ble cc3200_launchxl quark_se_c1000_ble bbc_microbit v2m_beetle nucleo_l476rg nrf52840_pca10056 nucleo_f411re - stm3210c_eval nucleo_f334r8 stm32373c_eval mps2_an385 + stm3210c_eval nucleo_f334r8 stm32373c_eval mps2_an385 frdm_kw41z supported_toolchains = zephyr gccarmemb [qemu_cortex_m3] -- cgit v1.2.3