Skip to content

MicroRNG Software Kit for Raspberry PI 3+ or other Linux-based single-board computers

License

Notifications You must be signed in to change notification settings

tectrolabs/microrng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MicroRNG Software Kit

MicroRNG is a hardware (true) random number generator device that can be used in embedded systems as a reliable entropy source. It can interface with microcontrollers or microprocessors (mainboards) with integrated circuits and modules through a mikroBUS™ socket using SPI or 2-wire UART interfaces. It can generate random numbers at a rate up to 1 Mbps in SPI mode and up to 1.5 Mbps in UART mode.

This repository contains the MicroRNG Software Kit and utilities for using the MicroRNG device with Raspberry Pi 3+ or other Linux-based single-board computers via an SPI interface.

Contents

  • MicroRngSPI.cpp - API source code in C++ for communicating with a MicroRNG device over an SPI interface.
  • mcdiag.cpp - general purpose diagnostics utility that interacts with the MicroRNG device for determining the maximum clock speed and for validating the communication over an SPI interface.
  • mcrng.cpp - utility for downloading random bytes generated by MicroRNG device over an SPI interface.
  • sample.cpp - sample C++ program that demonstrates how to use the API for communicating with the MicroRNG device over an SPI interface.

Getting Started

To build and run the MicroRNG utilities you will need sudo access permissions on your Linux instance.

Dependencies

The following dependencies are required to successfully build utilities:

  • C++ compiler
  • git
  • make

The C++ compiler can be installed on Ubuntu with the following command:

sudo apt-get install g++

The git development dependency can be installed on Ubuntu with the following command:

sudo apt-get install git

The make development dependency can be installed on Ubuntu with the following command:

sudo apt-get install make

Installing

  • Download the project:
git clone https://github.com/tectrolabs/microrng.git
  • Build the utilities:
cd microrng/mcrng
make 
  • Install the necessary executables:
sudo make install

Verify communication with the MicroRNG

  • Connect MicroRNG device to the target board through the provided SPI interface.
  • Verify device connectivity with the following command (you may need to use a target board specific device path):
sudo mcdiag /dev/spidev0.0
  • You may get an output similar to the following:
~/microrng/mcrng$ sudo mcdiag /dev/spidev0.0 
-------------------------------------------------------------------
--- TectroLabs - mcdiag - MicroRNG diagnostics utility Ver 1.0  ---
--- Use with RPI 3+ or other Linux-based single-board computers ---
-------------------------------------------------------------------
Opening device /dev/spidev0.0 ----------------------------- Success
Identifying device /dev/spidev0.0 --------------  MicroRNG detected
Identifying maximum SPI clock frequency --------------- 31000000 Hz
New SPI clock frequency ------------------------------- 31000000 Hz
Retrieving 32000 random bytes ----------------------------- Success
Retrieving 32000 RAW random bytes ------------------------- Success
Retrieving 32000 random bytes ----------------------------- Success
Shutting down RNG ----------------------------------------- Success
Starting RNG up ------------------------------------------- Success
Computing SPI transfer speed ----------------------------  497 kbps
Validating MicroRNG internal status  ---------------------- Healthy

Authors

Andrian Belinski