SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
satnogs::comms::lib::emc1702 Class Reference

Interface for the EMC1702 High-Side Current-Sense and Dual Temperature Monitor. More...

#include <emc1702.hpp>

Classes

struct  status
 Status register flags. More...

Public Types

enum class  sensor_mode : uint8_t { FULLY_ACTIVE = 0b00100000 , CURRENT_ONLY = 0b01100000 , TEMPERATURE_ONLY = 0b00100100 , STANDBY = 0b01100100 }
 Selects the mode of operation of the EMC1702 sensor. More...
enum class  conversion_rate : uint8_t {
  PER_1_SEC_8_MEAS = 0b00000111 , PER_1_SEC_4_MEAS = 0b00000110 , PER_1_SEC_2_MEAS = 0b00000101 , PER_1_SEC_1_MEAS = 0b00000100 ,
  PER_2_SEC_1_MEAS = 0b00000011 , PER_4_SEC_1_MEAS = 0b00000010 , PER_8_SEC_1_MEAS = 0b00000001 , PER_16_SEC_1_MEAS = 0b00000000
}
 Settings to set the frequency of measurements in the Conversion Rate Register. More...
enum class  consecutive_alert_diode_fault : uint8_t { OUT_OF_LIM_MEAS_1 , OUT_OF_LIM_MEAS_2 , OUT_OF_LIM_MEAS_3 , OUT_OF_LIM_MEAS_4 }
 Settings to set the threshold for consecutive diode fault alerts in the Consecutive Alert Register. More...
enum class  consecutive_alert_voltage : uint8_t { OUT_OF_LIM_MEAS_1 , OUT_OF_LIM_MEAS_2 , OUT_OF_LIM_MEAS_3 , OUT_OF_LIM_MEAS_4 }
 Settings to set the threshold for consecutive voltage out-of-limit measurements in the Voltage Sampling Configuration Register. More...
enum class  consecutive_alert_current : uint8_t { OUT_OF_LIM_MEAS_1 , OUT_OF_LIM_MEAS_2 , OUT_OF_LIM_MEAS_3 , OUT_OF_LIM_MEAS_4 }
 Settings to set the threshold for consecutive current out-of-limit measurements in the Current Sense Sampling Configuration Register. More...
enum class  beta_config : uint8_t {
  MIN_BETA_0_050 = 0b00000000 , MIN_BETA_0_066 = 0b00000001 , MIN_BETA_0_087 = 0b00000010 , MIN_BETA_0_114 = 0b00000011 ,
  MIN_BETA_0_150 = 0b00000100 , MIN_BETA_0_197 = 0b00000101 , MIN_BETA_0_260 = 0b00000110 , MIN_BETA_0_342 = 0b00000111 ,
  MIN_BETA_0_449 = 0b00001000 , MIN_BETA_0_591 = 0b00001001 , MIN_BETA_0_778 = 0b00001010 , MIN_BETA_1_024 = 0b00001011 ,
  MIN_BETA_1_348 = 0b00001100 , MIN_BETA_1_773 = 0b00001101 , MIN_BETA_2_333 = 0b00001110 , DISABLED = 0b00001111 ,
  AUTO = 0b00010000
}
 Settings to set the Beta Compensation factor in the Beta Configuration Registers. More...
enum class  ideality_factor : uint8_t {
  IDEALITY_FACTOR_1_0053 = 0b00010000 , IDEALITY_FACTOR_1_0066 = 0b00010001 , IDEALITY_FACTOR_1_0080 = 0b00010010 , IDEALITY_FACTOR_1_0093 = 0b00010011 ,
  IDEALITY_FACTOR_1_0106 = 0b00010100 , IDEALITY_FACTOR_1_0119 = 0b00010101 , IDEALITY_FACTOR_1_0133 = 0b00010110 , IDEALITY_FACTOR_1_0146 = 0b00010111
}
 Settings to set the Ideality Factor in the External Diode Ideality Factor Registers. More...
