Skip to content

5.0 Supplied Unit Tests

HailStorm32 edited this page May 6, 2025 · 4 revisions

5.0 Supplied Unit Tests

Two tests are provided to test SCuM and demonstrate the capabilities of the Observatory. The following is an in depth explanation of these tests and how they function. For instructions on running the tests, see Section 6.0 Utilizing The Observatory

The following unit tests are located in Code/Verification


5.1 SCuM Validation

scum_validation.py The validation script evaluates critical functionalities of the SCuM chip through a series of tests designed to comprehensively cover GPIO operations, serial communication, RF transmission and reception, on-chip clocks (both high-frequency (HF) and low-frequency (LF)), and internal voltage reference (Vref) levels. Detailed descriptions of each test category are provided in the sub sections below.

In order to test specific features of SCuM, a custom companion binary exists and is loaded onto SCuM ( C source and .bin are available in the Code/Validation/C-Source directory). This program is in charge of sending out pulses over GPIO to start each test, as well as actively participate in the active tests.

The validation process begins by executing a self-test of the RF measurement equipment. Following successful verification, the custom SCuM binary is flashed onto the SCuM chip. The script then proceeds through an array of predefined tests. Prior to initiating each individual test, the script waits for a synchronization pulse from the SCuM chip, signaling readiness for the upcoming test.

Each test generates a structured result output (detailed in section 4.3), which is temporarily stored until all tests have concluded. After the completion of the entire test suite, these collected results are compiled into a formatted HTML report, as described in section 4.3.2.

The structure defining the sequence of tests is presented below. Additional tests can be easily integrated into the validation process by inserting new entries to this structure.

NOTE: any added test will need to go after Radio Self Test and before Power Consumption and be listed as False for independent. A test marked at independent will not be ran in the loop and is expected to be ran manually outside the loop.

test structure
tests = {
    'Program upload':         { 'function': scum_program,            'independent': True},
    'Radio Self Test':        { 'function': RF_SCuM_test,            'independent': True},
    'Radio communication':    { 'function': stub_function_call,      'independent': False},
    'Digital input/output':   { 'function': run_logic_analysis,      'independent': False}, 
    'Analog validation':      { 'function': validate_analog_signals, 'independent': False}, 
    'Serial communication':   { 'function': find_best_baud_rate,     'independent': False}, 
    'Power Consumption':      { 'function': stop_joulescope,         'independent': True}, 
}

5.1.1 Analog

Tests/analog_test.py The analog test verifies the performance of SCuM’s analog subsystems. It begins by using the Analog Discovery 2 (AD2) oscilloscope to measure the internal reference voltages, confirming that the 1.1V and 1.8V rails fall within their expected values. The test then proceeds to validate the high-frequency (HF) and low-frequency (LF) on-chip clock outputs using the AD2’s measurement capabilities, ensuring that both oscillators operate within the desired ppm of their nominal frequencies.

5.1.2 Digital

Tests/digital_test.py The digital test is used to test the functionality of GPIO ports of SCuM. The GPIO ports are validated with a pulse-based procedure using a Digilent Digital Discovery logic analyzer. When the test begins, SCuM emits a pulse on each digital I/O pin while the logic analyzer records activity over a fixed time window. A pin is deemed functional if its output remains at a high logic level for the specified duration, confirming correct output behavior and signal integrity.

5.1.3 RF

Tests/RF_tx_rx_tests.py RF testing within the observatory is comprised of two separate tests. The first test validates the expected functionality of both the transmitting and receiving Adalm-Pluto SDRs and reports the efficacy of the devices by verifying a predetermined control signal was both accurately transmitted and received. The second test continuously monitors the radio signals generated by SCuM, saves the raw data in a locally stored .csv file, and generates a final PSD plot of the received signal.

5.1.4 Serial

Tests/serial_baud_test.py In this test, a host computer transmits a character to the SCuM chip via an SH-U09C5 USB-to-TTL UART converter across a sweep of standard baud rates. For each rate, if the SCuM correctly echoes the received character, that baud rate is marked as compatible. This procedure enables identification of the subset of baud rates reliably supported by a specific SCuM instance.

5.1.5 Power Consumption

Tests/power_test.py At the start and throughout the execution of the validation script, the Joulescope monitors the power consumption of the entire system. The script follows a two-step process that requires two function calls. The first function initializes the Joulescope and begins monitoring. The second function stops the monitoring and collects the results. While running, the Joulescope continuously records data to a .csv file. When the second function is called, the script parses the .csv to extract the results and then deletes the file.

5.2 Nightly Validation

nightly_validation.py The nightly validation script is designed to demonstrate a method for conducting repeated tests of SCuM firmware autonomously, without requiring user involvement.

The user is required to supply a list of paths to binaries within a Git repository. Currently, the functionality is limited to checking a single repository; however, it includes support for binaries distributed across multiple branches within the same repository.

Binary test structure
GIT_BINARY_PATHS = [
    { 'path': "path/to/binary1", 'branch': "branch_name", 'lastHash': None }, #Leave 'lastHash' as None, for internal use
    { 'path': "path/to/binary2", 'branch': "branch_name2", 'lastHash': None }, #Leave 'lastHash' as None, for internal use
]
Test Structure

As with scum_validation.py, this test also uses the test structure mentioned here. Tests added here will be ran on each binary.

On each scheduled run, the script queries the provided repository and checks each of the provided binaires. If it detects a change for the given binary, it does the following:

  1. Fetches the updated binary
  2. Loads it onto the SCuM chip
  3. Performs the analog validation test (more tests can be added as needed)

Finally, it aggregates all test results into a report and emails it to the user(s).

5.2.1 Analog

See section 5.1.1

Clone this wiki locally