Please note that this blogpost is now deprecated as the nRF52820 is fully supported in nRF5 SDK v17.0.0. We recommend using SDK v17.0.0 for nRF52820 fimware development.
Introduction
The nRF52820 IC is a subset of the nRF52833 with smaller RAM and flash, and with less peripheral resources. Therefore, you can use nRF52833 to emulate the functionality of nRF52820.
This blog post will show you how to emulate the nRF52820 on the nRF52833 Development Kit.
Detailed information on the SoC can be found in the nRF52820 Product Specification and a detailed comparison of the features of the various nRF52 Series chips can be seen in the nRF52 Series comparison table on the Nordic Infocenter.
Hardware emulation of nRF52820 on the nRF52833 DK
You can fully emulate nRF52820 features using a nRF52833 Development Kit (PCA10100), there are however, some differences that developers should be aware of when transferring emulated projects to nRF52820 hardware.
The bit length for some of the digital serial interface features differs for both chips. This means that the emulated project lets you use 16 bits, but in order to successfully function on nRF52820, the following features cannot exceed 15 bits in your application.
It is also important to note that the nRF52833 has higher number of GPIO pins compared to the nRF52820.
The nRF52833 DK uses the nRF52833 aQFN73 and some of the buttons are tied to GPIOs that are not available on the nRF52820 QFN40 package.
When running an emulated nRF52820 example on the nRF52833 DK you will still be able to use the buttons and LEDs, but when transferring the emulated project to nRF52820 hardware you will need to remap any button and LED pin to available GPIOs on the nRF52820 QFN 40 package, see table below.
Software emulation of nRF52820
All examples that are hardware compatible can be set up to emulate nRF52820 on nRF52833. Hardware compatibility means that a project uses only the resources present in nRF52820, including peripherals and memory. Note that the nRF52820 does not have cache and hardware floating point support. Its also important to note that the nRF52820 has reduced flash and RAM size, hence not all nRF52833 DK examples may fit on the nRF52820.
See the the nRF52 Series comparison table on the Nordic Infocenter for a full overview of which peripherals that are present on the nRF52820 compared to the nRF52833.
The following SoftDevices are supported on the nRF52820
this is also listed in the SDKs and SoftDevices Compatibility Matrix for the nRF52820.
Differences between the the v8.0.0 and v7.0.1 SoftDevice APIs
The S122 is a size-optimized central only BLE SoftDevice for the nRF52820. The S122 API is a compatible subset of the S132 SoftDevice API, hence for features that are common to S122 and S132, the API is the same.
The changes in the API of the S122 v8.0.0-10.alpha compared to the S132 v7.0.1 is as follows:
Installing the nRF MDK and nRF Command-Line Tools
In order to start development on the nRF52820 you need to download the nRF MDK (Microcontroller Development Kit) and the nRF Command-Line Tools that supports the nRF52820.
The nRF MDK provides device support in the form of register header files and startup code for the different toolchains/IDEs supported in the nRF5 SDK and the nRF Command-Line Tools allows you to program the nRF52820 through SEGGER J-Link programmers and debuggers.
The nRF Command-Line Tools version that supports the nRF52820 is v10.7.0 and later, which can be downloaded from https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download
The nRF MDK version that supports the nRF52820 is v8.32.1 and later, which can be downloaded from https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-MDK/Download#infotabs.
Note: You should select the MDK with the 5-clause Nordic License.
Setting up the MDK varies depending on the IDE/Toolchain used. IDE/toolchain specific instructions are given below.
Segger Embedded Studio
GCC
Keil
Patching nRF5 SDK v16.0.0 to support the nRF52820
In addition to updating the nRF MDK you will also have to patch and add some files in the nRF5 SDK v16.0.0 source code to add support for the nRF52820.
The following files in the nRF5 SDK v16.0.0 needs to be patched or added to support the nRF52820:
In order to add support for the S122 v8.0.0-10.alpha you will also have to patch the following files:
Lastly, a minor modification to the MDK is needed to allow all buttons and leds on the nRF52833 DK to be used when emulating the nRF52820
The patched and added files are available in this zip: 6646.sdk_v16_0_0_nrf52820_patch.zip
Creating an emulated project for the nRF52820 on the NRF52833 DK
NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 and DEVELOP_IN_NRF52833 to the preprocessor definitions.
DEVELOP_IN_NRF52833
SystemInit
NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3
nrf_delay_us
_startup_nrf52833.s
system_nrf52833.c
_startup_nrf52820.s
system_nrf52820.c
GCC and Makefiles
DDEVELOP_IN_NRF52833
DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3ASMFLAGS += -DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3
Change
Transferring an emulated project to nRF52820 hardware
If you have developed your application using the emulated project as a starting point, there are only two steps you need to perform before you can run it natively on nRF52820:
NRFX_COREDEP_DELAY_US_LOOP_CYCLES
Emulated nRF52820 (PCA10100e) Project examples
Below you will find some of the BLE examples from SDK v16.0.0 where a pca10100e project has been added with support for Keil 5, Segger Embedded Studio.
Peripheral UART/Serial Port Emulation over BLE (ble_app_uart)
Central UART/Serial Port Emulation over BLE (ble_app_uart_c)
lubo: Yes, the nRF5 SDK release is on-track and will be released in June. It will have full support for the nRF52820.
Hello,
I have a question regarding next SDK release. On product description page of NRF52820 you say: "...while full nRF5 SDK support is coming in Q2 2020."
Do you still expect it to be released at the end of june? Or it will be delayed? We are currently in design stage of the project, and we'd like to use this chip in it. And we want full support without doing any hacks like this.
Thanks for your answer.
why project doesn't use nrf.h in the pack, use \modules\nrfx\mdk\nrf.h instead, how to correct this?
I am using Keil for this central project, I got an error: "..\..\..\..\..\..\modules\nrfx\mdk\nrf.h(144): error: #35: #error directive: "Device must be defined. See nrf.h."", seams that this nrf.h don't support 52820, even more, there is no 52820 in this .h file
Hi Bruno, the Flash and RAM requirements for different Mesh configurations are listed under Resource usage in the nRF5 SDK for Mesh v4.1.0 documentation. Remember that the nRF52820 also supports the S112( 100kB), so if you cant fit the all the Mesh features alongside the S140 ( 156kB).