enum class  averaging_control : uint8_t { DISABLED = 0b00000000 , AVERAGING2X = 0b00000001 , AVERAGING4X = 0b00000010 , AVERAGING8X = 0b00000011 }
 Settings to set the digital averaging on mesurements in the Averaging Control Register, the Voltage Sampling Configuration Register, or the Current Sense Sampling Configuration Register. More...
enum class  current_sampling_time : uint8_t { S_T_82_MS = 0b00000000 , S_T_164_MS = 0b00001000 , S_T_328_MS = 0b00001100 }
 Settings to set the Current Sensing Sampling Time in the Current Sense Sampling Configuration Register. More...
enum class  max_expected_voltage : uint8_t { CURRENT_SENSOR_RANGE_10_mV = 0b00000000 , CURRENT_SENSOR_RANGE_20_mV = 0b00000001 , CURRENT_SENSOR_RANGE_40_mV = 0b00000010 , CURRENT_SENSOR_RANGE_80_mV }
 Settings to set the Current Sense maximum expected voltage (full scale range) in the Current Sense Sampling Configuration Register. More...
enum class  peak_detection_threshold : uint8_t {
  THRESHOLD_10_mV = 0b00000000 , THRESHOLD_15_mV = 0b00010000 , THRESHOLD_20_mV = 0b00100000 , THRESHOLD_25_mV = 0b00110000 ,
  THRESHOLD_30_mV = 0b01000000 , THRESHOLD_35_mV = 0b01010000 , THRESHOLD_40_mV = 0b01100000 , THRESHOLD_45_mV = 0b01110000 ,
  THRESHOLD_50_mV = 0b10000000 , THRESHOLD_55_mV = 0b10010000 , THRESHOLD_60_mV = 0b10100000 , THRESHOLD_65_mV = 0b10110000 ,
  THRESHOLD_70_mV = 0b11000000 , THRESHOLD_75_mV = 0b11010000 , THRESHOLD_80_mV = 0b11100000 , THRESHOLD_85_mV = 0b11110000
}
 Settings to set the peak detector threshold level in the Peak Detection Configuration Register. More...
enum class  peak_detection_duration : uint8_t {
  DURATION_1_00_ms = 0b00000000 , DURATION_5_12_ms = 0b00000001 , DURATION_25_60_ms = 0b00000010 , DURATION_51_20_ms = 0b00000011 ,
  DURATION_76_80_ms = 0b00000100 , DURATION_102_40_ms = 0b00000101 , DURATION_128_00_ms = 0b00000110 , DURATION_256_00_ms = 0b00000111 ,
  DURATION_384_00_ms = 0b00001000 , DURATION_512_00_ms = 0b00001001 , DURATION_768_00_ms = 0b00001010 , DURATION_1024_00_ms = 0b00001011 ,
  DURATION_1536_00_ms = 0b00001100 , DURATION_2048_00_ms = 0b00001101 , DURATION_3072_00_ms = 0b00001110 , DURATION_4096_00_ms = 0b00001111
}
 Settings to set the peak detector minimum time threshold in the Peak Detection Configuration Register. More...

Public Member Functions

 emc1702 (const char *name, bsp::i2c &i2c, uint16_t addr, bsp::gpio &alert)
 Constructs an EMC1702 sensor object with an ALERT GPIO pin.
 emc1702 (const char *name, bsp::i2c &i2c, uint16_t addr)
 Constructs an EMC1702 sensor object without the ALERT GPIO pin.
void get_status (status &s)
void set_config (sensor_mode m) const
float get_sense_current () const
 Retrieves current measurement from the EMC1702 sensor.
float get_source_voltage () const
 Retrieves source voltage measurement from the EMC1702 sensor.
float get_power () const
bool alert () const
float get_temperature_average () const
 Retrieves temperature from the EMC1702 sensor by averaging the internal and external diode measurements.

Static Public Attributes

static constexpr float fsv = 23.9883
 Full Scale Voltage in volts.
static constexpr float r_sense = 0.01
 External sense resistor value in Ohms.

Detailed Description

Interface for the EMC1702 High-Side Current-Sense and Dual Temperature Monitor.

