1.. _nrf9160dk_nrf9160: 2 3nRF9160 DK 4########## 5 6Overview 7******** 8 9The nRF9160 DK (PCA10090) is a single-board development kit for evaluation and 10development on the nRF9160 SiP for LTE-M and NB-IoT. The nrf9160dk/nrf9160 11board configuration provides support for the Nordic Semiconductor nRF9160 ARM 12Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: 13 14* :abbr:`ADC (Analog to Digital Converter)` 15* CLOCK 16* FLASH 17* :abbr:`GPIO (General Purpose Input Output)` 18* :abbr:`I2C (Inter-Integrated Circuit)` 19* :abbr:`MPU (Memory Protection Unit)` 20* :abbr:`NVIC (Nested Vectored Interrupt Controller)` 21* :abbr:`PWM (Pulse Width Modulation)` 22* :abbr:`RTC (nRF RTC System Clock)` 23* Segger RTT (RTT Console) 24* :abbr:`SPI (Serial Peripheral Interface)` 25* :abbr:`UARTE (Universal asynchronous receiver-transmitter with EasyDMA)` 26* :abbr:`WDT (Watchdog Timer)` 27* :abbr:`IDAU (Implementation Defined Attribution Unit)` 28 29.. figure:: img/nrf9160dk_nrf9160.jpg 30 :align: center 31 :alt: nRF9160 DK 32 33 nRF9160 DK (Credit: Nordic Semiconductor) 34 35More information about the board can be found at the 36`nRF9160 DK website`_. `nRF9160 Product Specification`_ 37contains the processor's information and the datasheet. 38 39 40Hardware 41******** 42 43nRF9160 DK has two external oscillators. The frequency of 44the slow clock is 32.768 kHz. The frequency of the main clock 45is 32 MHz. 46 47Supported Features 48================== 49 50The nrf9160dk/nrf9160 board configuration supports the following 51hardware features: 52 53+-----------+------------+----------------------+ 54| Interface | Controller | Driver/Component | 55+===========+============+======================+ 56| ADC | on-chip | adc | 57+-----------+------------+----------------------+ 58| CLOCK | on-chip | clock_control | 59+-----------+------------+----------------------+ 60| FLASH | on-chip | flash | 61+-----------+------------+----------------------+ 62| GPIO | on-chip | gpio | 63+-----------+------------+----------------------+ 64| I2C(M) | on-chip | i2c | 65+-----------+------------+----------------------+ 66| MPU | on-chip | arch/arm | 67+-----------+------------+----------------------+ 68| NVIC | on-chip | arch/arm | 69+-----------+------------+----------------------+ 70| PWM | on-chip | pwm | 71+-----------+------------+----------------------+ 72| RTC | on-chip | system clock | 73+-----------+------------+----------------------+ 74| RTT | Segger | console | 75+-----------+------------+----------------------+ 76| SPI(M/S) | on-chip | spi | 77+-----------+------------+----------------------+ 78| SPU | on-chip | system protection | 79+-----------+------------+----------------------+ 80| UARTE | on-chip | serial | 81+-----------+------------+----------------------+ 82| WDT | on-chip | watchdog | 83+-----------+------------+----------------------+ 84 85.. _nrf9160dk_additional_hardware: 86 87Additional hardware in v0.14.0+ 88------------------------------- 89 90Starting from v0.14.0, additional hardware is available on the DK: 91 92* External flash memory (MX25R6435F, 64 Mb) 93* I/O expander (PCAL6408A) that can be used to interface LEDs, slide switches, 94 and buttons 95 96To use this additional hardware, specify the revision of the board that 97should be used when building your application (for more information, see 98:ref:`application_board_version`). For example, to build for nRF9160 DK v1.0.0: 99 100.. zephyr-app-commands:: 101 :tool: all 102 :cd-into: 103 :board: nrf9160dk/nrf9160@1.0.0 104 :goals: build 105 :compact: 106 107Remember to also enable routing for this additional hardware in the firmware for 108:ref:`nrf9160dk_nrf52840` (see :ref:`nrf9160dk_board_controller_firmware`). 109 110Other hardware features have not been enabled yet for this board. 111See `nRF9160 DK website`_ and `nRF9160 Product Specification`_ 112for a complete list of nRF9160 DK board hardware features. 113 114Connections and IOs 115=================== 116 117LED 118--- 119 120* LED1 (green) = P0.2 121* LED2 (green) = P0.3 122* LED3 (green) = P0.4 123* LED4 (green) = P0.5 124 125Push buttons and Switches 126------------------------- 127 128* BUTTON1 = P0.6 129* BUTTON2 = P0.7 130* SWITCH1 = P0.8 131* SWITCH2 = P0.9 132* BOOT = SW5 = boot/reset 133 134Security components 135=================== 136 137- Implementation Defined Attribution Unit (`IDAU`_). The IDAU is implemented 138 with the System Protection Unit and is used to define secure and non-secure 139 memory maps. By default, all of the memory space (Flash, SRAM, and 140 peripheral address space) is defined to be secure accessible only. 141- Secure boot. 142 143 144Programming and Debugging 145************************* 146 147nrf9160dk/nrf9160 supports the Armv8m Security Extension, and by default boots 148in the Secure state. 149 150Building Secure/Non-Secure Zephyr applications with Arm |reg| TrustZone |reg| 151============================================================================= 152 153Applications on the nRF9160 may contain a Secure and a Non-Secure firmware 154image. The Secure image can be built using either Zephyr or 155`Trusted Firmware M`_ (TF-M). Non-Secure firmware images are always built 156using Zephyr. The two alternatives are described below. 157 158.. note:: 159 160 By default the Secure image for nRF9160 is built using TF-M. 161 162Building the Secure firmware using Zephyr 163----------------------------------------- 164 165The process requires the following steps: 166 1671. Build the Secure Zephyr application using ``-DBOARD=nrf9160dk/nrf9160`` and 168 ``CONFIG_TRUSTED_EXECUTION_SECURE=y`` in the application project configuration file. 1692. Build the Non-Secure Zephyr application using ``-DBOARD=nrf9160dk/nrf9160/ns``. 1703. Merge the two binaries together. 171 172Building the Secure firmware with TF-M 173-------------------------------------- 174 175The process to build the Secure firmware image using TF-M and the Non-Secure 176firmware image using Zephyr requires the following action: 177 1781. Build the Non-Secure Zephyr application 179 using ``-DBOARD=nrf9160dk_nrf9160_ns``. 180 To invoke the building of TF-M the Zephyr build system requires the 181 Kconfig option ``BUILD_WITH_TFM`` to be enabled, which is done by 182 default when building Zephyr as a Non-Secure application. 183 The Zephyr build system will perform the following steps automatically: 184 185 * Build the Non-Secure firmware image as a regular Zephyr application 186 * Build a TF-M (secure) firmware image 187 * Merge the output binaries together 188 * Optionally build a bootloader image (MCUboot) 189 190.. note:: 191 192 Depending on the TF-M configuration, an application DTS overlay may be 193 required, to adjust the Non-Secure image Flash and SRAM starting address 194 and sizes. 195 196When building a Secure/Non-Secure application, the Secure application will 197have to set the IDAU (SPU) configuration to allow Non-Secure access to all 198CPU resources utilized by the Non-Secure application firmware. SPU 199configuration shall take place before jumping to the Non-Secure application. 200 201Building a Secure only application 202================================== 203 204Build the Zephyr app in the usual way (see :ref:`build_an_application` 205and :ref:`application_run`), using ``-DBOARD=nrf9160dk/nrf9160``. 206 207 208Flashing 209======== 210 211Follow the instructions in the :ref:`nordic_segger` page to install 212and configure all the necessary software. Further information can be 213found in :ref:`nordic_segger_flashing`. Then build and flash 214applications as usual (see :ref:`build_an_application` and 215:ref:`application_run` for more details). 216 217Here is an example for the :zephyr:code-sample:`hello_world` application. 218 219First, run your favorite terminal program to listen for output. 220 221.. code-block:: console 222 223 $ minicom -D <tty_device> -b 115200 224 225Replace :code:`<tty_device>` with the port where the nRF9160 DK 226can be found. For example, under Linux, :code:`/dev/ttyACM0`. 227 228Then build and flash the application in the usual way. 229 230.. zephyr-app-commands:: 231 :zephyr-app: samples/hello_world 232 :board: nrf9160dk/nrf9160 233 :goals: build flash 234 235Debugging 236========= 237 238Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards with a 239Segger IC. 240 241 242Testing the LEDs and buttons in the nRF9160 DK 243********************************************** 244 245There are 2 samples that allow you to test that the buttons (switches) and LEDs on 246the board are working properly with Zephyr: 247 248* :zephyr:code-sample:`blinky` 249* :zephyr:code-sample:`button` 250 251You can build and flash the examples to make sure Zephyr is running correctly on 252your board. The button and LED definitions can be found in 253:zephyr_file:`boards/nordic/nrf9160dk/nrf9160dk_nrf9160_common.dtsi`. 254 255.. _nrf9160dk_nrf52840: 256 257nRF9160 DK - nRF52840 258##################### 259 260Overview 261******** 262 263The nRF52840 SoC on the nRF9160 DK (PCA10090) hardware provides support for the 264Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices: 265 266* CLOCK 267* FLASH 268* :abbr:`GPIO (General Purpose Input Output)` 269* :abbr:`MPU (Memory Protection Unit)` 270* :abbr:`NVIC (Nested Vectored Interrupt Controller)` 271* :abbr:`PWM (Pulse Width Modulation)` 272* RADIO (Bluetooth Low Energy and 802.15.4) 273* :abbr:`RTC (nRF RTC System Clock)` 274* Segger RTT (RTT Console) 275* :abbr:`UART (Universal asynchronous receiver-transmitter)` 276* :abbr:`WDT (Watchdog Timer)` 277 278The nRF52840 SoC does not have any connection to the any of the LEDs, 279buttons, switches, and Arduino pin headers on the nRF9160 DK board. It is, 280however, possible to route some of the pins of the nRF52840 SoC to the nRF9160 281SiP. 282 283More information about the board can be found at 284the `Nordic Low power cellular IoT`_ website. 285`nRF52840 Product Specification`_ 286contains the processor's information and the datasheet. 287 288 289Hardware 290******** 291 292The nRF9160 DK has two external oscillators. The frequency of 293the slow clock is 32.768 kHz. The frequency of the main clock 294is 32 MHz. 295 296Supported Features 297================== 298 299The nrf9160dk/nrf52840 board configuration supports the following 300hardware features: 301 302+-----------+------------+----------------------+ 303| Interface | Controller | Driver/Component | 304+===========+============+======================+ 305| CLOCK | on-chip | clock_control | 306+-----------+------------+----------------------+ 307| FLASH | on-chip | flash | 308+-----------+------------+----------------------+ 309| GPIO | on-chip | gpio | 310+-----------+------------+----------------------+ 311| MPU | on-chip | arch/arm | 312+-----------+------------+----------------------+ 313| NVIC | on-chip | arch/arm | 314+-----------+------------+----------------------+ 315| PWM | on-chip | pwm | 316+-----------+------------+----------------------+ 317| RADIO | on-chip | Bluetooth, | 318| | | ieee802154 | 319+-----------+------------+----------------------+ 320| RTC | on-chip | system clock | 321+-----------+------------+----------------------+ 322| RTT | Segger | console | 323+-----------+------------+----------------------+ 324| UART | on-chip | serial | 325+-----------+------------+----------------------+ 326| WDT | on-chip | watchdog | 327+-----------+------------+----------------------+ 328 329Programming and Debugging 330************************* 331 332Applications for the ``nrf9160dk/nrf52840`` board configuration can be 333built and flashed in the usual way (see :ref:`build_an_application` 334and :ref:`application_run` for more details). 335 336Make sure that the PROG/DEBUG switch on the DK is set to nRF52. 337 338Flashing 339======== 340 341Follow the instructions in the :ref:`nordic_segger` page to install 342and configure all the necessary software. Further information can be 343found in :ref:`nordic_segger_flashing`. Then build and flash 344applications as usual (see :ref:`build_an_application` and 345:ref:`application_run` for more details). 346 347Remember to set the PROG/DEBUG switch on the DK to nRF52. 348 349See the following example for the :zephyr:code-sample:`hello_world` application. 350 351First, run your favorite terminal program to listen for output. 352 353.. code-block:: console 354 355 $ minicom -D <tty_device> -b 115200 356 357Replace :code:`<tty_device>` with the port where the nRF52840 SoC is connected 358to. Usually, under Linux it will be ``/dev/ttyACM1``. The ``/dev/ttyACM0`` 359port is connected to the nRF9160 SiP on the board. 360 361Then build and flash the application in the usual way. 362 363.. zephyr-app-commands:: 364 :zephyr-app: samples/hello_world 365 :board: nrf9160dk/nrf52840 366 :goals: build flash 367 368Debugging 369========= 370 371Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards 372with a Segger IC. 373 374Remember to set the PROG/DEBUG switch on the DK to nRF52. 375 376.. _nrf9160dk_board_controller_firmware: 377 378Board controller firmware 379************************* 380 381The board controller firmware is a small snippet of code that takes care of 382routing specific pins of the nRF9160 SiP to different components on the DK, 383such as LEDs and buttons, UART interfaces (VCOMx) of the interface MCU, and 384specific nRF52840 SoC pins. 385 386.. note:: 387 In nRF9160 DK revisions earlier than v0.14.0, nRF9160 signals routed to 388 other components on the DK are not simultaneously available on the DK 389 connectors. 390 391When compiling a project for nrf9160dk/nrf52840, the board controller firmware 392will be compiled and run automatically after the Kernel has been initialized. 393 394By default, the board controller firmware will route the following: 395 396+--------------------------------+----------------------------------+ 397| nRF9160 pins | Routed to | 398+================================+==================================+ 399| P0.26, P0.27, P0.28, and P0.29 | VCOM0 | 400+--------------------------------+----------------------------------+ 401| P0.01, P0.00, P0.15, and P0.14 | VCOM2 | 402+--------------------------------+----------------------------------+ 403| P0.02 | LED1 | 404+--------------------------------+----------------------------------+ 405| P0.03 | LED2 | 406+--------------------------------+----------------------------------+ 407| P0.04 | LED3 | 408+--------------------------------+----------------------------------+ 409| P0.05 | LED4 | 410+--------------------------------+----------------------------------+ 411| P0.08 | Switch 1 | 412+--------------------------------+----------------------------------+ 413| P0.09 | Switch 2 | 414+--------------------------------+----------------------------------+ 415| P0.06 | Button 1 | 416+--------------------------------+----------------------------------+ 417| P0.07 | Button 2 | 418+--------------------------------+----------------------------------+ 419| P0.17, P0.18, and P0.19 | Arduino pin headers | 420+--------------------------------+----------------------------------+ 421| P0.21, P0.22, and P0.23 | Trace interface | 422+--------------------------------+----------------------------------+ 423| COEX0, COEX1, and COEX2 | COEX interface | 424+--------------------------------+----------------------------------+ 425 426For a complete list of all the routing options available, 427see the `nRF9160 DK board control section in the nRF9160 DK User Guide`_. 428 429If you want to route some of the above pins differently or enable any of the 430other available routing options, enable or disable the devicetree node that 431represents the analog switch that provides the given routing. 432 433The following devicetree nodes are defined for the analog switches present 434on the nRF9160 DK: 435 436+------------------------------------+------------------------------+ 437| Devicetree node label | Analog switch name | 438+====================================+==============================+ 439| ``vcom0_pins_routing`` | nRF91_UART1 (nRF91_APP1) | 440+------------------------------------+------------------------------+ 441| ``vcom2_pins_routing`` | nRF91_UART2 (nRF91_APP2) | 442+------------------------------------+------------------------------+ 443| ``led1_pin_routing`` | nRF91_LED1 | 444+------------------------------------+------------------------------+ 445| ``led2_pin_routing`` | nRF91_LED2 | 446+------------------------------------+------------------------------+ 447| ``led3_pin_routing`` | nRF91_LED3 | 448+------------------------------------+------------------------------+ 449| ``led4_pin_routing`` | nRF91_LED4 | 450+------------------------------------+------------------------------+ 451| ``switch1_pin_routing`` | nRF91_SWITCH1 | 452+------------------------------------+------------------------------+ 453| ``switch2_pin_routing`` | nRF91_SWITCH2 | 454+------------------------------------+------------------------------+ 455| ``button1_pin_routing`` | nRF91_BUTTON1 | 456+------------------------------------+------------------------------+ 457| ``button2_pin_routing`` | nRF91_BUTTON2 | 458+------------------------------------+------------------------------+ 459| ``nrf_interface_pins_0_2_routing`` | nRF_IF0-2_CTRL (nRF91_GPIO) | 460+------------------------------------+------------------------------+ 461| ``nrf_interface_pins_3_5_routing`` | nRF_IF3-5_CTRL (nRF91_TRACE) | 462+------------------------------------+------------------------------+ 463| ``nrf_interface_pins_6_8_routing`` | nRF_IF6-8_CTRL (nRF91_COEX) | 464+------------------------------------+------------------------------+ 465 466When building for the DK revision 0.14.0 or later, you can use the following 467additional nodes (see :ref:`application_board_version` for information how to 468build for specific revisions of the board): 469 470+------------------------------------+------------------------------+ 471| Devicetree node label | Analog switch name | 472+====================================+==============================+ 473| ``nrf_interface_pin_9_routing`` | nRF_IF9_CTRL | 474+------------------------------------+------------------------------+ 475| ``io_expander_pins_routing`` | IO_EXP_EN | 476+------------------------------------+------------------------------+ 477| ``external_flash_pins_routing`` | EXT_MEM_CTRL | 478+------------------------------------+------------------------------+ 479 480For example, if you want to enable the optional routing for the nRF9160 pins 481P0.17, P0.18, and P0.19 so that they are routed to nRF52840 pins P0.17, P0.20, 482and P0.15, respectively, add the following in the devicetree overlay in your 483application: 484 485.. code-block:: devicetree 486 487 &nrf_interface_pins_0_2_routing { 488 status = "okay"; 489 }; 490 491And if you want to, for example, disable routing for the VCOM2 pins, add the 492following: 493 494.. code-block:: devicetree 495 496 &vcom2_pins_routing { 497 status = "disabled"; 498 }; 499 500A few helper .dtsi files are provided in the directories 501:zephyr_file:`boards/nordic/nrf9160dk/dts/nrf52840` and 502:zephyr_file:`boards/nordic/nrf9160dk/dts/nrf9160`. They can serve as examples of 503how to configure and use the above routings. You can also include them from 504respective devicetree overlay files in your applications to conveniently 505configure the signal routing between nRF9160 and nRF52840 on the nRF9160 DK. 506For example, to use ``uart1`` on both these chips for communication between 507them, add the following line in the overlays for applications on both sides, nRF52840: 508 509.. code-block:: devicetree 510 511 #include <nrf52840/nrf9160dk_uart1_on_if0_3.dtsi> 512 513nRF9160: 514 515.. code-block:: devicetree 516 517 #include <nrf9160/nrf9160dk_uart1_on_if0_3.dtsi> 518 519References 520********** 521 522.. target-notes:: 523 524.. _IDAU: 525 https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau 526.. _nRF9160 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK 527.. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ 528.. _Nordic Low power cellular IoT: https://www.nordicsemi.com/Products/Low-power-cellular-IoT 529.. _nRF9160 Product Specification: https://docs.nordicsemi.com/bundle/ps_nrf9160/page/nRF9160_html5_keyfeatures.html 530.. _nRF52840 Product Specification: https://docs.nordicsemi.com/bundle/ps_nrf52840/page/keyfeatures_html5.html 531.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html 532.. _nRF9160 DK board control section in the nRF9160 DK User Guide: https://docs.nordicsemi.com/bundle/ug_nrf9160_dk/page/UG/nrf91_DK/hw_description/nrf9160_board_controller.html 533