|
TLE92466ED Driver 2.0.0
API reference
|
Main TLE92466ED driver class. More...
#include <tle92466ed.hpp>
Public Member Functions | |
| Driver (CommType &comm) noexcept | |
| Construct driver with communication interface. | |
| ~Driver () noexcept | |
| Destructor - ensures clean shutdown. | |
| Driver (const Driver &)=delete | |
| Driver & | operator= (const Driver &)=delete |
| Driver (Driver &&) noexcept=delete | |
| Driver & | operator= (Driver &&) noexcept=delete |
| DriverResult< void > | Init (bool perform_hardware_reset=true) noexcept |
| Initialize the driver and hardware. | |
| DriverResult< void > | EnterMissionMode () noexcept |
| Enter Mission Mode (enables channel control) | |
| DriverResult< void > | EnterConfigMode () noexcept |
| Enter Config Mode (allows configuration changes) | |
| bool | IsMissionMode () const noexcept |
| Check if in mission mode. | |
| bool | IsConfigMode () const noexcept |
| Check if in config mode. | |
| DriverResult< void > | ConfigureGlobal (const GlobalConfig &config) noexcept |
| Configure global device settings. | |
| DriverResult< void > | SetCrcEnabled (bool enabled) noexcept |
| Enable/disable CRC checking. | |
| DriverResult< void > | SetVbatThresholds (float uv_voltage, float ov_voltage) noexcept |
| Set VBAT under/overvoltage thresholds from voltage values (High-Level API) | |
| DriverResult< void > | SetVbatThresholdsRaw (uint8_t uv_threshold, uint8_t ov_threshold) noexcept |
| Set VBAT under/overvoltage thresholds (Low-Level API) | |
| DriverResult< void > | EnableChannel (Channel channel, bool enabled) noexcept |
| Enable or disable a channel. | |
| DriverResult< void > | EnableChannels (uint8_t channel_mask) noexcept |
| Enable or disable multiple channels. | |
| DriverResult< void > | EnableAllChannels () noexcept |
| Enable all channels. | |
| DriverResult< void > | DisableAllChannels () noexcept |
| Disable all channels. | |
| DriverResult< void > | SetChannelMode (Channel channel, ChannelMode mode) noexcept |
| Set channel operation mode. | |
| DriverResult< void > | SetParallelOperation (ParallelPair pair, bool enabled) noexcept |
| Configure channel for parallel operation. | |
| DriverResult< void > | SetCurrentSetpoint (Channel channel, uint16_t current_ma, bool parallel_mode=false) noexcept |
| Set current setpoint for channel. | |
| DriverResult< void > | SetCurrentSetpointUa (Channel channel, uint32_t current_ua, bool parallel_mode=false) noexcept |
| Set the ICC current setpoint in microamperes (full 15-bit TARGET resolution). | |
| DriverResult< uint16_t > | GetCurrentSetpoint (Channel channel, bool parallel_mode=false) noexcept |
| Get current setpoint for channel. | |
| DriverResult< void > | ConfigurePwmPeriod (Channel channel, float period_us) noexcept |
| Configure PWM period from desired period in microseconds (High-Level API) | |
| DriverResult< void > | ConfigurePwmPeriodRaw (Channel channel, uint8_t period_mantissa, uint8_t period_exponent, bool low_freq_range=false) noexcept |
| Configure PWM parameters for ICC (Low-Level API) | |
| DriverResult< void > | ConfigureDither (Channel channel, float amplitude_ma, float frequency_hz, bool parallel_mode=false) noexcept |
| Configure dither from amplitude and frequency (High-Level API) | |
| DriverResult< void > | ConfigureDitherRaw (Channel channel, uint16_t step_size, uint8_t num_steps, uint8_t flat_steps) noexcept |
| Configure dither parameters (Low-Level API) | |
| DriverResult< void > | ConfigureDitherClock (Channel channel, float t_ref_clk_us, bool dither_pwm_sync=false, bool dither_setpoint_sync=false) noexcept |
| Configure the per-channel dither reference clock (DITHER_CLK_DIV). | |
| DriverResult< void > | ConfigureChannel (Channel channel, const ChannelConfig &config) noexcept |
| Configure channel slew rate and diagnostics. | |
| DriverResult< DeviceStatus > | GetDeviceStatus () noexcept |
| Get global device status. | |
| DriverResult< ChannelDiagnostics > | GetChannelDiagnostics (Channel channel) noexcept |
| Get channel diagnostic information. | |
| DriverResult< uint16_t > | GetAverageCurrent (Channel channel, bool parallel_mode=false) noexcept |
| Get average load current for a channel, in milliamps. | |
| DriverResult< uint16_t > | GetDutyCycle (Channel channel) noexcept |
| Get PWM duty cycle for a channel, in permyriad (0..10000). | |
| DriverResult< uint16_t > | GetVbatVoltage () noexcept |
| Get VBAT voltage. | |
| DriverResult< uint16_t > | GetVioVoltage () noexcept |
| Get VIO voltage. | |
| DriverResult< uint16_t > | GetVddVoltage () noexcept |
| Get VDD voltage. | |
| DriverResult< void > | GetVbatThresholds (uint16_t &uv_threshold, uint16_t &ov_threshold) noexcept |
| Get VBAT thresholds. | |
| DriverResult< void > | ClearFaults () noexcept |
| Clear all fault flags. | |
| DriverResult< bool > | HasAnyFault () noexcept |
| Check if any fault exists. | |
| DriverResult< FaultReport > | GetAllFaults () noexcept |
| Get comprehensive fault report. | |
| DriverResult< void > | PrintAllFaults () noexcept |
| Print all detected faults to log. | |
| DriverResult< void > | SoftwareReset () noexcept |
| Software reset of the device. | |
| DriverResult< void > | ReloadSpiWatchdog (uint16_t reload_value) noexcept |
| Reload SPI watchdog counter. | |
| DriverResult< uint16_t > | GetIcVersion () noexcept |
| Read IC version and ID. | |
| DriverResult< std::array< uint16_t, 3 > > | GetChipId () noexcept |
| Read unique chip ID. | |
| DriverResult< bool > | VerifyDevice () noexcept |
| Verify device ID matches expected value. | |
| bool | IsInitialized () const noexcept |
| Check if driver is initialized. | |
| DriverResult< void > | SetReset (bool reset) noexcept |
| Hold device in reset or release reset. | |
| DriverResult< void > | HoldReset () noexcept |
| Hold device in reset. | |
| DriverResult< void > | ReleaseReset () noexcept |
| Release device from reset. | |
| DriverResult< void > | SetEnable (bool enable) noexcept |
| Enable or disable output channels. | |
| DriverResult< void > | Enable () noexcept |
| Enable output channels. | |
| DriverResult< void > | Disable () noexcept |
| Disable output channels. | |
| DriverResult< bool > | IsFault (bool print_faults=false) noexcept |
| Check if device fault is detected. | |
| DriverResult< void > | ConfigureClockSource (ClockSource source, uint32_t f_clk_Hz=0) noexcept |
| Configure the device clock source (internal osc vs external+PLL). | |
| DriverResult< SupplyVoltages > | ReadAllSupplyVoltages () noexcept |
| Atomic readout of VBAT, VIO, VDD and die temperature. | |
| DriverResult< float > | GetCentralTemperatureCelsius () noexcept |
| Read only the central die temperature in \u00b0C. | |
| DriverResult< void > | SetVioLevel (VioLevel level) noexcept |
| Select VIO voltage level (3.3 V or 5.0 V). | |
| DriverResult< OperationState > | GetOperationState () noexcept |
| Read the coarse operational state. | |
| DriverResult< void > | EnterMissionModeChecked (uint32_t timeout_ms=10U) noexcept |
| Enter Mission Mode and verify by polling FB_STAT.INIT_DONE. | |
| DriverResult< SupplyMonitorSelfTestResult > | RunSupplyMonitorSelfTest () noexcept |
| Run the built-in supply-monitor self-test sequence. | |
| DriverResult< void > | SetIntegratorLimits (Channel channel, uint16_t lim_value_abs, uint8_t auto_lim_value_abs) noexcept |
| Set ICC integrator clamp limits (INTEGRATOR_LIMIT, offset 0x03). | |
| DriverResult< void > | SetPwmControllerKi (Channel channel, uint8_t ki) noexcept |
| Set the PWM controller proportional gain (KI, PERIOD.PWM_CTRL_PARAM). | |
| DriverResult< void > | SetMinIntegratorThreshold (Channel channel, int8_t min_int_thresh) noexcept |
| Set the minimum integrator threshold (CTRL.MIN_INT_THRESH). | |
| DriverResult< void > | SetManualOnTimeMode (Channel channel, float on_time_us) noexcept |
| Switch to manual on-time mode (DIRECT_DRIVE_SPI) with fixed TON. | |
| DriverResult< void > | SeedIntegratorThresholdFromFeedback (Channel channel) noexcept |
| Seed the ICC integrator from the current feedback reading. | |
| DriverResult< void > | SetDitherAdvanced (Channel channel, const DitherSetup &setup, bool parallel_mode=false) noexcept |
| High-level dither configuration (superset of ConfigureDither). | |
| DriverResult< void > | SetOlsgTimeout (Channel channel, uint8_t olsg_timeout_code) noexcept |
| Configure open-load/short-to-ground watchdog timeout. | |
| DriverResult< void > | SetOffStateDiagnostics (Channel channel, bool oc_diag_enabled, uint8_t ol_th_fixed) noexcept |
| Enable / disable per-channel off-state OC diagnosis and fixed OL threshold. | |
| DriverResult< BistResult > | RunSffBist (uint32_t timeout_ms=10U) noexcept |
| Run the safe-state logic-BIST (SFF_BIST). | |
| DriverResult< PinStatus > | ReadPinStatus () noexcept |
| Read the input pin status register (PIN_STAT). | |
| DriverResult< void > | SetFaultMask (MaskableFault fault, bool enable) noexcept |
| Enable or mask a specific fault source from asserting FAULTN. | |
| DriverResult< ChannelFeedback > | ReadChannelFeedback (Channel channel, uint32_t timeout_ms=10U) noexcept |
| Read a coherent feedback snapshot for one channel. | |
| DriverResult< std::array< ChannelFeedback, 6 > > | ReadAllChannelFeedback (uint32_t timeout_ms=20U) noexcept |
| Read coherent feedback for all six channels in a single freeze window. | |
| DriverResult< int32_t > | GetCalibrationAvgCurrent_mA (Channel channel) noexcept |
Calibration-grade signed average current from FB_I_AVG_s16. | |
| DriverResult< uint8_t > | GetFeedbackUpdateMask () noexcept |
| Read FB_UPD — bit N set when channel N has a completed window. | |
| DriverResult< void > | FreezeFeedback (uint8_t channel_mask) noexcept |
Set FB_FRZ to channel_mask (bit N freezes channel N). | |
| DriverResult< void > | ReleaseFeedbackFreeze () noexcept |
| Clear FB_FRZ for every channel, resuming feedback updates. | |
| DriverResult< CurrentFeedbackBatch > | SampleChannelCurrents (uint8_t channel_mask) noexcept |
| Average current for several channels in one pipelined burst. | |
| DriverResult< void > | ReadAllChannelErrorFlags (std::array< ChannelErrorFlags, 6 > &out) noexcept |
| Latched error bits for all six channels. | |
| DriverResult< bool > | IsMeasurementClockRunning (Channel channel) noexcept |
| True when DITHER_CLK_DIV encodes a running measurement clock. | |
| DriverResult< bool > | EnsureDitherRunning (Channel channel, float amplitude_ma, float frequency_hz, uint8_t max_attempts=3U) noexcept |
| Configure dither and confirm the measurement clock took. | |
| uint16_t | GetChannelControlShadow () const noexcept |
| Last CH_CTRL value this driver wrote (OP_MODE + EN_CHx). | |
| DriverResult< void > | SetFaultContributionMask (uint8_t channel_mask) noexcept |
| Choose which channels may pull FAULTN via FAULT_MASK0/1. | |
| DriverResult< uint32_t > | ReadRegister (uint16_t address, bool verify_crc=false) noexcept |
| Read 16-bit register. | |
| DriverResult< void > | ReadRegisterMulti (std::span< const uint16_t > addresses, std::span< uint32_t > values, uint16_t &valid_mask) noexcept |
| Read several registers in one pipelined chain. | |
| DriverResult< void > | WriteRegister (uint16_t address, uint16_t value, bool verify_crc=false, bool verify_write=true) noexcept |
| Write 16-bit register. | |
| DriverResult< void > | ModifyRegister (uint16_t address, uint16_t mask, uint16_t value) noexcept |
| Modify register bits. | |
Static Public Member Functions | |
| static constexpr uint32_t | GetSystemClockHz () noexcept |
| Get the nominal system clock (always 28 MHz after PLL lock). | |
| static constexpr const char * | GetDriverVersion () noexcept |
| Get the compiled driver version string. | |
| static constexpr uint8_t | GetDriverVersionMajor () noexcept |
| Get the compiled driver major version number. | |
| static constexpr uint8_t | GetDriverVersionMinor () noexcept |
| Get the compiled driver minor version number. | |
| static constexpr uint8_t | GetDriverVersionPatch () noexcept |
| Get the compiled driver patch version number. | |
Private Member Functions | |
| DriverResult< SPIFrame > | transferFrame (const SPIFrame &tx_frame, bool verify_crc=true) noexcept |
| Transfer SPI frame with CRC calculation and verification. | |
| constexpr bool | isValidChannelInternal (Channel channel) const noexcept |
| Validate channel number. | |
| DriverResult< void > | checkInitialized () const noexcept |
| Check if driver is initialized. | |
| DriverResult< void > | checkMissionMode () const noexcept |
| Check if in mission mode. | |
| DriverResult< void > | checkConfigMode () const noexcept |
| Check if in config mode. | |
| DriverResult< void > | applyDefaultConfig () noexcept |
| Apply default configuration after initialization. | |
| DriverResult< void > | clearFaultsInternal () noexcept |
| Clear faults without checking initialization status (used during Init) | |
| DriverResult< void > | setVbatThresholdsInternal (float uv_voltage, float ov_voltage) noexcept |
| Set VBAT thresholds without checking initialization status (used during Init) | |
| DriverResult< void > | checkSpiStatus (const SPIFrame &rx_frame) noexcept |
| Parse SPI status from reply frame. | |
| DriverResult< bool > | isChannelParallel (Channel channel) noexcept |
| Check if channel is currently in parallel mode. | |
| DriverResult< bool > | isSlaveChannel (Channel channel) noexcept |
| Check if a channel is the slave half of an enabled parallel pair. Slave channels are CH2, CH3, CH5 when their pair is parallelized; most per-channel writes are rejected on the slave. | |
| void | diagnoseClockConfiguration () noexcept |
| Diagnose clock configuration by reading CLK_DIV register. | |
Private Attributes | |
| CommType & | comm_ |
| Communication interface. | |
| bool | initialized_ {false} |
| Initialization status. | |
| bool | mission_mode_ {false} |
| Mission mode flag (vs config mode) | |
| bool | crc_enabled_ {false} |
| CRC enable state (tracks GLOBAL_CONFIG::CRC_EN) | |
| bool | vio_5v_mode_ {false} |
| VIO mode state (tracks GLOBAL_CONFIG::VIO_SEL, false=3.3V, true=5V) | |
| uint16_t | ch_ctrl_cache_ {0U} |
| Cached CH_CTRL register value (reads return 0x0000) | |
| uint16_t | channel_enable_cache_ {0U} |
| Cached channel enable state. | |
| uint16_t | cached_icvid_ {0U} |
| ICVID latched at VerifyDevice (live re-read may flake) | |
| std::array< uint16_t, 6 > | channel_setpoints_ |
| Cached current setpoints. | |
Main TLE92466ED driver class.
This is the primary driver class that provides complete control over the TLE92466ED IC. It manages SPI communication (32-bit with CRC), configuration, current control, monitoring, and diagnostics for all six output channels.
Thread Safety: This class is NOT thread-safe by default. External synchronization is required for multi-threaded access.
Resource Management: Uses RAII principles - init() must be called explicitly but cleanup is automatic.
Error Handling: Uses std::expected for robust error handling without exceptions.
|
inlineexplicitnoexcept |
|
inlinenoexcept |
Destructor - ensures clean shutdown.
|
delete |
|
deletenoexcept |
|
privatenoexcept |
Apply default configuration after initialization.
|
inlineprivatenoexcept |
Check if in config mode.
|
inlineprivatenoexcept |
Check if driver is initialized.
|
inlineprivatenoexcept |
Check if in mission mode.
|
privatenoexcept |
Parse SPI status from reply frame.
|
noexcept |
Clear all fault flags.
Clears latched fault conditions. Does not clear active faults.
|
privatenoexcept |
Clear faults without checking initialization status (used during Init)
|
noexcept |
Configure channel slew rate and diagnostics.
| channel | Channel to configure |
| config | Channel configuration |
|
noexcept |
Configure the device clock source (internal osc vs external+PLL).
| source | Desired clock source. |
| f_clk_Hz | External clock rate in Hz (required if source is ExternalClockPll; ignored otherwise). Supported range is 1\u20138 MHz per datasheet \u00a74.1. |
Writes CLK_DIV (0x0019) in Config Mode. Caller is responsible for waiting the datasheet-specified PLL lock time (\u2248500 \u00b5s).
|
noexcept |
Configure dither from amplitude and frequency (High-Level API)
| channel | Channel to configure |
| amplitude_ma | Desired dither amplitude in milliamperes |
| frequency_hz | Desired dither frequency in Hz |
| parallel_mode | true if channel is in parallel mode (affects max current) |
Automatically calculates step_size, num_steps, and flat_steps to achieve the desired amplitude and frequency.
Formulas:
|
noexcept |
Configure the per-channel dither reference clock (DITHER_CLK_DIV).
Per datasheet §5.3.3.7, DITHER_CLK_DIV (offset 0x0004 within each channel bank) sets the dither reference clock used by both the dither generator and the averaged-feedback engine:
tref_clk = MANT × 2^EXP / fSYS
POR reset value is 0x0000 which makes tref_clk = 0, the dither period TDither = 0, and (in ICC mode) the measurement period Tmeas = TDither = 0 — so FB_DC / FB_I_AVG / FB_VBAT NEVER update. The high-level ConfigureDither() API calls this function automatically with values derived from the requested dither frequency. Use this API directly if you need a specific tref_clk (e.g. to control the FB update rate independently from the dither amplitude/period).
| channel | Channel to configure |
| t_ref_clk_us | Desired reference clock period in microseconds. The driver picks the closest representable MANT/EXP and logs the actual value used. Must be > 0; minimum 0.125 µs (1/fSYS). |
| dither_pwm_sync | If true, synchronise dither period start with PWM rising edge (DITHER_PWM_SYNC_EN). |
| dither_setpoint_sync | If true, restart dither period on every setpoint change (DITHER_SETPOINT_SYNC_EN); required for the lockstep-feedback mode described in datasheet §4.7.5. |
|
noexcept |
Configure dither parameters (Low-Level API)
| channel | Channel to configure |
| step_size | Dither step size (0-4095) |
| num_steps | Number of steps in quarter period (0-255) |
| flat_steps | Number of flat clock cycles at top/bottom (0-255) |
Formulas:
|
noexcept |
Configure global device settings.
| config | Global configuration structure |
| DriverError::NotInitialized | Driver not initialized |
| DriverError::WrongMode | Must be in Config Mode |
|
noexcept |
Configure PWM period from desired period in microseconds (High-Level API)
| channel | Channel to configure |
| period_us | Desired PWM period in microseconds |
The TLE92466ED's PWM frequency controller is specified to operate between 110 Hz and 4 kHz (datasheet Electrical Characteristics). In period_us terms that is a usable range of:
The driver auto-selects the appropriate range. Periods outside the combined min/max (250 µs – 72.7 ms) return InvalidParameter. Periods that fall in the gap between the two ranges (9.1 – 2 ms, i.e. 110 Hz – 500 Hz) are accepted but logged as a warning since the PWM-control loop is not specified there.
Formulas: T_pwm = PERIOD_MANT × 2^PERIOD_EXP × (1/f_sys) Low-range: T_pwm = PERIOD_MANT × 8 × 2^PERIOD_EXP × (1/f_sys) f_sys ≈ 8 MHz
ConfigurePwmPeriodRaw() only if you need direct control over register values.
|
noexcept |
Configure PWM parameters for ICC (Low-Level API)
| channel | Channel to configure |
| period_mantissa | PWM period mantissa (0-255) |
| period_exponent | PWM period exponent (0-7; larger returns InvalidParameter) |
| low_freq_range | Enable low frequency range (8x multiplier) |
PWM period: t_PWM = mantissa * 2^exponent * (1/f_sys) If low_freq_range: t_PWM = mantissa * 8 * 2^exponent * (1/f_sys)
|
privatenoexcept |
|
inlinenoexcept |
Disable output channels.
Convenience function to disable outputs. Equivalent to SetEnable(false).
|
noexcept |
Disable all channels.
|
inlinenoexcept |
Enable output channels.
Convenience function to enable outputs. Equivalent to SetEnable(true).
|
noexcept |
Enable all channels.
|
noexcept |
Enable or disable a channel.
| channel | Channel to control |
| enabled | true to enable, false to disable |
| DriverError::WrongMode | Must be in Mission Mode |
|
noexcept |
Enable or disable multiple channels.
| channel_mask | Bitmask where bit N enables channel N |
|
noexcept |
Configure dither and confirm the measurement clock took.
| channel | Channel to configure. |
| amplitude_ma | Dither amplitude; 0 skips dither programming. |
| frequency_hz | Dither frequency. |
| max_attempts | Configure/read-back attempts before giving up. |
|
noexcept |
Enter Config Mode (allows configuration changes)
Transitions from Mission Mode to Config Mode. All channel outputs are automatically disabled when entering Config Mode.
|
noexcept |
Enter Mission Mode (enables channel control)
Transitions from Config Mode to Mission Mode. Channel outputs can only be enabled in Mission Mode. Most configuration registers can only be written in Config Mode.
| DriverError::NotInitialized | Driver not initialized |
|
noexcept |
Enter Mission Mode and verify by polling FB_STAT.INIT_DONE.
| timeout_ms | Maximum time to wait for INIT_DONE. |
|
noexcept |
Set FB_FRZ to channel_mask (bit N freezes channel N).
|
noexcept |
Get comprehensive fault report.
Reads all fault registers (GLOBAL_DIAG0, GLOBAL_DIAG1, GLOBAL_DIAG2) and all channel fault registers to provide a complete fault report.
|
noexcept |
Get average load current for a channel, in milliamps.
Reads the compressed mantissa/exponent feedback path (FB_I_AVG and FB_DC, both 22-bit reply frames) and decodes Iavg = 4 A × <I_AVG_MANT> / <TP_MANT> per datasheet §4.10.2. Issues two pipelined SPI reads per register (four frames total).
Before decoding, validates the measurement window via FB_FEEDBACK::HasValidMeasurementWindow() (minimum FB_FEEDBACK::kMinValidTpMant in TP_MANT from FB_DC).
| channel | Channel to query |
| parallel_mode | Currently unused — the mantissa-ratio formula is identical for parallel-paired channels; kept for API stability. |
| DriverError::FeedbackNotReady | TP_MANT too small for a trustworthy mantissa ratio (averaging window not established, feedback frozen, or corrupted pipelined reply). |
| DriverError::InvalidChannel | Channel out of range. |
| DriverError::NotInitialized | Driver not initialized. |
FB_I_AVG (mantissa ratio with TP_MANT from FB_DC), not FB_I_AVG_s16. For calibration-grade signed current see GetCalibrationAvgCurrent_mA().FB_UPD with Delay() for up to ~8 ms. It is a diagnostic / console helper. Real-time control must use SampleChannelCurrents, which never blocks.
|
noexcept |
Calibration-grade signed average current from FB_I_AVG_s16.
Reads the per-channel FB_I_AVG_s16 register (offset 0x0204) and decodes the 17-bit signed field via FB_I_AVG_s16::ToMilliamps(). This path is distinct from GetAverageCurrent(), which uses the compressed FB_I_AVG mantissa ratio with TP_MANT from FB_DC.
| channel | Channel to query. |
FB_I_AVG_s16 is intended for calibration workflows. The datasheet notes the frame may not be valid while the channel is still settling, so this returns DriverError::FeedbackNotReady when the register still holds the mid-scale placeholder (FB_I_AVG_s16::IsSettlingFrame).GetAverageCurrent() for control and telemetry and keep this one for calibration.
|
noexcept |
Read only the central die temperature in \u00b0C.
|
inlinenoexcept |
|
noexcept |
Get channel diagnostic information.
| channel | Channel to query |
|
noexcept |
Read unique chip ID.
|
noexcept |
Get current setpoint for channel.
| channel | Channel to query |
| parallel_mode | true if channel is in parallel mode |
|
noexcept |
Get global device status.
|
inlinestaticconstexprnoexcept |
Get the compiled driver version string.
|
inlinestaticconstexprnoexcept |
Get the compiled driver major version number.
|
inlinestaticconstexprnoexcept |
Get the compiled driver minor version number.
|
inlinestaticconstexprnoexcept |
Get the compiled driver patch version number.
|
noexcept |
Get PWM duty cycle for a channel, in permyriad (0..10000).
Reads FB_DC (22-bit reply) and decodes DC = <TO_MANT> / <TP_MANT> per datasheet §4.10.2, then scales to permyriad so the legacy uint16_t return type retains 0.01 % precision.
| channel | Channel to query |
DriverError::FeedbackNotReady. When TP_MANT is 0 or the window is invalid, the decoded duty is 0 permyriad. Use GetAverageCurrent() or ReadChannelFeedback() when an explicit not-ready indication is required.
|
noexcept |
Read FB_UPD — bit N set when channel N has a completed window.
One central 16-bit read covers all six channels (datasheet §5.3.2.10). This is the chip's own "is the data fresh" signal and the first step of the Figure 22 readout; polling it beats guessing at Tmeas with a wall clock, and it costs one register access for the whole device.
|
noexcept |
Read IC version and ID.
|
noexcept |
Read the coarse operational state.
|
inlinestaticconstexprnoexcept |
Get the nominal system clock (always 28 MHz after PLL lock).
|
noexcept |
Get VBAT thresholds.
| uv_threshold | Output parameter for UV threshold in millivolts |
| ov_threshold | Output parameter for OV threshold in millivolts |
|
noexcept |
Get VBAT voltage.
|
noexcept |
Get VDD voltage.
|
noexcept |
Get VIO voltage.
|
noexcept |
Check if any fault exists.
|
inlinenoexcept |
Hold device in reset.
Convenience function to hold device in reset state. Equivalent to SetReset(true).
|
noexcept |
Initialize the driver and hardware.
Performs complete initialization sequence:
After init(), device is in Config Mode. Call enter_mission_mode() to enable outputs.
| perform_hardware_reset | When true (default), pulse RESN low then release before SPI identity. When false, leave RESN released (HIGH) and only re-run EN settle + SPI verify — used by shared-bus retries so the eval RESET LED is not hammered every few hundred ms. |
| DriverError::HardwareError | CommInterface initialization failed |
| DriverError::DeviceNotResponding | No SPI response |
| DriverError::WrongDeviceID | Device ID mismatch |
|
privatenoexcept |
Check if channel is currently in parallel mode.
| channel | Channel to check |
|
inlinenoexcept |
Check if in config mode.
|
noexcept |
Check if device fault is detected.
Reads the FAULTN pin to check if a fault condition is present. FAULTN is an active-low signal, so LOW = fault detected.
| print_faults | If true and fault is detected, automatically calls PrintAllFaults() to display detailed fault information. Default: false (no automatic printing) |
| DriverError::HardwareError | GPIO read failed |
|
inlinenoexcept |
Check if driver is initialized.
|
noexcept |
True when DITHER_CLK_DIV encodes a running measurement clock.
The POR value is 0, which makes tref_clk — and therefore Tmeas — zero, so FB_DC / FB_I_AVG / FB_VBAT never update. Confirming this before trusting feedback is a chip invariant, not caller policy.
|
inlinenoexcept |
Check if in mission mode.
|
privatenoexcept |
Check if a channel is the slave half of an enabled parallel pair. Slave channels are CH2, CH3, CH5 when their pair is parallelized; most per-channel writes are rejected on the slave.
|
inlineconstexprprivatenoexcept |
Validate channel number.
|
noexcept |
Modify register bits.
| address | Register address |
| mask | Bit mask for modification |
| value | New bit values |
|
delete |
|
deletenoexcept |
|
noexcept |
Print all detected faults to log.
Reads all faults and prints them in a formatted, easy-to-read format. Only prints faults that are actually detected.
|
noexcept |
Latched error bits for all six channels.
DIAG_ERR_CHGR0..2 each cover a channel pair, so this is one pipelined burst of three reads for the whole device.
|
noexcept |
Read coherent feedback for all six channels in a single freeze window.
| timeout_ms | Maximum time to wait for each channel's FB_UPD poll. |
ChannelFeedback structures or error.
|
noexcept |
Atomic readout of VBAT, VIO, VDD and die temperature.
Reads FB_VOLTAGE1 and FB_VOLTAGE2 and decodes them via the VOLTAGE_FEEDBACK namespace helpers. Result is stable even while the device is operating in Mission Mode.
|
noexcept |
Read a coherent feedback snapshot for one channel.
Workflow (datasheet §4.10.5):
FB_FRZ).FB_UPD for the update bit for this channel.FB_DC / FB_VBAT / FB_I_AVG / FB_IMIN_IMAX / FB_PERIOD_MIN_MAX / FB_INT_THRESH.avg_current_mA is decoded from FB_I_AVG + FB_DC via the mantissa ratio (FB_FEEDBACK::ComputeAverageCurrent_mA). It does not gate on HasValidMeasurementWindow() — callers must interpret near-zero TP_MANT themselves or prefer GetAverageCurrent() for explicit FeedbackNotReady handling.
| channel | Channel to read. |
| timeout_ms | Maximum time to wait for FB_UPD. |
ChannelFeedback snapshot or error. | DriverError::TimeoutError | Update bit did not assert in time. |
|
noexcept |
Read the input pin status register (PIN_STAT).
|
noexcept |
Read 16-bit register.
| address | Register address (10-bit) |
| verify_crc | Override CRC verification (default: uses internal CRC enable state) |
|
noexcept |
Read several registers in one pipelined chain.
| [in] | addresses | Register addresses (at most CommType::kMaxPipelinedReads). |
| [out] | values | Decoded values; entries that failed validation are 0. |
| [out] | valid_mask | Bit i set when values[i] is trustworthy. |
N reads cost N+2 SPI frames here instead of 3N, because the pipeline is opened once for the whole burst. Individual replies are still validated independently, so a single corrupt frame costs one entry rather than the batch.
|
noexcept |
Clear FB_FRZ for every channel, resuming feedback updates.
|
inlinenoexcept |
Release device from reset.
Convenience function to release device from reset state. Equivalent to SetReset(false).
|
noexcept |
Reload SPI watchdog counter.
Must be called periodically when SPI watchdog is enabled to prevent watchdog timeout.
| reload_value | Reload value (watchdog period) |
|
noexcept |
Run the safe-state logic-BIST (SFF_BIST).
|
noexcept |
Run the built-in supply-monitor self-test sequence.
Exercises the UV/OV swap, the 1.5 V monitor UV/OV trips and the over-temperature test logic. Restores the original GLOBAL_CONFIG on exit. Device must be in Config Mode.
|
noexcept |
Average current for several channels in one pipelined burst.
| channel_mask | Bit N requests channel N (bits above 5 ignored). |
Figure 22 wants a freeze around the FB_DC / FB_I_AVG pair. On the desk Mid eval FB_FRZ is unreadable (and an un-acked freeze sticks, aborting Tmeas for the rest of the session). This path therefore:
A chain whose ICVID anchors do not verify is discarded whole — a spliced neighbour current is never published as this channel's. Host: tests/host/test_tle_anchored_chain.cpp.
|
noexcept |
Seed the ICC integrator from the current feedback reading.
Reads FB_INT_THRESH and writes it back to CTRL_INT_THRESH.INT_THRESH so that a subsequent setpoint change doesn't wind up the integrator.
|
noexcept |
Set channel operation mode.
| channel | Channel to configure |
| mode | Operation mode (ICC, Direct Drive, etc.) |
| DriverError::WrongMode | Must be in Config Mode |
|
noexcept |
Enable/disable CRC checking.
| enabled | true to enable CRC |
|
noexcept |
Set current setpoint for channel.
| channel | Channel to configure |
| current_ma | Desired current in milliamperes (0-2000 single, 0-4000 parallel) |
| parallel_mode | Set true if channel is in parallel mode |
|
noexcept |
Set the ICC current setpoint in microamperes (full 15-bit TARGET resolution).
| channel | Channel. |
| current_ua | Target in µA (≤ 2 000 000 single / 4 000 000 parallel). |
| parallel_mode | Parallel-channel scaling. |
Same write/verify path as SetCurrentSetpoint, which now delegates here with current_ma * 1000.
|
noexcept |
High-level dither configuration (superset of ConfigureDither).
Programs DITHER_CLK_DIV + DITHER_STEP + DITHER_CTRL atomically to realize the requested amplitude/frequency and sync/fast-measure options. Clears any residual deep-dither / fast-meas flags.
|
noexcept |
Enable or disable output channels.
Controls the EN (enable) pin. When disabled, all output channels are disabled regardless of channel enable register settings.
| enable | If true, enable outputs (EN HIGH). If false, disable outputs (EN LOW). |
| DriverError::HardwareError | GPIO control failed |
|
noexcept |
Choose which channels may pull FAULTN via FAULT_MASK0/1.
| channel_mask | Bit N = channel N contributes to FAULTN. |
Which channels are populated is product wiring, so the mask is an argument; how that maps onto FAULT_MASK0/1 bit positions is chip protocol and stays here.
|
noexcept |
Enable or mask a specific fault source from asserting FAULTN.
|
noexcept |
Set ICC integrator clamp limits (INTEGRATOR_LIMIT, offset 0x03).
| channel | Channel to configure. |
| lim_value_abs | Primary integrator limit magnitude (0\u20131023). |
| auto_lim_value_abs | Auto-limit setpoint delta magnitude (0\u201331). |
The driver enforces the datasheet constraint that auto_lim_value_abs must be greater than MIN_INT_THRESH+3 (as currently cached in the channel's CTRL register).
|
noexcept |
Switch to manual on-time mode (DIRECT_DRIVE_SPI) with fixed TON.
| channel | Channel to configure. |
| on_time_us | Desired constant on-time in microseconds. |
Writes TON.TON_MANT and sets CTRL_INT_THRESH.PERIOD_MANT=0 which disables the ICC integrator update path.
|
noexcept |
Set the minimum integrator threshold (CTRL.MIN_INT_THRESH).
| channel | Channel to configure. |
| min_int_thresh | Signed 8-bit minimum integrator threshold. |
|
noexcept |
Enable / disable per-channel off-state OC diagnosis and fixed OL threshold.
| channel | Channel to configure. |
| oc_diag_enabled | true to enable OC diagnosis while channel is OFF |
| ol_th_fixed | Fixed open-load threshold (0\u201363; 0 = disabled) |
|
noexcept |
Configure open-load/short-to-ground watchdog timeout.
| channel | Channel to configure. |
| olsg_timeout_code | 6-bit OLSG timeout value (0\u201363). |
|
noexcept |
Configure channel for parallel operation.
| pair | Parallel pair to configure (0/3, 1/2, or 4/5) |
| enabled | true to enable parallel operation |
| DriverError::WrongMode | Must be in Config Mode |
|
noexcept |
Set the PWM controller proportional gain (KI, PERIOD.PWM_CTRL_PARAM).
| channel | Channel to configure. |
| ki | 4-bit PWM controller parameter (0\u201315). |
|
noexcept |
Hold device in reset or release reset.
Controls the RESN (reset) pin. When in reset, the device is held in a reset state and all registers are reset to default values.
| reset | If true, hold device in reset (RESN LOW). If false, release reset (RESN HIGH). |
| DriverError::HardwareError | GPIO control failed |
|
noexcept |
Set VBAT under/overvoltage thresholds from voltage values (High-Level API)
| uv_voltage | UV threshold voltage in volts (0V to ~41.4V) |
| ov_voltage | OV threshold voltage in volts (0V to ~41.4V) |
Automatically calculates register values from voltage. Formula: register_value = voltage / 0.16208V
|
privatenoexcept |
Set VBAT thresholds without checking initialization status (used during Init)
| uv_voltage | Under-voltage threshold in volts |
| ov_voltage | Over-voltage threshold in volts |
|
noexcept |
Set VBAT under/overvoltage thresholds (Low-Level API)
| uv_threshold | UV threshold register value (0-255, V_BAT_UV = value * 0.16208V) |
| ov_threshold | OV threshold register value (0-255, V_BAT_OV = value * 0.16208V) |
|
noexcept |
Select VIO voltage level (3.3 V or 5.0 V).
Updates GLOBAL_CONFIG.VIO_SEL and caches the selection so that subsequent supply-voltage decodes pick the correct LSB. Must be called in Config Mode.
|
noexcept |
Software reset of the device.
Resets all registers to default values. init() must be called again.
|
privatenoexcept |
Transfer SPI frame with CRC calculation and verification.
Delegates to comm_.Read() / comm_.Write(), each of which performs the chip's two-frame pipelined transaction via TransferMulti().
|
noexcept |
Verify device ID matches expected value.
|
noexcept |
Write 16-bit register.
| address | Register address (10-bit) |
| value | Value to write (16-bit) |
| verify_crc | Override CRC verification (default: uses internal CRC enable state) |
| verify_write | If true, read back register to verify write succeeded (default: true) |
|
private |
ICVID latched at VerifyDevice (live re-read may flake)
|
private |
Cached CH_CTRL register value (reads return 0x0000)
|
private |
Cached channel enable state.
|
private |
Cached current setpoints.
|
private |
Communication interface.
|
private |
CRC enable state (tracks GLOBAL_CONFIG::CRC_EN)
|
private |
Initialization status.
|
private |
Mission mode flag (vs config mode)
|
private |
VIO mode state (tracks GLOBAL_CONFIG::VIO_SEL, false=3.3V, true=5V)