The emc1702 class provides methods to configure and retrieve data from the EMC1702 I2C sensor, enabling precise monitoring and control of current, voltage, and temperature.

Features:

  1. Temperature Monitoring:
    • Monitoring of the temperature of one externally connected diode.
    • Monitoring of the internal or ambient temperature
    • Configurable temperature limits for high, low, and critical thresholds.
  2. Voltage Monitoring:
    • High-side voltage sensing with configurable limits.
    • Critical voltage thresholds with hysteresis control.
  3. Current Monitoring:
    • High-side current sensing using an external resistor.
    • Bi-directional current measurement with configurable sampling and averaging.
  4. Peak Detection:
    • Independent circuitry for current peak detection with programmable duration and thresholds.

For detailed specifications, refer to the EMC1702 Datasheet: https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/EMC1702-Data-Sheet-DS20006455A.pdf

Definition at line 63 of file emc1702.hpp.

Member Enumeration Documentation

◆ averaging_control

Settings to set the digital averaging on mesurements in the Averaging Control Register, the Voltage Sampling Configuration Register, or the Current Sense Sampling Configuration Register.

The averaging control determines how many measurements are averaged to produce a single temperature, source voltage, or current reading.

Enumerator
DISABLED 

Averaging is disabled; raw readings are used.

AVERAGING2X 

2x averaging

AVERAGING4X 

4x averaging

AVERAGING8X 

8x averaging

Definition at line 250 of file emc1702.hpp.

◆ beta_config

enum class satnogs::comms::lib::emc1702::beta_config : uint8_t
strong

Settings to set the Beta Compensation factor in the Beta Configuration Registers.

The Beta Compensation factor is used for the external diode channels to optimize temperature measurements. This enum provides predefined settings to configure the Beta Compensation factor directly or enable autodetection circuitry for automatic optimization.

Note
Care should be taken to avoid setting a Beta value higher than the transistor's beta when autodetection is disabled, as it may introduce measurement errors.
When measuring a discrete thermal diode (such as 2N3904) or a CPU diode that functions like a discrete thermal diode (such as an AMD processor diode), the Beta Compensation should be set to DISABLED
Enumerator
MIN_BETA_0_050 

Beta Compensation factor = 0.050

MIN_BETA_0_066 

Beta Compensation factor = 0.066

MIN_BETA_0_087 

Beta Compensation factor = 0.087

MIN_BETA_0_114 

Beta Compensation factor = 0.114

MIN_BETA_0_150 

Beta Compensation factor = 0.150

MIN_BETA_0_197 

Beta Compensation factor = 0.197

MIN_BETA_0_260 

Beta Compensation factor = 0.260

MIN_BETA_0_342 

Beta Compensation factor = 0.342

MIN_BETA_0_449 

Beta Compensation factor = 0.449

MIN_BETA_0_591 

Beta Compensation factor = 0.591

MIN_BETA_0_778 

Beta Compensation factor = 0.778

MIN_BETA_1_024 

Beta Compensation factor = 1.024

MIN_BETA_1_348 

Beta Compensation factor = 1.348

MIN_BETA_1_773 

Beta Compensation factor = 1.773

MIN_BETA_2_333 

Beta Compensation factor = 2.333

DISABLED 

Disable Beta Compensation for discrete thermal diodes.

AUTO 

Enable automatic Beta Compensation autodetection.

Definition at line 191 of file emc1702.hpp.

◆ consecutive_alert_current

Settings to set the threshold for consecutive current out-of-limit measurements in the Current Sense Sampling Configuration Register.

Enumerator
OUT_OF_LIM_MEAS_1 

Trigger after 1 out-of-limit measurement

OUT_OF_LIM_MEAS_2 

Trigger after 2 out-of-limit measurements

OUT_OF_LIM_MEAS_3 

Trigger after 3 out-of-limit measurements

OUT_OF_LIM_MEAS_4 

Trigger after 4 out-of-limit measurements

Definition at line 161 of file emc1702.hpp.

◆ consecutive_alert_diode_fault

