TLE92466ED Driver 2.0.0
API reference
Loading...
Searching...
No Matches
Functions | Variables
tle92466ed::FB_I_AVG_s16 Namespace Reference

FB_I_AVG_s16 decoder (calibration only — see the warning below). More...

Functions

constexpr int32_t SignExtend17 (uint32_t raw17) noexcept
 Sign-extend the 17-bit signed field.
 
constexpr bool IsSettlingFrame (uint32_t reply_22bit) noexcept
 True when the frame is the pre-measurement placeholder.
 
constexpr int32_t ToMilliamps (uint32_t reply_22bit) noexcept
 Decode signed 17-bit raw to milliamps.
 
constexpr uint8_t ExtractTimestamp (uint32_t reply_22bit) noexcept
 Extract the 2-bit rolling timestamp.
 

Variables

constexpr uint32_t I_AVG_MASK = 0x0001FFFFu
 17-bit
 
constexpr uint32_t I_AVG_SIGN_BIT = (1u << 16)
 
constexpr uint32_t TIME_STAMP_SHIFT = 20u
 
constexpr uint32_t TIME_STAMP_MASK = 0x00300000u
 2-bit
 
constexpr int32_t FULL_SCALE_mA = 4000
 
constexpr int32_t FULL_SCALE_COUNT = 65535
 
constexpr uint32_t SETTLING_CODE = 0x8000u
 Raw code the frame carries before a measurement has settled.
 

Detailed Description

FB_I_AVG_s16 decoder (calibration only — see the warning below).

Per datasheet Rev 1.2 §5.3.3.18 (register map) and §4.10.6 (semantics). Reply frame is 22-bit: bits 16:0 I_AVG_s16 (two's complement) Iavg16 = 4 A * val / (2^16 - 1) bits 21:20 TIME_STAMP (2-bit rolling counter, quad-seq in fast meas)

Unlike FB_I_AVG (offset 0x0202) this is an absolute value — no TP_MANT divisor from FB_DC — averaged over a free-running window of 2^16 fSYS cycles (≈2.34 ms at 28 MHz) rather than the configured Tmeas. It is also not one of the registers FB_FRZ freezes (§4.10.5 lists FB_DC, FB_VBAT, FB_I_AVG, FB_PERIOD_MIN_MAX, FB_IMIN_IMAX), so a single unfrozen read yields a coherent current.

Warning
Do not use this for current supervision or closed-loop control. §4.10.6, verbatim: "This value is not intended to be used while in closed loop operation or for current supervision. The value is provided as additional information and can be used for calibration purposes." Every product channel runs in ICC closed loop and the measured current feeds valve load classification, which gates a safety hold — so the control and diagnostics paths must use the FB_FRZ + FB_DC/FB_I_AVG mantissa ratio (§4.10.2, Figure 22) even though it costs more SPI. Calibration and bench characterisation may use this register.

Function Documentation

◆ ExtractTimestamp()

constexpr uint8_t tle92466ed::FB_I_AVG_s16::ExtractTimestamp ( uint32_t  reply_22bit)
constexprnoexcept

Extract the 2-bit rolling timestamp.

◆ IsSettlingFrame()

constexpr bool tle92466ed::FB_I_AVG_s16::IsSettlingFrame ( uint32_t  reply_22bit)
constexprnoexcept

True when the frame is the pre-measurement placeholder.

Warning
Mid-scale is also the code an honest +2000 mA reading would use. That is out of range for every channel on this product (full flow is 115 mA), so rejecting it is correct here; a design driving loads near 2 A must gate on the measurement window instead.

◆ SignExtend17()

constexpr int32_t tle92466ed::FB_I_AVG_s16::SignExtend17 ( uint32_t  raw17)
constexprnoexcept

Sign-extend the 17-bit signed field.

◆ ToMilliamps()

constexpr int32_t tle92466ed::FB_I_AVG_s16::ToMilliamps ( uint32_t  reply_22bit)
constexprnoexcept

Decode signed 17-bit raw to milliamps.

Warning
Gate on IsSettlingFrame first — this decoder cannot tell a settled measurement from the power-on placeholder.

Variable Documentation

◆ FULL_SCALE_COUNT

constexpr int32_t tle92466ed::FB_I_AVG_s16::FULL_SCALE_COUNT = 65535
constexpr

◆ FULL_SCALE_mA

constexpr int32_t tle92466ed::FB_I_AVG_s16::FULL_SCALE_mA = 4000
constexpr

◆ I_AVG_MASK

constexpr uint32_t tle92466ed::FB_I_AVG_s16::I_AVG_MASK = 0x0001FFFFu
constexpr

17-bit

◆ I_AVG_SIGN_BIT

constexpr uint32_t tle92466ed::FB_I_AVG_s16::I_AVG_SIGN_BIT = (1u << 16)
constexpr

◆ SETTLING_CODE

constexpr uint32_t tle92466ed::FB_I_AVG_s16::SETTLING_CODE = 0x8000u
constexpr

Raw code the frame carries before a measurement has settled.

Exactly half of FULL_SCALE_COUNT, so it decodes to a plausible-looking 2000 mA. Observed on a 115 mA proportional valve whenever this register was read before the channel had an established measurement window.

◆ TIME_STAMP_MASK

constexpr uint32_t tle92466ed::FB_I_AVG_s16::TIME_STAMP_MASK = 0x00300000u
constexpr

2-bit

◆ TIME_STAMP_SHIFT

constexpr uint32_t tle92466ed::FB_I_AVG_s16::TIME_STAMP_SHIFT = 20u
constexpr