ArduinoPrimoThe Arduino Primo is a quite new board which was introduced by and delivers a wide range for sensor networks, IoT applications and prototyping.

It features three microcontrollers:

The nRF52832 is used as the main CPU for program execution, it includes BLE and NFC hardware for communication. WiFi is managed by the ESP8266 CPU, which can be used with the provided libraries. The STM32f103 is used as a service microcontroller and is therefore responsible for flashing the executable onto the previous named CPUs and allows extended debugging. Additionally it features a connected infrared receiver and transmitter. Beside the obvious possibilities of peripheral interconnections the nRF52832 offers more benefit for wireless sensor networks and security related applications. It has an integrated hardware Random Number Generator (RNG) whose output is suitable for cryptographic tasks. A hardware implementation of the Advanced Encryption Standard in Electronic Code Book working mode (AES-ECB) and AES-CCM is also available. Real-time applications will benefit from the integrated Real-Time-Counter.

The Arduino IDE supports the Arduino Primo by downloading the board packages via the board manager. Libraries and samples will automatically be installed.

Some functionality is not yet supported by the "arduinoic" software interface, such as using the on-chip random number generator (NRG), AES cryptography, Real-Time-Counter, etc. This is not an issue at all because Nordic Semiconductor offer extensive documentation and samples.

I recommend to have a look at the following material:

The documentation is also offline available and the SDK features lots of examples which can easily be ported to the Arduino Primo and can be compiled from the Arduino IDE.

Random number generation is often an issue on bare-metal systems, because of a missing entropy source. This is why the ARM Cortex-M series CPUs often have a RNG integrated in their SoC. This is also the case for the Arduino Primo, which has an integrated RNG on its nRF52832. Additional benefit of this particular RNG is, that it can be used in cryptographic applications. The hardware RNG inside the nRF52832 uses internal thermal noise to generate true non-deterministic random numbers.

The Arduino-Libraries do not yet support the internal hardware RNG but the nRF5 SDK offers a code sample. There are no unresolved dependencies because all the underlying libraries, which are required by the nRF52832 are installed with the arduino-board-package.

The original file can be found inside the SDK folder: nRF5_SDK_14.0.0_3bcc1f7/examples/peripheral/rng/main.c

[code start:1lang:cpp]/* Using the nRF52832 on-chip RNG
* by Johannes Kinzig
* adapted from nRF5_SDK_14.0.0_3bcc1f7/examples/peripheral/rng/main.c by Nordic Semiconductor ASA
* 2017 - 09 - 19
* Arduino Primo only

// tell the linker to watch out for C files
#ifdef __cplusplus
extern "C"{
#include "nrf_drv_rng.h"

#define RANDOM_BUFF_SIZE 16 /**< Random numbers buffer size. */

uint32_t err_code;
uint8_t available;

static uint8_t random_vector_generate(uint8_t * p_buff, uint8_t size)
uint8_t length = MIN(size, available);

err_code = nrf_drv_rng_rand(p_buff, length);

return length;

void setup() {
// put your setup code here, to run once:


void loop() {

err_code = nrf_drv_rng_init(NULL);

uint8_t p_buff[RANDOM_BUFF_SIZE];
uint8_t length = random_vector_generate(p_buff,sizeof(p_buff));
Serial.print("Random Vector: ");
for(int i=0;i<sizeof(p_buff);i=i+1) {
Serial.print(" Length: ");