The idea for the TRNG sending code is very simple:

  1. Get TRNG data from Trust M
  2. Send TRNG data over USB CDC serial
  3. Repeat

There is currently only an Arduino library available for talking to the Trust M, so we'll do everything using Arduino.

The complete Arduino sketch code is provided later in this guide to allow customizing. Here we provide some pre-compiled examples in UF2 format. With these UF2 files, you can just drag-and-drop to the Trinkey QT2040 RPI-RP2 bootloader folder. The Arduino IDE does not even need to be installed.

Installing UF2 Examples

To install the UF2 files:

  1. Put the Trinkey QT2040 in bootloader mode by holding the BOOT button while pressing the RST (reset) button.
  2. A folder named RPI-RP2 should appear.
  3. Drag the UF2 file to the RPI-RP2 folder.
  4. Once copied, board should reset and code is now running.

Send Raw Bytes

This example sends a continuous stream of raw bytes. This behaves much like dumping /dev/random on a linux machine. Here's the UF2:

With that running on the Trinkey QT2040, the serial output will look like this (screen was used to connect):

It's raw bytes, so will look like gibberish.

Want something more human readable? OK, let's try some formatted string output next.

Send CSV Formatted Text

This example provides comma separated (CSV) formatted text. Here's the UF2:

With that running on the Trinkey QT2040, the serial output will look like this:

Send JSON Formatted Text

This example provides JavaScript Object Notation (JSON) formatted text. Here's the UF2:

With that running on the Trinkey QT2040, the serial output will look like this:

This guide was first published on Dec 09, 2021. It was last updated on Dec 09, 2021.

This page (Sending TRNG) was last updated on Dec 11, 2021.

Text editor powered by tinymce.