Settings to set the threshold for consecutive diode fault alerts in the Consecutive Alert Register.

The Consecutive Alert Register determines how many times an out-of-limit error or diode fault must be detected in consecutive measurements before the interrupt status registers are asserted. This applies to temperature limits only.

Enumerator
OUT_OF_LIM_MEAS_1 

Trigger after 1 out-of-limit measurement

OUT_OF_LIM_MEAS_2 

Trigger after 2 out-of-limit measurements

OUT_OF_LIM_MEAS_3 

Trigger after 3 out-of-limit measurements

OUT_OF_LIM_MEAS_4 

Trigger after 4 out-of-limit measurements

Definition at line 129 of file emc1702.hpp.

◆ consecutive_alert_voltage

Settings to set the threshold for consecutive voltage out-of-limit measurements in the Voltage Sampling Configuration Register.

Enumerator
OUT_OF_LIM_MEAS_1 

Trigger after 1 out-of-limit measurement

OUT_OF_LIM_MEAS_2 

Trigger after 2 out-of-limit measurements

OUT_OF_LIM_MEAS_3 

Trigger after 3 out-of-limit measurements

OUT_OF_LIM_MEAS_4 

Trigger after 4 out-of-limit measurements

Definition at line 145 of file emc1702.hpp.

◆ conversion_rate

enum class satnogs::comms::lib::emc1702::conversion_rate : uint8_t
strong

Settings to set the frequency of measurements in the Conversion Rate Register.

The Conversion Rate Register controls how often the source voltage and temperature measurement channels are updated and compared against the limits.

Enumerator
PER_1_SEC_8_MEAS 

8 measurements per second

PER_1_SEC_4_MEAS 

4 measurements per second

PER_1_SEC_2_MEAS 

2 measurements per second

PER_1_SEC_1_MEAS 

1 measurement per second

PER_2_SEC_1_MEAS 

1 measurement every 2 seconds

PER_4_SEC_1_MEAS 

1 measurement every 4 seconds

PER_8_SEC_1_MEAS 

1 measurement every 8 seconds

PER_16_SEC_1_MEAS 

1 measurement every 16 seconds

Definition at line 108 of file emc1702.hpp.

◆ current_sampling_time

Settings to set the Current Sensing Sampling Time in the Current Sense Sampling Configuration Register.

The current sensing sampling time determines the integration period over which the current is averaged. The sampled VSENSE voltage reflects the average current over this period multiplied by the selected averaging factor.

Note
Longer sampling times improve resolution, but reduce responce time.
Enumerator
S_T_82_MS 

Sampling time = 82 ms (default)

S_T_164_MS 

Sampling time = 164 ms

S_T_328_MS 

Sampling time = 328 ms

Definition at line 269 of file emc1702.hpp.

◆ ideality_factor

enum class satnogs::comms::lib::emc1702::ideality_factor : uint8_t
strong

Settings to set the Ideality Factor in the External Diode Ideality Factor Registers.

The Ideality Factor Registers store the ideality factors that are applied to the external diodes and influence temperature measurements.

Note
Beta Compensation and Resistance Error Correction automatically correct for most diode ideality errors; therefore, it is not recommended that these settings be updated without consulting Microchip.
Recommended Settings: Intel CPUs (65nm): Use the default setting IDEALITY_FACTOR_1_0080 (12h). Intel CPUs (45nm): Use IDEALITY_FACTOR_1_0119 (15h).
Enumerator
IDEALITY_FACTOR_1_0053 

Ideality factor = 1.0053 (10h)

IDEALITY_FACTOR_1_0066 

Ideality factor = 1.0066 (11h)

IDEALITY_FACTOR_1_0080 

Ideality factor = 1.0080 (12h), default for 65nm Intel CPUs

IDEALITY_FACTOR_1_0093 

Ideality factor = 1.0093 (13h)

IDEALITY_FACTOR_1_0106 

Ideality factor = 1.0106 (14h)

IDEALITY_FACTOR_1_0119 

Ideality factor = 1.0119 (15h), recommended for 45nm Intel CPUs

