How-To Change TrueRNGpro’s Mode
This document describes how-to change TrueRNGpro’s mode and also provides examples of the output from each mode.
MODE | CODE | DESCRIPTION |
Normal Mode | 300 | Streams from both generators combined, and whitened |
Power Supply Debug | 1200 | Diagnostic Mode, Voltage displayed in mV in ASCII |
RNG Debug | 2400 | Diagnostic Mode, outputs 0xRRR 0xRRR in ASCII |
Normal, RNG1 | 4800 | Using generator 1, whitened |
Normal, RNG2 | 9600 | Using generator 2, whitened |
RAW Binary | 19200 | ADC Values from both generators, non whitened, See document on RAW Binary format, contains ADC bias in the LSB |
RAW ASCII | 38400 | ADC Values from both generators, non whitened, in ASCII, “AAAA, BBBB\n” format, contains ADC bias in the LSB |
Changing between modes on the TrueRNGpro is accomplished by by changing the baud rate of the USB Port. We chose to do it this way so that we don’t waste precious processor cycles listening for commands. Instead we do what we call a knock sequence. We first change the baud rate 3 times in a particular sequence and then a fourth change will select the respective mode.
Note: Changing the Baud Rate has no effect on TrueRNGpro’s output speed because it’s USB.
Knock Sequence
# Linux Bash Script Excerpt stty -F /dev/TrueRNG 110 stty -F /dev/TrueRNG 300 stty -F /dev/TrueRNG 110
Mode Selection
# Linux Bash Script Excerpt stty -F /dev/TrueRNG 2400 sleep 1
MODE | OUTPUT TYPE | Sample Output |
Normal Mode | Binary | 00010111 00010111 11101000 00111101 10110111 00001000 |
In normal mode both random number generators are read by the ADC (Analog to Digital Converter). They are then combined and whitened. The data is sent over USB in binary format in 64 byte URBs (USB Request Blocks). TrueRNGpro will continuously stream bytes while DTR (Data Transmit Ready) is set and will stop sending bytes while DTR is cleared. TrueRNGpro does no buffering other than what is required for the URBs.
MODE | OUTPUT TYPE | OUTPUT FORMAT | Sample Output |
Power Supply Debug | ASCII | 1234\n | 9342 |
In power supply debug mode the voltage of the power supply used to power the random number generators is output in ASCII as mV (Millivolts) terminated by a linefeed. This voltage should always remain between 8800mV and 9800mV. The PWR LED on the TrueRNGpro provides a visual indication that the power supply is within the appropriate range (Within Range = LED ON, Outside Range = LED OFF)
MODE | OUTPUT TYPE | OUTPUT FORMAT | Sample Output |
RNG Debug | ASCII | 0xRRR 0xRRR\n | 0x1B7 0x1A6 |
RNG debug mode provides an ASCII formatted output which represents the raw data of both generators. The first hexadecimal number is from RNG1, and the second hexadecimal number is from RNG2. This string is terminated with a linefeed
MODE | OUTPUT TYPE | Sample Output |
Normal, RNG1 | Binary | 10010010 11000011 10100011 11101111 01111101 01111000 |
In normal RNG1 mode the data from RNG1 is whitened and output in binary format. The data is sent in 64 byte URBs as described in Normal Mode.
MODE | OUTPUT TYPE | Sample Output |
Normal, RNG2 | Binary | 10010010 11000011 10100011 11101111 01111101 01111000 |
In normal RNG1 mode the data from RNG2 is whitened and output in binary format. The data is sent in 64 byte URBs as described in Normal Mode.
In RAW Binary mode the stream contains a 4 byte packet (2 Bytes for RNG1 and 2 Bytes for RNG2). Each byte in the packet contains a sequence (SEQ) code to indicate which generator it belongs to and if it’s the low or high order bits in the sequence. Click the link below for format details and pseudocode.
TrueRNGpro RAW Binary Format (Documentation)
MODE | OUTPUT TYPE | OUTPUT FORMAT | Sample Output |
RNG Debug | ASCII | AAAA, BBBB\n | 0434,0537 |
RAW ASCII mode outputs a comma delimited string which contains the decimal equivalent of the 10 bit ADC reading for each generator. There is a space after the comma to pad the URB (USB Request Block). The data contains a normal amount of ADC bias mostly in the LSB (least significant bit).