1.. zephyr:board:: frdm_k82f
2
3Overview
4********
5
6The FRDM-K82F is a low-cost development platform for Kinetis K80, K81,
7and K82 MCUs.
8
9- Form-factor compatible with the Arduino R3 pin layout
10- Peripherals enable rapid prototyping, including a six-axis digital
11  accelerometer and magnetometer to create full eCompass capabilities, a
12  tri-colored LED and two user push-buttons for direct interaction, 2x32 Mb
13  QuadSPI external flash, FlexIO camera header, touchpads and headers for use
14  with Bluetooth and 2.4 GHz radio add-on modules
15- OpenSDAv2.1, the NXP open source hardware embedded serial and debug adapter
16  running an open source bootloader, offers options for serial communication,
17  flash programming, and run-control debugging
18
19Hardware
20********
21
22- MK82FN256VLL15 MCU (150 MHz, 256 KB flash memory, 256 KB RAM, low-power,
23  crystal-less USB, and 100 Low profile Quad Flat Package (LQFP))
24- Dual role USB interface with micro-B USB connector
25- RGB LED
26- FXOS8700CQ accelerometer and magnetometer
27- Two user push buttons
28- 2x 32 Mb QSPI flash
29- Flexible power supply option - OpenSDAv2.1 USB, Kinetis K82 USB, and external source
30- Easy access to MCU input/output through Arduino R3 compatible I/O connectors
31- Programmable OpenSDAv2.1 debug circuit supporting the CMSIS-DAP Interface
32  software that provides:
33
34  - Mass storage device (MSD) flash programming interface
35  - CMSIS-DAP debug interface over a driver-less USB HID connection providing
36    run-control debugging and compatibility with IDE tools
37  - Virtual serial port interface
38  - Open source CMSIS-DAP software project
39
40- FlexIO header
41
42For more information about the K82F SoC and FRDM-K82F board:
43
44- `K82F Website`_
45- `K82F Datasheet`_
46- `K82F Reference Manual`_
47- `FRDM-K82F Website`_
48- `FRDM-K82F User Guide`_
49- `FRDM-K82F Schematics`_
50
51Supported Features
52==================
53
54The frdm_k82f board configuration supports the hardware features listed
55below.  For additional features not yet supported, please also refer to the
56:zephyr:board:`frdm_k64f`, which is the superset board in NXP's Kinetis K series.
57NXP prioritizes enabling the superset board with NXP's Full Platform Support for
58Zephyr.  Therefore, the frdm_k64f board may have additional features
59already supported, which can also be re-used on this frdm_k82f board:
60
61+-----------+------------+-------------------------------------+
62| Interface | Controller | Driver/Component                    |
63+===========+============+=====================================+
64| NVIC      | on-chip    | nested vector interrupt controller  |
65+-----------+------------+-------------------------------------+
66| SYSTICK   | on-chip    | systick                             |
67+-----------+------------+-------------------------------------+
68| PINMUX    | on-chip    | pinmux                              |
69+-----------+------------+-------------------------------------+
70| ADC       | on-chip    | adc                                 |
71+-----------+------------+-------------------------------------+
72| FLASH     | on-chip    | soc flash                           |
73+-----------+------------+-------------------------------------+
74| FLASH     | off-chip   | QSPI flash                          |
75+-----------+------------+-------------------------------------+
76| GPIO      | on-chip    | gpio                                |
77+-----------+------------+-------------------------------------+
78| I2C       | on-chip    | i2c                                 |
79+-----------+------------+-------------------------------------+
80| PWM       | on-chip    | pwm                                 |
81+-----------+------------+-------------------------------------+
82| RTC       | on-chip    | rtc                                 |
83+-----------+------------+-------------------------------------+
84| SENSOR    | off-chip   | fxos8700 polling;                   |
85|           |            | fxos8700 trigger                    |
86+-----------+------------+-------------------------------------+
87| SPI       | on-chip    | spi                                 |
88+-----------+------------+-------------------------------------+
89| UART      | on-chip    | serial port-polling;                |
90|           |            | serial port-interrupt               |
91+-----------+------------+-------------------------------------+
92| USB       | on-chip    | USB device                          |
93+-----------+------------+-------------------------------------+
94| WATCHDOG  | on-chip    | watchdog                            |
95+-----------+------------+-------------------------------------+
96| TRNG      | on-chip    | entropy                             |
97+-----------+------------+-------------------------------------+
98| FTFA      | on-chip    | flash programming                   |
99+-----------+------------+-------------------------------------+
100| PIT       | on-chip    | pit                                 |
101+-----------+------------+-------------------------------------+
102
103The default configuration can be found in
104:zephyr_file:`boards/nxp/frdm_k82f/frdm_k82f_defconfig`
105
106Other hardware features are not currently supported by the port.
107
108System Clock
109============
110
111The K82F SoC is configured to use the 12 MHz external oscillator on the board
112with the on-chip PLL to generate a 120 MHz system clock.
113
114Serial Port
115===========
116
117The K82F SoC has five UARTs. One is configured for the console, the remaining
118ones are not used.
119
120USB
121===
122
123The K82F SoC has a USB OTG (USBOTG) controller that supports both
124device and host functions through its micro USB connector (J11).
125Only USB device function is supported in Zephyr at the moment.
126
127Programming and Debugging
128*************************
129
130Build and flash applications as usual (see :ref:`build_an_application` and
131:ref:`application_run` for more details).
132
133Configuring a Debug Probe
134=========================
135
136A debug probe is used for both flashing and debugging the board. This board is
137configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`.
138
139Early versions of this board have an outdated version of the OpenSDA bootloader
140and require an update. Please see the `DAPLink Bootloader Update`_ page for
141instructions to update from the CMSIS-DAP bootloader to the DAPLink bootloader.
142
143Option 1: :ref:`opensda-daplink-onboard-debug-probe` (Recommended)
144------------------------------------------------------------------
145
146Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search
147path.
148
149Follow the instructions in :ref:`opensda-daplink-onboard-debug-probe` to program
150the `OpenSDA DAPLink FRDM-K82F Firmware`_.
151
152Option 2: :ref:`opensda-jlink-onboard-debug-probe`
153--------------------------------------------------
154
155Install the :ref:`jlink-debug-host-tools` and make sure they are in your search
156path.
157
158Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program
159the `OpenSDA J-Link Firmware for FRDM-K82F`_.
160
161Add the arguments ``-DBOARD_FLASH_RUNNER=jlink`` and
162``-DBOARD_DEBUG_RUNNER=jlink`` when you invoke ``west build`` to override the
163default runner from pyOCD to J-Link:
164
165.. zephyr-app-commands::
166   :zephyr-app: samples/hello_world
167   :board: frdm_k82f
168   :gen-args: -DBOARD_FLASH_RUNNER=jlink -DBOARD_DEBUG_RUNNER=jlink
169   :goals: build
170
171Configuring a Console
172=====================
173
174Regardless of your choice in debug probe, we will use the OpenSDA
175microcontroller as a usb-to-serial adapter for the serial console.
176
177Connect a USB cable from your PC to J5.
178
179Use the following settings with your serial terminal of choice (minicom, putty,
180etc.):
181
182- Speed: 115200
183- Data: 8 bits
184- Parity: None
185- Stop bits: 1
186
187Flashing
188========
189
190Here is an example for the :zephyr:code-sample:`hello_world` application.
191
192.. zephyr-app-commands::
193   :zephyr-app: samples/hello_world
194   :board: frdm_k82f
195   :goals: flash
196
197Open a serial terminal, reset the board (press the SW1 button), and you should
198see the following message in the terminal:
199
200.. code-block:: console
201
202   ***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx *****
203   Hello World! frdm_k82f
204
205Debugging
206=========
207
208Here is an example for the :zephyr:code-sample:`hello_world` application.
209
210.. zephyr-app-commands::
211   :zephyr-app: samples/hello_world
212   :board: frdm_k82f
213   :goals: debug
214
215Open a serial terminal, step through the application in your debugger, and you
216should see the following message in the terminal:
217
218.. code-block:: console
219
220   ***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx *****
221   Hello World! frdm_k82f
222
223.. _FRDM-K82F Website:
224   https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/freedom-development-platform-for-kinetis-k82-k81-and-k80-mcus:FRDM-K82F
225
226.. _FRDM-K82F User Guide:
227   https://www.nxp.com/webapp/Download?colCode=FRDMK82FUG
228
229.. _FRDM-K82F Schematics:
230   https://www.nxp.com/downloads/en/schematics/FRDM-K82F-SCH.pdf
231
232.. _K82F Website:
233   https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/k-series-cortex-m4/k8x-secure/kinetis-k82-150-mhz-hw-cryptographic-co-processor-quadspi-microcontrollers-mcus-based-on-arm-cortex-m4-core:K82_150
234
235.. _K82F Datasheet:
236   https://www.nxp.com/docs/en/data-sheet/K82P121M150SF5.pdf
237
238.. _K82F Reference Manual:
239   https://www.nxp.com/webapp/Download?colCode=K82P121M150SF5RM
240
241.. _DAPLink Bootloader Update:
242   https://os.mbed.com/blog/entry/DAPLink-bootloader-update/
243
244.. _OpenSDA DAPLink FRDM-K82F Firmware:
245   https://www.nxp.com/downloads/en/snippets-boot-code-headers-monitors/k20dx_frdmk82f_if_crc_legacy_0x8000.bin
246
247.. _OpenSDA J-Link Firmware for FRDM-K82F:
248   https://www.segger.com/downloads/jlink/OpenSDA_FRDM-K82F
249