Skip to content

Add analog monitor configuration file for ADC, NTC constants

Daniel Joseph Antrim requested to merge configuration_constants into main

What

This MR introduces two things:

  1. A (required) configuration file for initializing the analog monitor.
  2. Use of the Steinhart-Hart equation for calculating absolute temperature from NTC measurements.

Measurements of TP_NTC1 are now reported in degrees Celsius when using the -r (--run) and -m (--meas) command-line option to ana-mon.

Analog Monitor Card Configuration File

The configuration file will be for things like ADC constants (voltage references, calibration, etc), NTC descriptor (Steinhart coefficients, type, etc). The configuration file is required when using the analog monitor library and is now passed to the RD53BAnalogMonitor::init method.

Right now the configuration file looks like:

{
    "rd53b_scc_analog_monitor" :
    {
        "ntc" :
        {
            "ntc_part" : "ERTJ0ER103J"
            ,"r_ref" : 10000
            ,"steinhart_coeffs" : [1.3098e-3, 2.1406e-4, 9.2530e-8]
        },
        "adc" :
        {
            "vref" : 2.5
        }
    }
}

The steinhart_coeffs field is an array containing the Steinhart-Hart equation coefficients [A, B, C] (wikipedia).

This MR also adds a python script python/fit_ntc.py for obtaining the Steinhart-Hart equation coefficients from the manufacturer datasheet for a given NTC (the temperature vs resistance tables).

This MR also introduces the config/ntc_data directory for holding the NTC Temp. vs Resistance data from the datasheets used for obtaining the Steinhart-Hart equation coefficients. The idea is to keep this data local to the repository.

Usage

ana-mon

The configuration file is provided to ana-mon via the -c (--config) command-line argument:

./bin/ana-mon -c ../config/scc_anamon_config.json [OPTIONS]

Using the library

#include "RD53BAnalogMonitor.h"
...

int main()
{
    ...
    std::string analog_monitor_configuration_file = "foobar";
    RD53BAnalogMonitor anamon;
    if(anamon.init(analog_monitor_configuration_file))
    {
        std::cout << "Analog monitor card initialized successfully!" << std::endl;
    }
    else
    {
        return 1;
    }
    ...
}

# Related Issues

Relates to #2 and #3 

# VIPs
@theim @lmeng
Edited by Daniel Joseph Antrim

Merge request reports