IDEALITY_FACTOR_1_0133 

Ideality factor = 1.0133 (16h)

IDEALITY_FACTOR_1_0146 

Ideality factor = 1.0146 (17h)

Definition at line 228 of file emc1702.hpp.

◆ max_expected_voltage

Settings to set the Current Sense maximum expected voltage (full scale range) in the Current Sense Sampling Configuration Register.

Enumerator
CURRENT_SENSOR_RANGE_10_mV 

Maximum voltage = 10 mV

CURRENT_SENSOR_RANGE_20_mV 

Maximum voltage = 20 mV

CURRENT_SENSOR_RANGE_40_mV 

Maximum voltage = 40 mV

CURRENT_SENSOR_RANGE_80_mV 

Maximum voltage = 80 mV (default)

Definition at line 280 of file emc1702.hpp.

◆ peak_detection_duration

Settings to set the peak detector minimum time threshold in the Peak Detection Configuration Register.

Enumerator
DURATION_1_00_ms 

Duration = 1.00 ms

DURATION_5_12_ms 

Duration = 5.12 ms

DURATION_25_60_ms 

Duration = 25.60 ms

DURATION_51_20_ms 

Duration = 51.20 ms

DURATION_76_80_ms 

Duration = 76.80 ms

DURATION_102_40_ms 

Duration = 102.40 ms

DURATION_128_00_ms 

Duration = 128.00 ms

DURATION_256_00_ms 

Duration = 256.00 ms

DURATION_384_00_ms 

Duration = 384.00 ms

DURATION_512_00_ms 

Duration = 512.00 ms

DURATION_768_00_ms 

Duration = 768.00 ms

DURATION_1024_00_ms 

Duration = 1024.00 ms

DURATION_1536_00_ms 

Duration = 1536.00 ms

DURATION_2048_00_ms 

Duration = 2048.00 ms

DURATION_3072_00_ms 

Duration = 3072.00 ms

DURATION_4096_00_ms 

Duration = 4096.00 ms

Definition at line 317 of file emc1702.hpp.

◆ peak_detection_threshold

Settings to set the peak detector threshold level in the Peak Detection Configuration Register.

Enumerator
THRESHOLD_10_mV 

Threshold = 10 mV

THRESHOLD_15_mV 

Threshold = 15 mV

THRESHOLD_20_mV 

Threshold = 20 mV

THRESHOLD_25_mV 

Threshold = 25 mV

THRESHOLD_30_mV 

Threshold = 30 mV

THRESHOLD_35_mV 

Threshold = 35 mV

THRESHOLD_40_mV 

Threshold = 40 mV

THRESHOLD_45_mV 

Threshold = 45 mV

THRESHOLD_50_mV 

Threshold = 50 mV

THRESHOLD_55_mV 

Threshold = 55 mV

THRESHOLD_60_mV 

Threshold = 60 mV

THRESHOLD_65_mV 

Threshold = 65 mV

THRESHOLD_70_mV 

Threshold = 70 mV

THRESHOLD_75_mV 

Threshold = 75 mV

THRESHOLD_80_mV 

Threshold = 80 mV

THRESHOLD_85_mV 

Threshold = 85 mV

Definition at line 293 of file emc1702.hpp.

◆ sensor_mode

enum class satnogs::comms::lib::emc1702::sensor_mode : uint8_t
strong

Selects the mode of operation of the EMC1702 sensor.

Enumerator
FULLY_ACTIVE 

Fully active mode

CURRENT_ONLY 

Current measurement only

TEMPERATURE_ONLY 

Temperature measurement only

STANDBY 

Standby mode

Definition at line 92 of file emc1702.hpp.

Constructor & Destructor Documentation

◆ emc1702() [1/2]

satnogs::comms::lib::emc1702::emc1702 ( const char * name,
bsp::i2c & i2c,
uint16_t addr,
bsp::gpio & alert )

Constructs an EMC1702 sensor object with an ALERT GPIO pin.

