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