.. _ug_nrf52: Working with nRF52 Series ######################### .. contents:: :local: :depth: 2 The |NCS| provides support for developing on all nRF52 Series devices and contains board definitions for all development kits and reference design hardware. See `Getting started with nRF Connect SDK (nRF52 Series)`_ for step-by-step instructions on how to test and develop with an nRF52 Series development kit. Introduction ************ The nRF52 Series of System-on-Chip (SoC) devices embed a powerful yet low-power Arm Cortex-M4 processor with our industry leading 2.4 GHz RF transceivers. All of the nRF52 Series SoCs have support for Bluetooth® 5 features, in addition to multiprotocol capabilities. See `nRF52 Series`_ for the technical documentation on the nRF52 Series chips and associated kits. Supported boards ================ Devices in the nRF52 Series are supported by these boards in the Zephyr open source project and in |NCS|. .. list-table:: :header-rows: 1 * - DK - PCA number - Build target - Documentation * - :ref:`zephyr:nrf52840dk_nrf52840` - PCA10056 - ``nrf52840dk_nrf52840`` - | `Product Specification `_ | `User Guide `_ * - :ref:`zephyr:nrf52840dk_nrf52811` - PCA10056 - ``nrf52840dk_nrf52811`` - `Product Specification `_ * - :ref:`zephyr:nrf52833dk_nrf52833` - PCA10100 - ``nrf52833dk_nrf52833`` - | `Product Specification `_ | `User Guide `_ * - :ref:`zephyr:nrf52833dk_nrf52820` - PCA10100 - ``nrf52833dk_nrf52820`` - `Product Specification `_ * - :ref:`zephyr:nrf52dk_nrf52832` - PCA10040 - ``nrf52dk_nrf52832`` - | `Product Specification `_ | `User Guide `_ * - :ref:`zephyr:nrf52dk_nrf52810` - PCA10040 - ``nrf52dk_nrf52810`` - `Product Specification `_ * - :ref:`zephyr:nrf52dk_nrf52805` - PCA10040 - ``nrf52dk_nrf52805`` - `Product Specification `_ * - :ref:`zephyr:nrf52840dongle_nrf52840` - PCA10059 - ``nrf52840dongle_nrf52840`` - | `Product Specification `_ | `User Guide `_ * - :ref:`zephyr:nrf21540dk_nrf52840` - PCA10112 - ``nrf21540dk_nrf52840`` - `Product Specification `_ See :ref:`ug_radio_fem_nrf21540_ek` to learn how to use this RF front-end module (FEM) with the nRF52 Series devices. nRF Desktop =========== The nRF Desktop application is a complete project that integrates Bluetooth Low Energy, see the :ref:`nrf_desktop` application. It can be built for the nRF Desktop reference hardware or an nRF52840 DK. The nRF Desktop is a reference design of a HID device that is connected to a host through Bluetooth Low Energy or USB, or both. This application supports configurations for simple mouse, gaming mouse, keyboard, and USB dongle. Secure bootloader chain ======================= nRF52 Series devices support a secure bootloader solution based on the chain of trust concept. See :ref:`ug_bootloader` for more information and instructions on how to enable one or more bootloaders in your application. Supported protocols ******************* The nRF52 Series multiprotocol radio supports Bluetooth Low Energy, proprietary (including Enhanced ShockBurst and Gazell), ANT, Thread, Zigbee, and 802.15.4. Standard interface protocols like NFC and USB are supported on a range of the devices in the series and with supporting software. .. note:: |NCS| currently has no support for ANT. The following sections give pointers on where to start when working with these protocols. To test the general capabilities of the 2.4 GHz radio transceiver, use the :ref:`radio_test` sample. Bluetooth Low Energy ==================== When you develop a Bluetooth Low Energy (LE) application, you must use the Bluetooth software stack. This stack is split into two core components: the Bluetooth Host and the Bluetooth LE Controller. The |NCS| Bluetooth stack is fully supported by Nordic Semiconductor for nRF52 Series devices. The :ref:`ug_ble_controller` user guide contains more information about the two available Bluetooth LE Controllers and instructions for switching between them. See :ref:`zephyr:bluetooth` for documentation on the Bluetooth Host and open source LE Controller. For documentation about the SoftDevice Controller and information on what variants of the controller support which chips, see :ref:`nrfxlib:softdevice_controller`. The |NCS| contains a variety of :ref:`ble_samples` that target nRF52 Series devices. In addition, you can run the :ref:`zephyr:bluetooth-samples` that are included from Zephyr. For available libraries, see :ref:`lib_bluetooth_services` (|NCS|) and :ref:`zephyr:bluetooth_api` (Zephyr). Bluetooth mesh ============== Bluetooth mesh is a mesh networking solution based on Bluetooth Low Energy, developed by the Bluetooth® Special Interest Group (SIG). It is optimized for creating large-scale device networks, and implemented according to Bluetooth Mesh Profile Specification v1.0.1 and Bluetooth Mesh Model Specification v1.0.1. Bluetooth mesh networking allows one-to-one, one-to-many, and many-to-many communication, using the Bluetooth Low Energy protocol to exchange messages between the mesh nodes in the network. The |NCS| contains a variety of :ref:`Bluetooth mesh samples ` that target nRF52 Series devices. In addition, you can run the :ref:`Bluetooth mesh samples ` that are included from Zephyr. For available libraries, see :ref:`bt_mesh` (|NCS|) and :ref:`zephyr:bluetooth_mesh` (Zephyr). See the :ref:`ug_bt_mesh` user guide for information about how to utilize the supplied libraries and work with Bluetooth mesh. Enhanced ShockBurst =================== .. include:: ../../../nrf/ug_esb.rst :start-after: esb_intro_start :end-before: esb_intro_end See the :ref:`ug_esb` user guide for information about how to work with Enhanced ShockBurst. To start developing, check out the :ref:`esb_prx_ptx` sample. Gazell ====== .. include:: ../../../nrf/ug_gz.rst :start-after: gz_intro_start :end-before: gz_intro_end See the :ref:`ug_gzll` user guide and the :ref:`ug_gzp` user guide for information about how to work with Gazell. To start developing, check out the :ref:`gazell_samples`. Matter ====== .. include:: ../../../nrf/ug_matter.rst :start-after: matter_intro_start :end-before: matter_intro_end See the :ref:`ug_matter` user guide for information about how to work with Matter applications. To start developing, check out :ref:`matter_samples`. Near Field Communication ======================== Near Field Communication (NFC) is a technology for wireless transfer of small amounts of data between two devices that are in close proximity. It makes transferring data fast and easy when devices are in close proximity. The range of NFC is typically <10 cm. |NCS| provides two protocol stacks for developing NFC applications: Type 2 Tag and Type 4 Tag. These stacks are provided in binary format in the `sdk-nrfxlib`_ repository. See :ref:`nrfxlib:nfc` for documentation about the NFC stacks, and :ref:`ug_nfc` for general information. The NFC stack requires the NFCT driver for nRF52 devices, which is available as part of `nrfx`_. The nrfx repository is included in the |NCS| as a module of the Zephyr repository. See :ref:`nfc_samples` and :ref:`lib_nfc` for lists of samples and libraries that the |NCS| provides. USB === The |NCS| contains a USB device stack for the USB 2.0 Full Speed peripheral that is available on a number of the nRF52 devices. You can find the implementation in the Zephyr repository. See :ref:`zephyr:usb_api` for documentation and :ref:`zephyr:usb-samples` for a list of available samples. The USB stack requires the USBD driver for nRF52 devices, which is available as part of `nrfx`_. The nrfx repository is included in the |NCS| as a module of the Zephyr repository. Thread ====== .. include:: ../../../nrf/ug_thread.rst :start-after: thread_intro_start :end-before: thread_intro_end See the :ref:`ug_thread` user guide for information about how to work with Thread. To start developing, check out the :ref:`openthread_samples`. Zigbee ====== .. include:: ../../../nrf/ug_zigbee.rst :start-after: zigbee_ug_intro_start :end-before: zigbee_ug_intro_end See the :ref:`Zigbee user guide ` for information about how to work with the Zigbee protocol and stack. To start developing, check out the :ref:`Zigbee light switch ` sample. Multiprotocol support ********************* The nRF52 Series devices support running another protocol in parallel with the SoftDevice Controller. See the :ref:`ug_multiprotocol_support` user guide for instructions on how to enable multiprotocol support for Thread or Zigbee in combination with Bluetooth. The :ref:`nrfxlib:mpsl` library provides services for multiprotocol applications. .. fota_upgrades_start FOTA upgrades ************* |fota_upgrades_def| FOTA upgrades can be used to replace the application. .. note:: |note| FOTA over Bluetooth LE ====================== To perform a FOTA upgrade, complete the following steps: 1. Make sure that your application supports FOTA upgrades. To download and apply FOTA upgrades, the following requirements apply: * You must enable the mcumgr module, which handles the transport protocol over Bluetooth Low Energy. To enable this module in your application, complete the following steps: a. Enable :kconfig:option:`CONFIG_MCUMGR_CMD_OS_MGMT`, :kconfig:option:`CONFIG_MCUMGR_CMD_IMG_MGMT`, and :kconfig:option:`CONFIG_MCUMGR_SMP_BT`. #. Call ``os_mgmt_register_group()`` and ``img_mgmt_register_group()`` in your application. #. Call ``smp_bt_register()`` in your application to initialize the mcumgr Bluetooth Low Energy transport. After completing these steps, your application should advertise the SMP Service with UUID 8D53DC1D-1DB7-4CD3-868B-8A527460AA84. * |fota_upgrades_req_mcuboot| #. Create a binary file that contains the new image. |fota_upgrades_building| The :file:`app_update.bin` file is the file that must be downloaded to the device. #. Download the new image to a device. .. note:: When performing FOTA upgrade on a Bluetooth mesh device and if the device's composition data is going to change after the firmware upgrade, unprovision the device before downloading the new image. Use `nRF Connect Device Manager`_, `nRF Connect for Mobile`_, or `nRF Toolbox`_ to upgrade your device with the new firmware. To do so, make sure that you can access the :file:`app_update.bin` file from your phone or tablet. Then connect to the device with the mobile app and initiate the DFU process to transfer :file:`app_update.bin` to the device. .. note:: There is currently no support for the FOTA process in nRF Connect for Desktop. FOTA upgrade sample =================== The :ref:`zephyr:smp_svr_sample` demonstrates how to set up your project to support FOTA upgrades. The sample documentation is from the Zephyr project and is incompatible with the :ref:`ug_multi_image`. When working in the |NCS| environment, you can ignore the part of the sample documentation that describes the building and programming steps. In |NCS| you can build and program the :ref:`zephyr:smp_svr_sample` as any other sample using the following commands: .. parsed-literal:: :class: highlight west build -b *build_target* -- -DOVERLAY_CONFIG=overlay-bt.conf west flash Make sure to indicate the :file:`overlay-bt.conf` overlay configuration for the Bluetooth transport like in the command example. This configuration was carefully selected to achieve the maximum possible throughput of the FOTA upgrade transport over Bluetooth with the help of the following features: * Bluetooth MTU - To increase the packet size of a single Bluetooth packet transmitted over the air (:kconfig:option:`CONFIG_BT_BUF_ACL_RX_SIZE` and others). * Bluetooth connection parameters - To adaptively change the connection interval and latency on the detection of the SMP service activity (:kconfig:option:`CONFIG_MCUMGR_SMP_BT_CONN_PARAM_CONTROL`). * MCUmgr packet reassembly - To allow exchange of large SMP packets (:kconfig:option:`CONFIG_MCUMGR_SMP_REASSEMBLY_BT`, :kconfig:option:`CONFIG_MCUMGR_BUF_SIZE` and others). Consider using these features in your project to speed up the FOTA upgrade process. .. fota_upgrades_end .. fota_upgrades_matter_start FOTA in Matter ============== To perform a FOTA upgrade when working with the Matter protocol, use one of the following methods: * DFU over Bluetooth LE using either smartphone or PC command line tool. Both options are similar to `FOTA over Bluetooth LE`_. .. note:: This protocol is not part of the Matter specification. * DFU over Matter using Matter-compliant BDX protocol and Matter OTA Provider device. This option requires an OpenThread Border Router (OTBR) set up either in Docker or on a Raspberry Pi. For more information about both methods, read the :doc:`matter:nrfconnect_examples_software_update` page in the Matter documentation. .. fota_upgrades_matter_end .. fota_upgrades_thread_start FOTA over Thread ================ :ref:`ug_thread` does not offer a proprietary FOTA method. .. fota_upgrades_thread_end .. fota_upgrades_zigbee_start FOTA over Zigbee ================ You can enable support for FOTA over the Zigbee network using the :ref:`lib_zigbee_fota` library. For detailed information about how to configure the Zigbee FOTA library for your application, see :ref:`ug_zigbee_configuring_components_ota`. .. fota_upgrades_zigbee_end Building and programming a sample ********************************* To build your application, follow the instructions in :ref:`gs_programming`. .. |note| replace:: For the possibility of introducing upgradable bootloader, please refer to :ref:`ug_bootloader_adding`.