1.. zephyr:board:: frdm_kw41z 2 3Overview 4******** 5 6The FRDM-KW41Z is a development kit enabled by the Kinetis |reg| W series 7KW41Z/31Z/21Z (KW41Z) family built on ARM |reg| Cortex |reg|-M0+ processor with 8integrated 2.4 GHz transceiver supporting Bluetooth |reg| Smart/Bluetooth 9|reg| Low Energy 10(BLE) v4.2, Generic FSK, IEEE |reg| 802.15.4 and Thread. 11 12The FRDM-KW41Z kit contains two Freedom boards that can be used as a 13development board or a shield to connect to a host processor. The FRDM-KW41Z is 14form-factor compatible with the Arduino |trade| R3 pin layout for more expansion 15options. 16 17The FRDM-KW41Z highly-sensitive, optimized 2.4 GHz radio features a PCB 18F-antenna which can be bypassed to test via SMA connection, multiple power 19supply options, push/capacitive touch buttons, switches, LEDs and integrated 20sensors. 21 22Hardware 23******** 24 25- Can be configured as Host or Shield for connection to Host Processor 26- Supports all DC-DC configurations (Buck, Boost, Bypass) 27- PCB inverted F-type antenna 28- SMA RF Connector 29- RF regulatory certified 30- Serial Flash for OTA firmware upgrades 31- On board NXP FXOS8700CQ digital sensor, 3D Accelerometer ( |plusminus| 2g/ 32 |plusminus| 4g/ |plusminus| 8g) + 3D 33 Magnetometer 34- OpenSDA and JTAG debug 35 36For more information about the KW41Z SoC and FRDM-KW41Z board: 37 38- `KW41Z Website`_ 39- `KW41Z Datasheet`_ 40- `KW41Z Reference Manual`_ 41- `FRDM-KW41Z Website`_ 42- `FRDM-KW41Z User Guide`_ 43- `FRDM-KW41Z Schematics`_ 44 45Supported Features 46================== 47 48The frdm_kw41z board configuration supports the following hardware features: 49 50+-----------+------------+-------------------------------------+ 51| Interface | Controller | Driver/Component | 52+===========+============+=====================================+ 53| NVIC | on-chip | nested vector interrupt controller | 54+-----------+------------+-------------------------------------+ 55| SYSTICK | on-chip | systick | 56+-----------+------------+-------------------------------------+ 57| PINMUX | on-chip | pinmux | 58+-----------+------------+-------------------------------------+ 59| COUNTER | on-chip | rtc | 60+-----------+------------+-------------------------------------+ 61| GPIO | on-chip | gpio | 62+-----------+------------+-------------------------------------+ 63| I2C | on-chip | i2c | 64+-----------+------------+-------------------------------------+ 65| SPI | on-chip | spi | 66+-----------+------------+-------------------------------------+ 67| ADC | on-chip | adc | 68+-----------+------------+-------------------------------------+ 69| UART | on-chip | serial port-polling; | 70| | | serial port-interrupt | 71+-----------+------------+-------------------------------------+ 72| FLASH | on-chip | soc flash | 73+-----------+------------+-------------------------------------+ 74| SENSOR | off-chip | fxos8700 polling: | 75| | | fxos8700 trigger | 76+-----------+------------+-------------------------------------+ 77| PWM | on-chip | tpm | 78+-----------+------------+-------------------------------------+ 79| TRNG | on-chip | entropy | 80+-----------+------------+-------------------------------------+ 81| FTFA | on-chip | flash programming | 82+-----------+------------+-------------------------------------+ 83 84The default configuration can be found in 85:zephyr_file:`boards/nxp/frdm_kw41z/frdm_kw41z_defconfig` 86 87Other hardware features are not currently supported by the port. 88 89Connections and IOs 90=================== 91 92The KW41Z SoC has three pairs of pinmux/gpio controllers, but only two are 93currently enabled (PORTA/GPIOA and PORTC/GPIOC) for the FRDM-KW41Z board. 94 95+-------+-------------+---------------------------+ 96| Name | Function | Usage | 97+=======+=============+===========================+ 98| PTC1 | GPIO | Red LED / FXOS8700 INT1 | 99+-------+-------------+---------------------------+ 100| PTA19 | GPIO | Green LED | 101+-------+-------------+---------------------------+ 102| PTA18 | GPIO | Blue LED | 103+-------+-------------+---------------------------+ 104| PTB2 | ADC | ADC0 channel 3 | 105+-------+-------------+---------------------------+ 106| PTC2 | I2C1_SCL | I2C / FXOS8700 | 107+-------+-------------+---------------------------+ 108| PTC3 | I2C1_SDA | I2C / FXOS8700 | 109+-------+-------------+---------------------------+ 110| PTC4 | GPIO | SW3 | 111+-------+-------------+---------------------------+ 112| PTC5 | GPIO | SW4 | 113+-------+-------------+---------------------------+ 114| PTC6 | LPUART0_RX | UART Console | 115+-------+-------------+---------------------------+ 116| PTC7 | LPUART0_TX | UART Console | 117+-------+-------------+---------------------------+ 118| PTC16 | SPI0_SCK | SPI | 119+-------+-------------+---------------------------+ 120| PTC17 | SPI0_SOUT | SPI | 121+-------+-------------+---------------------------+ 122| PTC18 | SPI0_SIN | SPI | 123+-------+-------------+---------------------------+ 124| PTC19 | SPI0_PCS0 | SPI | 125+-------+-------------+---------------------------+ 126 127System Clock 128============ 129 130The KW41Z SoC is configured to use the 32 MHz external oscillator on the board 131with the on-chip FLL to generate a 40 MHz system clock. 132 133Serial Port 134=========== 135 136The KW41Z SoC has one UART, which is used for the console. 137 138Programming and Debugging 139************************* 140 141Build and flash applications as usual (see :ref:`build_an_application` and 142:ref:`application_run` for more details). 143 144Configuring a Debug Probe 145========================= 146 147A debug probe is used for both flashing and debugging the board. This board is 148configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`. 149 150Option 1: :ref:`opensda-daplink-onboard-debug-probe` (Recommended) 151------------------------------------------------------------------ 152 153Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search 154path. 155 156Follow the instructions in :ref:`opensda-daplink-onboard-debug-probe` to program 157the `OpenSDA DAPLink FRDM-KW41Z Firmware`_. 158 159Option 2: :ref:`opensda-jlink-onboard-debug-probe` 160-------------------------------------------------- 161 162Install the :ref:`jlink-debug-host-tools` and make sure they are in your search 163path. 164 165Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program 166the `OpenSDA J-Link FRDM-KW41Z Firmware`_. 167 168Add the arguments ``-DBOARD_FLASH_RUNNER=jlink`` and 169``-DBOARD_DEBUG_RUNNER=jlink`` when you invoke ``west build`` to override the 170default runner from pyOCD to J-Link: 171 172.. zephyr-app-commands:: 173 :zephyr-app: samples/hello_world 174 :board: frdm_kw41z 175 :gen-args: -DBOARD_FLASH_RUNNER=jlink -DBOARD_DEBUG_RUNNER=jlink 176 :goals: build 177 178Configuring a Console 179===================== 180 181Regardless of your choice in debug probe, we will use the OpenSDA 182microcontroller as a usb-to-serial adapter for the serial console. 183 184Connect a USB cable from your PC to J6. 185 186Use the following settings with your serial terminal of choice (minicom, putty, 187etc.): 188 189- Speed: 115200 190- Data: 8 bits 191- Parity: None 192- Stop bits: 1 193 194Flashing 195======== 196 197Here is an example for the :zephyr:code-sample:`hello_world` application. 198 199.. zephyr-app-commands:: 200 :zephyr-app: samples/hello_world 201 :board: frdm_kw41z 202 :goals: flash 203 204Open a serial terminal, reset the board (press the SW1 button), and you should 205see the following message in the terminal: 206 207.. code-block:: console 208 209 ***** Booting Zephyr OS v1.14.0-rc1 ***** 210 Hello World! frdm_kw41z 211 212Debugging 213========= 214 215Here is an example for the :zephyr:code-sample:`hello_world` application. 216 217.. zephyr-app-commands:: 218 :zephyr-app: samples/hello_world 219 :board: frdm_kw41z 220 :goals: debug 221 222Open a serial terminal, step through the application in your debugger, and you 223should see the following message in the terminal: 224 225.. code-block:: console 226 227 ***** Booting Zephyr OS v1.14.0-rc1 ***** 228 Hello World! frdm_kw41z 229 230.. _FRDM-KW41Z Website: 231 https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/w-serieswireless-conn.m0-plus-m4/freedom-development-kit-for-kinetis-kw41z-31z-21z-mcus:FRDM-KW41Z 232 233.. _FRDM-KW41Z User Guide: 234 https://www.nxp.com/webapp/Download?colCode=FRDMKW41ZUG 235 236.. _FRDM-KW41Z Schematics: 237 https://www.nxp.com/webapp/Download?colCode=FRDM-KW41Z-SCH 238 239.. _KW41Z Website: 240 https://www.nxp.com/products/wireless/zigbee/kinetis-kw41z-2.4-ghz-dual-mode-bluetooth-low-energy-and-802.15.4-wireless-radio-microcontroller-mcu-based-on-arm-cortex-m0-plus-core:KW41Z 241 242.. _KW41Z Datasheet: 243 https://www.nxp.com/docs/en/data-sheet/MKW41Z512.pdf 244 245.. _KW41Z Reference Manual: 246 https://www.nxp.com/webapp/Download?colCode=MKW41Z512RM 247 248.. _OpenSDA DAPLink FRDM-KW41Z Firmware: 249 https://www.nxp.com/downloads/en/reference-applications/OpenSDAv2.2_DAPLink_frdmkw41z_rev0241.zip 250 251.. _OpenSDA J-Link FRDM-KW41Z Firmware: 252 https://www.segger.com/downloads/jlink/OpenSDA_FRDM-KW41Z 253