![]() |
SatNOGS-COMMS
4.1.0
A COMMS subsystem for CubeSats
|
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. | |
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:
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.
|
strong |
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.
|
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.
Definition at line 191 of file emc1702.hpp.
|
strong |
Settings to set the threshold for consecutive current out-of-limit measurements in the Current Sense Sampling Configuration Register.
Definition at line 161 of file emc1702.hpp.
|
strong |
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.
Definition at line 129 of file emc1702.hpp.
|
strong |
Settings to set the threshold for consecutive voltage out-of-limit measurements in the Voltage Sampling Configuration Register.
Definition at line 145 of file emc1702.hpp.
|
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.
Definition at line 108 of file emc1702.hpp.
|
strong |
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.
| 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.
|
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.
Definition at line 228 of file emc1702.hpp.
|
strong |
Settings to set the Current Sense maximum expected voltage (full scale range) in the Current Sense Sampling Configuration Register.
Definition at line 280 of file emc1702.hpp.
|
strong |
Settings to set the peak detector minimum time threshold in the Peak Detection Configuration Register.
Definition at line 317 of file emc1702.hpp.
|
strong |
Settings to set the peak detector threshold level in the Peak Detection Configuration Register.
Definition at line 293 of file emc1702.hpp.
|
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.
| 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.
The sensor is fully initialized upon construction, ensuring it is ready for operation.
| name | The name assigned to the sensor (since multiple sensors can be used). |
| i2c | The I2C interface used to communicate with the sensor. |
| addr | The I2C address of the sensor. |
| alert | A reference to the GPIO pin used for the ALERT signal. |
Definition at line 135 of file emc1702.cpp.
| satnogs::comms::lib::emc1702::emc1702 | ( | const char * | name, |
| bsp::i2c & | i2c, | ||
| uint16_t | addr ) |
Constructs an EMC1702 sensor object without the ALERT GPIO pin.
| name | The name assigned to the sensor (since multiple sensors can be used). |
| i2c | The I2C interface used to communicate with the sensor. |
| addr | The I2C address of the sensor. |
Definition at line 198 of file emc1702.cpp.
| bool satnogs::comms::lib::emc1702::alert | ( | ) | const |
Definition at line 1069 of file emc1702.cpp.
| float satnogs::comms::lib::emc1702::get_power | ( | ) | const |
Definition at line 942 of file emc1702.cpp.
| float satnogs::comms::lib::emc1702::get_sense_current | ( | ) | const |
Retrieves current measurement from the EMC1702 sensor.
Definition at line 905 of file emc1702.cpp.
| float satnogs::comms::lib::emc1702::get_source_voltage | ( | ) | const |
Retrieves source voltage measurement from the EMC1702 sensor.
Definition at line 928 of file emc1702.cpp.
| void satnogs::comms::lib::emc1702::get_status | ( | status & | s | ) |
Definition at line 328 of file emc1702.cpp.
| float satnogs::comms::lib::emc1702::get_temperature_average | ( | ) | const |
Retrieves temperature from the EMC1702 sensor by averaging the internal and external diode measurements.
Definition at line 278 of file emc1702.cpp.
| void satnogs::comms::lib::emc1702::set_config | ( | sensor_mode | m | ) | const |
Definition at line 353 of file emc1702.cpp.
|
staticconstexpr |
Full Scale Voltage in volts.
Definition at line 69 of file emc1702.hpp.
|
staticconstexpr |
External sense resistor value in Ohms.
Definition at line 74 of file emc1702.hpp.