What is the difference between SDK and Softdevice? How can we select SDK and Softdevice versions? Do the SoC, SDK, and Softdevice have version compatibility problems? How can we understand the SDK directory structure? Where is the SDK documentation? Where is the Softdevice user manual? How can we select an SDK example to start our Bluetooth LE development journey? This article will cover the above topics.
Nordic currently has two fully independent SDK: nRF5 SDK and nRF Connect SDK. In general, nRF5 SDK is recommended for developing nRF51/52 products and nRF Connect SDK is recommended for developing new products such as nRF91/nRF53. This article will introduce the nRF5 SDK. Strictly speaking, nRF5 SDK is a product zip file. Different versions have different product packs, which are shown below.
Apart from this basic nRF5 SDK, Nordic has also launched some customized nRF5 SDK for some vertical applications. These SDKs and the basic nRF5 SDK use the same software architecture, the same driver and library, and the same coding style. For developers, if they are familiar with the nRF5 SDK, they can also work with these customized SDKs quickly. Nordic offers the following types of tailored SDKs:
If your application is one of the six vertical applications above, it is recommended that you pick one of the customized SDKs, otherwise, the basic nRF5 SDK shall always be selected. This article would only cover the contents of the basic nRF5 SDK. It would not involve the other customized SDKs.
Example interpretation is shown below
S130, which denotes nRF51 Bluetooth LE protocol stack supporting both central and peripheral roles.
S112, which denotes nRF52 Bluetooth LE protocol stack only supporting slave role.
S132, which denotes nRF52 Bluetooth LE protocol stack supporting both central and peripheral roles.
S212, which denotes nRF52 ANT protocol stack
S332, which denotes nRF52 combined Bluetooth LE and ANT protocol stack and supports both BLE master and slave roles.
When you download SDK in the Nordic official website, it will automatically bind the native softdevice or a higher version if possible. If a higher version is recommended in this case, please use this higher version instead of the native version. Take SDK15.2.0 as an instance, the native version is 6.1.0 and the recommended version is 6.1.1. Use 6.1.1 instead in this case.
Note: sometimes there are some minor bugs in the softdevice. At this time, Nordic would release the bug-fixed softdevice separately. For example, the version of the S140 softdevice included in nRF5 SDK v15.2.0 is 6.1.0. Generally, it is fine to directly use this version of softdevice, but there is a small bug in the central role of this version of softdevice. Therefore, Nordic has released version 6.1.1 separately. Users need to download this version of softdevice separately from the official website.
The compatibility table exists since the latest SDK serves the latest chip. And the latest SDK assume that some bugs of the earlier revisions have been fixed. Thus the latest SDK will not contain the workarounds (or patches) for the old chip revisions, which may result in some problems if you run the latest SDK on the old revisions.
Taking SDK16.0.0 as an example, the directory structure of nRF5 SDK is as follows:
-components. This directory contains the SDK source code developed by Nordic. You’d better not modify any files in this directory during product development! This rule also applies to the driver source code. The components directory structure is as follows:
-modules. Nordic has 2 different sets of chip peripheral drivers. SDK14 and previous versions of SDK use nrf_drv legacy peripheral drivers. And SDK15/16 uses nrfx new peripheral drivers (nrfx drivers are used in both nRF5 SDK and nRF Connect SDK). In SDK15/16, nrfx driver source code is listed in the following directory:
SDK14 or earlier versions have the driver source codes in the following place:
-examples. This directory has rich application examples, including Bluetooth LE application examples, peripheral application examples, and DFU bootloader examples. In general, you can find the example you require in most cases. The examples directory structure is shown below.
The two frequently used directories are: \ble_peripheral and \peripheral. The \ble_peripheral directory contains many Bluetooth LE slave role examples, while \peripheral contains examples on how to use peripherals. The \ble_peripheral directory structure is as follows:
The \peripheral directory structure is shown below. Many developers asked, “where I can get the documentation of SoC peripheral driver APIs” Because they need to follow the documents to develop applications. In Nordic, we not only provide the documentation but also the examples. We recommend reading the example code directly, which is more efficient.
Deprecated and experimental directories are often seen in nRF5 SDK. Their meanings are shown below.
\deprecated. The contents of this directory have been discarded and a new version will replace them.In order to be compatible with the old products, SDK still retains them. For example, components\drivers_nrf\twi_master\deprecated. If you are a new user, please don’t use the API in the \deprecated directory.
\experimental. Some new features/new examples have not been tested on a large scale in the market since they have only been launched for a short time. In this case, Nordic will prefix these new features/new examples with "experimental", for example: examples\ble_peripheral\experimental\ble_app_cli. There might be bugs in it. The user is expected to perform enough tests to guarantee the product quality. In other words, if it passes all the test cases, use it freely and confidently.
Taking SDK16.0.0 online helping document as an example, its main interface is as follows. Expand the directories on the left panel and you will find that the documentation directory level corresponds to the SDK directory level one by one.
Therefore, if you have any questions about SDK, you can directly check the description of the corresponding online or offline documentation. For example, if you want to know what’s the purpose of this example: <Install folder>\examples\peripheral\spi , you can directly find the corresponding entry of the help document here. After reading the document, you will understand that this is an example showing how to use SPI master.
Nordic nRF5 SDK has rich application examples. You can start your development from one of these examples. All examples are found in the <InstallFolder>\examples directory. Its online documentation can be accessed here.
For example, <InstallFolder>\examples\ble_peripheral\ble_app_uart, the description of this example can be found here. By viewing the description, we know that this example uses Bluetooth as a pass-through communication media or emulate Bluetooth as an UART. If your application is just like this Bluetooth UART communication, you can start your development from this example.
By viewing all related examples, I believe you can find the right examples shortly. Now you can start your Bluetooth LE development journey from the chosen examples.