Initializes the EMC1702 sensor with the specified name, I2C interface, address, and ALERT GPIO pin. This constructor configures the sensor with default settings for temperature, voltage, current monitoring, and peak detection.

  1. Default Configurations:
    • Sensor Mode: Fully active.
    • Conversion Rate: 8 measurements per second.
    • Averaging: Disabled.
    • Temperature Limits: Default limits set via configuration.
    • Consecutive Alert Thresholds: Maximum 4 consecutive out-of-limit measurements.
    • Beta Configuration: Automatic.
    • Ideality Factor: 1.0080.
    • Current Sampling Maximum Expected Voltage Range: 10 mV
    • Current Sampling Time: Default (82 ms).
    • Peak Detection: 35 mV threshold and 5.12 ms duration.
    1. Default Limit values:
      1. Temperature:
        • Internal and external high limit: 85.0°C.
        • Internal and external low limit: -128.0°C.
        • Critical temperature: 100.0°C(for internal and external diodes).
        • Critical hysteresis: 10.0°C.
      2. Current:
        1. Sense voltage limits:
          • Low limit: -2033.0 mV.
          • High limit: 2032.0 mV.
          • Critical limit: 2032.0 mV.
          • Critical hysteresis: 160.0 mV.
      3. Voltage:
        1. Source voltage limits:
          • Low limit: 0.0 V.
          • High limit: 23.9063 V.
          • Critical limit: 23.9063 V.
          • Critical hysteresis: 0.9375 V.

The sensor is fully initialized upon construction, ensuring it is ready for operation.

Parameters
nameThe name assigned to the sensor (since multiple sensors can be used).
i2cThe I2C interface used to communicate with the sensor.
addrThe I2C address of the sensor.
alertA reference to the GPIO pin used for the ALERT signal.

Definition at line 135 of file emc1702.cpp.

◆ emc1702() [2/2]

satnogs::comms::lib::emc1702::emc1702 ( const char * name,
bsp::i2c & i2c,
uint16_t addr )

Constructs an EMC1702 sensor object without the ALERT GPIO pin.

Parameters
nameThe name assigned to the sensor (since multiple sensors can be used).
i2cThe I2C interface used to communicate with the sensor.
addrThe I2C address of the sensor.

Definition at line 198 of file emc1702.cpp.

Member Function Documentation

◆ alert()

bool satnogs::comms::lib::emc1702::alert ( ) const

Definition at line 1069 of file emc1702.cpp.

◆ get_power()

float satnogs::comms::lib::emc1702::get_power ( ) const

Definition at line 942 of file emc1702.cpp.

◆ get_sense_current()

float satnogs::comms::lib::emc1702::get_sense_current ( ) const

Retrieves current measurement from the EMC1702 sensor.

Returns
float Current measurement in Amps

Definition at line 905 of file emc1702.cpp.

◆ get_source_voltage()

float satnogs::comms::lib::emc1702::get_source_voltage ( ) const

Retrieves source voltage measurement from the EMC1702 sensor.

Returns
float Source voltage measurement in Volts

Definition at line 928 of file emc1702.cpp.

◆ get_status()

void satnogs::comms::lib::emc1702::get_status ( status & s)

Definition at line 328 of file emc1702.cpp.

◆ get_temperature_average()

float satnogs::comms::lib::emc1702::get_temperature_average ( ) const

Retrieves temperature from the EMC1702 sensor by averaging the internal and external diode measurements.

Returns
float Average internal and external temperature in °C

Definition at line 278 of file emc1702.cpp.

◆ set_config()

void satnogs::comms::lib::emc1702::set_config ( sensor_mode m) const

Definition at line 353 of file emc1702.cpp.

Member Data Documentation

◆ fsv

float satnogs::comms::lib::emc1702::fsv = 23.9883
staticconstexpr

Full Scale Voltage in volts.

Definition at line 69 of file emc1702.hpp.

◆ r_sense

float satnogs::comms::lib::emc1702::r_sense = 0.01
staticconstexpr

External sense resistor value in Ohms.

Definition at line 74 of file emc1702.hpp.


The documentation for this class was generated from the following files: