1.. _nrf52840dk_nrf52840:
2
3nRF52840 DK
4###########
5
6Overview
7********
8
9The nRF52840 Development Kit (PCA10056) hardware provides support for the
10Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices:
11
12* :abbr:`ADC (Analog to Digital Converter)`
13* CLOCK
14* FLASH
15* :abbr:`GPIO (General Purpose Input Output)`
16* :abbr:`I2C (Inter-Integrated Circuit)`
17* :abbr:`MPU (Memory Protection Unit)`
18* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
19* :abbr:`PWM (Pulse Width Modulation)`
20* RADIO (Bluetooth Low Energy and 802.15.4)
21* :abbr:`RTC (nRF RTC System Clock)`
22* Segger RTT (RTT Console)
23* :abbr:`SPI (Serial Peripheral Interface)`
24* :abbr:`UART (Universal asynchronous receiver-transmitter)`
25* :abbr:`USB (Universal Serial Bus)`
26* :abbr:`WDT (Watchdog Timer)`
27
28.. figure:: img/nrf52840dk_nrf52840.jpg
29     :align: center
30     :alt: nRF52840 DK
31
32     nRF52840 DK (Credit: Nordic Semiconductor)
33
34More information about the board can be found at the `nRF52840 DK website`_.
35`nRF52840 Product Specification`_ contains the processor's information
36and the datasheet.
37
38
39Hardware
40********
41
42nRF52840 DK has two external oscillators. The frequency of the slow clock
43is 32.768 kHz. The frequency of the main clock is 32 MHz.
44
45Supported Features
46==================
47
48The ``nrf52840dk/nrf52840`` board configuration supports the following
49hardware features:
50
51+-----------+------------+----------------------+
52| Interface | Controller | Driver/Component     |
53+===========+============+======================+
54| ADC       | on-chip    | adc                  |
55+-----------+------------+----------------------+
56| CLOCK     | on-chip    | clock_control        |
57+-----------+------------+----------------------+
58| FLASH     | on-chip    | flash                |
59+-----------+------------+----------------------+
60| GPIO      | on-chip    | gpio                 |
61+-----------+------------+----------------------+
62| I2C(M)    | on-chip    | i2c                  |
63+-----------+------------+----------------------+
64| MPU       | on-chip    | arch/arm             |
65+-----------+------------+----------------------+
66| NVIC      | on-chip    | arch/arm             |
67+-----------+------------+----------------------+
68| PWM       | on-chip    | pwm                  |
69+-----------+------------+----------------------+
70| RADIO     | on-chip    | Bluetooth,           |
71|           |            | ieee802154           |
72+-----------+------------+----------------------+
73| RTC       | on-chip    | system clock         |
74+-----------+------------+----------------------+
75| RTT       | Segger     | console              |
76+-----------+------------+----------------------+
77| SPI(M/S)  | on-chip    | spi                  |
78+-----------+------------+----------------------+
79| UART      | on-chip    | serial               |
80+-----------+------------+----------------------+
81| USB       | on-chip    | usb                  |
82+-----------+------------+----------------------+
83| WDT       | on-chip    | watchdog             |
84+-----------+------------+----------------------+
85
86Other hardware features have not been enabled yet for this board.
87See `nRF52840 DK website`_ and `nRF52840 DK Hardware guide`_
88for a complete list of nRF52840 Development Kit board hardware features.
89
90Connections and IOs
91===================
92
93LED
94---
95
96* LED1 (green) = P0.13
97* LED2 (green) = P0.14
98* LED3 (green) = P0.15
99* LED4 (green) = P0.16
100
101Push buttons
102------------
103
104* BUTTON1 = SW1 = P0.11
105* BUTTON2 = SW2 = P0.12
106* BUTTON3 = SW3 = P0.24
107* BUTTON4 = SW4 = P0.25
108* BOOT = SW5 = boot/reset
109
110Programming and Debugging
111*************************
112
113Applications for the ``nrf52840dk/nrf52840`` board configuration can be
114built, flashed, and debugged in the usual way. See
115:ref:`build_an_application` and :ref:`application_run` for more details on
116building and running.
117
118Flashing
119========
120
121Follow the instructions in the :ref:`nordic_segger` page to install
122and configure all the necessary software. Further information can be
123found in :ref:`nordic_segger_flashing`. Then build and flash
124applications as usual (see :ref:`build_an_application` and
125:ref:`application_run` for more details).
126
127Here is an example for the :ref:`hello_world` application.
128
129First, run your favorite terminal program to listen for output.
130
131.. code-block:: console
132
133   $ minicom -D <tty_device> -b 115200
134
135Replace :code:`<tty_device>` with the port where the board nRF52840 DK
136can be found. For example, under Linux, :code:`/dev/ttyACM0`.
137
138Then build and flash the application in the usual way.
139
140.. zephyr-app-commands::
141   :zephyr-app: samples/hello_world
142   :board: nrf52840dk/nrf52840
143   :goals: build flash
144
145Debugging
146=========
147
148Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards with a
149Segger IC.
150
151
152Testing the LEDs and buttons in the nRF52840 DK
153***********************************************
154
155There are 2 samples that allow you to test that the buttons (switches) and LEDs on
156the board are working properly with Zephyr:
157
158.. code-block:: console
159
160   samples/basic/blinky
161   samples/basic/button
162
163You can build and flash the examples to make sure Zephyr is running correctly on
164your board. The button and LED definitions can be found in
165:zephyr_file:`boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts`.
166
167Changing UART1 pins
168*******************
169
170The following approach can be used when an application needs to use another set
171of pins for UART1:
172
1731. Add devicetree overlay file to the main directory of your application:
174
175   .. code-block:: devicetree
176
177      &pinctrl {
178         uart1_default_alt: uart1_default_alt {
179            group1 {
180               psels = <NRF_PSEL(UART_TX, 0, 14)>,
181                       <NRF_PSEL(UART_RX, 0, 16)>;
182            };
183         };
184         /* required if CONFIG_PM_DEVICE=y */
185         uart1_sleep_alt: uart1_sleep_alt {
186            group1 {
187               psels = <NRF_PSEL(UART_TX, 0, 14)>,
188                       <NRF_PSEL(UART_RX, 0, 16)>;
189               low-power-enable;
190            };
191         };
192      };
193
194      &uart1 {
195        pinctrl-0 = <&uart1_default_alt>;
196        /* if sleep state is not used, use /delete-property/ pinctrl-1; and
197         * skip the "sleep" entry.
198         */
199        pinctrl-1 = <&uart1_sleep_alt>;
200        pinctrl-names = "default", "sleep";
201      };
202
203   In the overlay file above, pin P0.16 is used for RX and P0.14 is used for TX
204
205See :ref:`set-devicetree-overlays` for further details.
206
207Selecting the pins
208==================
209
210Pins can be configured in the board pinctrl file. To see the available mappings,
211open the `nRF52840 Product Specification`_, chapter 7 'Hardware and Layout'.
212In the table 7.1.1 'aQFN73 ball assignments' select the pins marked
213'General purpose I/O'.  Note that pins marked as 'low frequency I/O only' can only be used
214in under-10KHz applications. They are not suitable for 115200 speed of UART.
215
216.. _nrf52840dk_nrf52811:
217
218nRF52811 emulation on nRF52840 DK
219#################################
220
221Overview
222********
223
224The ``nrf52840dk/nrf52811`` board variant is a modified version of the
225:ref:`nrf52840dk_nrf52840` that enforces the limitations imposed by the nRF52811
226IC, which is a variant of the original nRF52840. Since Nordic does not offer a
227development kit for the nRF52811 you can use this board to develop for this IC
228while using the nRF52840 Development Kit (PCA10056).
229
230See :ref:`nrf52840dk_nrf52840` for more information about the development board
231and `nRF52811 website`_ for the official reference on the IC itself.
232
233
234References
235**********
236
237.. target-notes::
238
239.. _nRF52811 website: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52811
240
241References
242**********
243
244.. target-notes::
245
246.. _nRF52840 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK
247.. _nRF52840 Product Specification: https://docs.nordicsemi.com/bundle/ps_nrf52840/page/keyfeatures_html5.html
248.. _nRF52840 DK Hardware guide: https://docs.nordicsemi.com/bundle/ug_nrf52840_dk/page/UG/dk/intro.html
249.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html
250.. _nRF52811 website: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52811
251