TLE92466ED Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
Driver types

Errors, results, configuration and decoded values. More...

Classes

struct  tle92466ed::Result< T >
 The value of a call, or why there is none. More...
 
struct  tle92466ed::Result< void >
 The result of a call that returns no value. More...
 
struct  tle92466ed::IccConfig
 The integrating current controller of one channel (CTRL, PERIOD, INTEGRATOR_LIMIT, CTRL_INT_THRESH, SETPOINT.AUTO_LIMIT_DIS; section 4.6.2). Defaults are the reset values. More...
 
struct  tle92466ed::DitherConfig
 The dither generator of one channel (DITHER_CLK_DIV, DITHER_STEP, DITHER_CTRL; section 4.7). In current control and direct drive the dither period is also the feedback measurement period (section 4.4.2): with mant = 0 the averaged feedback never updates. Defaults are the reset values. More...
 
struct  tle92466ed::DiagConfig
 The diagnosis of one channel (CH_CONFIG, CTRL, TON; section 4.9). Defaults are the reset values. On a channel ChannelConfig::loaded does not declare, the driver writes the OFF-state diagnosis off and both open-load thresholds 0, whatever these fields say (handbook KB-CPP-131). More...
 
struct  tle92466ed::ChannelConfig
 Everything the driver writes for one channel. Defaults are the reset values. More...
 
struct  tle92466ed::FaultPinMask
 Which faults pull FAULTN low (FAULT_MASK0..2, sections 5.3.2.14 to 5.3.2.16); true reports the fault on the pin. Defaults are the reset values. A channel loaded does not declare never reaches the pin (KB-CPP-131). More...
 
struct  tle92466ed::Config
 Everything EnsureInitialized() writes to the chip, and the driver's own settings. More...
 
struct  tle92466ed::ChannelFaults
 The faults and warnings of one channel, decoded (sections 5.3.2.12, 5.3.2.13). More...
 
struct  tle92466ed::Faults
 The diagnosis registers as read: GLOBAL_DIAG0..2, DIAG_ERR_CHGR0..2 and DIAG_WARN_CHGR0..2. Raw words, so a latch is a plain OR; Has() and Of() decode them. More...
 
struct  tle92466ed::DeviceStatus
 FB_STAT, the chip's one-word status summary, decoded (section 5.3.2.21). More...
 
struct  tle92466ed::SupplyReadings
 The supply and temperature feedback (FB_VOLTAGE1, FB_VOLTAGE2; 5.3.2.22, 5.3.2.23). More...
 
struct  tle92466ed::PinStatus
 PIN_STAT, decoded (section 5.3.2.20). More...
 
struct  tle92466ed::BistResult
 The result of the safety flip-flop self-test (SFF_BIST, section 4.9.8). More...
 
struct  tle92466ed::ChipId
 The unique chip identification, CHIPID0..2 (sections 5.3.2.24 to 5.3.2.26). More...
 
struct  tle92466ed::ChannelFeedback
 One measurement period of a channel's feedback, read under the freeze of section 4.10.5 and converted with Equations 18 to 22, 30 and 31. More...
 
struct  tle92466ed::BusDiagnostics
 Counters of the protocol layer (handbook KB-ARCH-044). No I/O to read them. More...
 
class  tle92466ed::CheckedConfig
 A configuration proven valid at build time. More...
 

Enumerations

enum class  tle92466ed::Error : uint8_t {
  tle92466ed::Error::Ok = 0 , tle92466ed::Error::NotInitialized = 1 , tle92466ed::Error::InvalidArgument = 2 , tle92466ed::Error::Bus = 3 ,
  tle92466ed::Error::Timeout = 4 , tle92466ed::Error::DeviceIdMismatch = 5 , tle92466ed::Error::Crc = 6 , tle92466ed::Error::Busy = 7 ,
  tle92466ed::Error::DeviceFault = 8 , tle92466ed::Error::Unsupported = 9 , tle92466ed::Error::NoDevice = 16 , tle92466ed::Error::CriticalFault = 17 ,
  tle92466ed::Error::ReplyMismatch = 18 , tle92466ed::Error::FrameRejected = 19 , tle92466ed::Error::WrongState = 20 , tle92466ed::Error::MissionBlocked = 21 ,
  tle92466ed::Error::WriteMismatch = 22 , tle92466ed::Error::NotReady = 23 , tle92466ed::Error::UnexpectedReset = 24
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  tle92466ed::LogLevel : uint8_t { tle92466ed::LogLevel::Error = 0 , tle92466ed::LogLevel::Warning , tle92466ed::LogLevel::Info , tle92466ed::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  tle92466ed::Verify : uint8_t { tle92466ed::Verify::None = 0 , tle92466ed::Verify::ReadBack = 1 }
 Extra traffic a setter may spend to confirm its write (handbook KB-ARCH-041). More...
 
enum class  tle92466ed::Channel : uint8_t {
  tle92466ed::Channel::Ch0 = 0 , tle92466ed::Channel::Ch1 = 1 , tle92466ed::Channel::Ch2 = 2 , tle92466ed::Channel::Ch3 = 3 ,
  tle92466ed::Channel::Ch4 = 4 , tle92466ed::Channel::Ch5 = 5
}
 One of the six output channels. More...
 
enum class  tle92466ed::ParallelPair : uint8_t { tle92466ed::ParallelPair::Ch0Ch3 = 0 , tle92466ed::ParallelPair::Ch1Ch2 = 1 , tle92466ed::ParallelPair::Ch4Ch5 = 2 }
 The channel pairs that can drive one load together (section 4.5.2). More...
 
enum class  tle92466ed::ChannelMode : uint8_t {
  tle92466ed::ChannelMode::Off = 0 , tle92466ed::ChannelMode::CurrentControl = 1 , tle92466ed::ChannelMode::DirectDriveSpi = 2 , tle92466ed::ChannelMode::DirectDriveDrv0 = 3 ,
  tle92466ed::ChannelMode::DirectDriveDrv1 = 4 , tle92466ed::ChannelMode::Measurement = 5
}
 How a channel drives its output (MODE.CH_MODE, section 5.3.3.11). More...
 
enum class  tle92466ed::SlewRate : uint8_t { tle92466ed::SlewRate::VPerUs1 = 0 , tle92466ed::SlewRate::VPerUs2p5 = 1 , tle92466ed::SlewRate::VPerUs5 = 2 , tle92466ed::SlewRate::VPerUs10 = 3 }
 Output current slew rate (CH_CONFIG.SLEWR, Table 13). More...
 
enum class  tle92466ed::DiagCurrent : uint8_t { tle92466ed::DiagCurrent::Ua80 = 0 , tle92466ed::DiagCurrent::Ua190 = 1 , tle92466ed::DiagCurrent::Ua720 = 2 , tle92466ed::DiagCurrent::Ua1250 = 3 }
 OFF-state diagnosis current I_HS, I_LS (CH_CONFIG.I_DIAG, Table 15). More...
 
enum class  tle92466ed::OffStateDiag : uint8_t { tle92466ed::OffStateDiag::Enabled = 0 , tle92466ed::OffStateDiag::LowSideSource = 1 , tle92466ed::OffStateDiag::HighSideSource = 2 , tle92466ed::OffStateDiag::Disabled = 3 }
 OFF-state diagnosis current sources (CH_CONFIG.OFF_DIAG_CH, section 4.9.1). More...
 
enum class  tle92466ed::FastFeedback : uint8_t { tle92466ed::FastFeedback::DitherPeriod = 0 , tle92466ed::FastFeedback::HalfPeriod = 1 , tle92466ed::FastFeedback::QuarterPeriod = 2 }
 Feedback update interval (DITHER_CTRL.FAST_MEAS, section 4.10.3). More...
 
enum class  tle92466ed::VioLevel : uint8_t { tle92466ed::VioLevel::V3V3 = 0 , tle92466ed::VioLevel::V5V0 = 1 }
 The level of VIO, the SPI output supply (GLOBAL_CONFIG.VIO_SEL, section 4.1.1). More...
 
enum class  tle92466ed::ClockSource : uint8_t { tle92466ed::ClockSource::Internal = 0 , tle92466ed::ClockSource::External = 1 }
 Where the PLL takes its reference (CLK_DIV.EXT_CLK, section 4.2.1). More...
 
enum class  tle92466ed::GlobalFault : uint8_t {
  tle92466ed::GlobalFault::VbatUndervoltage = 0x00U , tle92466ed::GlobalFault::VbatOvervoltage = 0x01U , tle92466ed::GlobalFault::VioUndervoltage = 0x02U , tle92466ed::GlobalFault::VioOvervoltage = 0x03U ,
  tle92466ed::GlobalFault::VddUndervoltage = 0x04U , tle92466ed::GlobalFault::VddOvervoltage = 0x05U , tle92466ed::GlobalFault::ClockFault = 0x06U , tle92466ed::GlobalFault::CentralOtError = 0x07U ,
  tle92466ed::GlobalFault::CentralOtWarning = 0x08U , tle92466ed::GlobalFault::SpiWatchdog = 0x0EU , tle92466ed::GlobalFault::BiasCurrentLow = 0x10U , tle92466ed::GlobalFault::BiasCurrentHigh = 0x11U ,
  tle92466ed::GlobalFault::Supply2v5Low = 0x12U , tle92466ed::GlobalFault::Supply2v5High = 0x13U , tle92466ed::GlobalFault::ReferenceLow = 0x14U , tle92466ed::GlobalFault::ReferenceHigh = 0x15U ,
  tle92466ed::GlobalFault::PreRegulatorHigh = 0x16U , tle92466ed::GlobalFault::MonitorAdc = 0x1FU , tle92466ed::GlobalFault::RegisterEcc = 0x21U , tle92466ed::GlobalFault::OtpEcc = 0x23U ,
  tle92466ed::GlobalFault::OtpVirgin = 0x24U
}
 Global faults, each named by its register (bits 7..4: 0 GLOBAL_DIAG0, 1 GLOBAL_DIAG1, 2 GLOBAL_DIAG2) and bit (bits 3..0), so Faults::Has() needs no table (sections 5.3.2.5 to 5.3.2.7). More...
 

Functions

constexpr const char * tle92466ed::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr Error tle92466ed::Validate (const Config &config) noexcept
 Check a configuration without touching the chip.
 
constexpr ChannelConfig tle92466ed::CurrentControlChannel () noexcept
 A starting point for one current-controlled channel with feedback: ICC, a 1 kHz PWM target (PERIOD_MANT 219, PERIOD_EXP 7), MIN_INT_THRESH 2 (above 1, section 4.6.2.4), a 1 ms dither reference clock with no dither amplitude so the averaged feedback updates every millisecond (sections 4.4.2, 4.7.1), and the reset values elsewhere. Tune it to the load.
 
void tle92466ed::ConfigIsInvalid () noexcept
 Reached only when a CheckedConfig is built from an invalid configuration: it is never defined, so the build fails and names it (KB-CPP20-013).
 
constexpr const char * tle92466ed::GetDriverVersion () noexcept
 
constexpr uint32_t tle92466ed::GetDriverVersionMajor () noexcept
 
constexpr uint32_t tle92466ed::GetDriverVersionMinor () noexcept
 
constexpr uint32_t tle92466ed::GetDriverVersionPatch () noexcept
 

Variables

constexpr uint32_t tle92466ed::kChannelCount = 6U
 Number of output channels (section 4.5.1).
 
constexpr uint32_t tle92466ed::kPairCount = 3U
 Number of parallel pairs.
 

Limits and timing (datasheet sections 3.2, 4.1.3, 4.6.3, 5.1.4)

constexpr uint32_t tle92466ed::kMaxSetpointUa = 1'500'000U
 Highest DC setpoint of one channel, in microamps (Table 14, I_set).
 
constexpr uint32_t tle92466ed::kMaxSetpointWithDitherUa = 1'800'000U
 Highest setpoint plus dither amplitude of one channel (Table 14, I_set + I_Dither).
 
constexpr uint32_t tle92466ed::kParallelMeasurementRangeUa = 2'700'000U
 
constexpr uint32_t tle92466ed::kMaxParallelSetpointUa = (kParallelMeasurementRangeUa / 10U) * 9U
 
constexpr uint32_t tle92466ed::kSetpointFullScaleUa = 2'000'000U
 Full scale of TARGET, one channel: I_set = 2 A * TARGET / (2^15 - 1) (5.3.3.3).
 
constexpr uint32_t tle92466ed::kParallelFullScaleUa = 4'000'000U
 Full scale of TARGET in a parallel pair: the LSB doubles (4.5.2).
 
constexpr uint32_t tle92466ed::kTargetMax = 32767U
 Largest TARGET value, 2^15 - 1.
 
constexpr uint32_t tle92466ed::kInternalClockHz = 28'000'000U
 f_SYS of the internal oscillator, typical (Table 6).
 
constexpr uint32_t tle92466ed::kMinSystemClockHz = 27'500'000U
 Lowest f_SYS (Table 6).
 
constexpr uint32_t tle92466ed::kMaxSystemClockHz = 28'500'000U
 Highest f_SYS (Table 6).
 
constexpr uint32_t tle92466ed::kMinPwmHz = 110U
 Lowest PWM frequency of the frequency controller, f_PWM min (Table 6).
 
constexpr uint32_t tle92466ed::kMaxPwmHz = 4000U
 Highest PWM frequency, f_PWM max (Table 6).
 
constexpr uint16_t tle92466ed::kMaxWatchdogReload = 2047U
 Largest WD_TIME, an 11-bit field (5.3.2.11).
 
constexpr uint16_t tle92466ed::kMinWatchdogReload = 9U
 
constexpr uint32_t tle92466ed::kWatchdogDivider = 16384U
 The SPI watchdog counts f_SYS / 2^14 (Table 18).
 
constexpr uint32_t tle92466ed::kMaxOcOnTimeUs = 300'000U
 Longest OFF-state overcurrent on-time t_OCon (TON register note, 5.3.3.12), microseconds.
 
constexpr uint32_t tle92466ed::kResetReleaseUs = 100U
 Logic ready after RESN released, t_RESN max (Table 9).
 
constexpr uint32_t tle92466ed::kPowerOnResetUs = 10'000U
 Logic ready after a power-on reset, t_POR max (Table 9).
 
constexpr uint32_t tle92466ed::kResetPulseUs = 1000U
 
constexpr uint32_t tle92466ed::kPollIntervalUs = 100U
 Interval of the INIT_DONE and self-test polls.
 
constexpr uint32_t tle92466ed::kMinInitTimeoutUs = 100U
 Shortest Config::init_timeout_us.
 
constexpr uint32_t tle92466ed::kMaxInitTimeoutUs = 100'000U
 Longest Config::init_timeout_us.
 
constexpr uint32_t tle92466ed::kBistTimeoutUs = 10'000U
 
constexpr uint8_t tle92466ed::kMaxRetries = 3U
 Highest Config::max_retries.
 
constexpr uint8_t tle92466ed::kManufacturerId = 0xC1U
 ICVID.MANUFACTURER of every TLE92466ED (5.3.2.19).
 
constexpr uint8_t tle92466ed::kVersionA11 = 0xFCU
 ICVID.VERSION of design step A11.
 
constexpr uint8_t tle92466ed::kVersionA13 = 0xFEU
 ICVID.VERSION of design step A13.
 

Conversions (constexpr, proved below with the datasheet's own numbers)

constexpr uint32_t tle92466ed::SystemClockHz (const Config &config) noexcept
 f_SYS for a configuration: 28 MHz from the internal oscillator, else f_CLK * PLL_FBDIV / (2 * PLL_REFDIV) (Equation 2).
 
constexpr uint32_t tle92466ed::PllRefDiv (uint32_t khz) noexcept
 PLL_REFDIV for an external clock: f_CLK / 1 MHz, rounded down as in Table 10.
 
constexpr uint32_t tle92466ed::PllFbDiv (uint32_t khz) noexcept
 PLL_FBDIV for an external clock: 56 MHz * PLL_REFDIV / f_CLK, rounded to the nearest as in Table 10 (Equation 3).
 
constexpr uint32_t tle92466ed::TargetFromMicroamps (uint32_t microamps, bool parallel) noexcept
 The TARGET count of a current, rounded to the nearest (section 5.3.3.3).
 
constexpr uint32_t tle92466ed::MicroampsFromTarget (uint32_t target, bool parallel) noexcept
 The current a TARGET count programs, rounded to the nearest microamp.
 
constexpr uint32_t tle92466ed::DitherAmplitudeUa (const DitherConfig &dither, bool parallel) noexcept
 The dither amplitude I_Dither = STEPS * STEP_SIZE * full scale / (2^15 - 1) (Equation 6).
 
constexpr uint32_t tle92466ed::PwmFrequencyHz (const IccConfig &icc, uint32_t system_hz) noexcept
 The PWM frequency the controller is set to: f_SYS / (PERIOD_MANT * 2^PERIOD_EXP), times 1/8 in the low range (Equations 4, 5).
 
constexpr Result< uint16_t > tle92466ed::WatchdogReloadCode (uint32_t timeout_ms, uint32_t system_hz) noexcept
 WD_TIME for a watchdog timeout: rounddown(t_SPI_WD * f_SYS / 2^14) (5.3.2.11).
 
constexpr Result< uint8_t > tle92466ed::VbatThresholdCode (uint32_t millivolts) noexcept
 VBAT_UV_TH or VBAT_OV_TH for a threshold voltage, 162.08 mV per count, rounded to the nearest (Equation 1).
 

Detailed Description

Errors, results, configuration and decoded values.

Enumeration Type Documentation

◆ Channel

enum class tle92466ed::Channel : uint8_t
strong

One of the six output channels.

Enumerator
Ch0 

LOAD0. Master of the CH0/CH3 pair.

Ch1 

LOAD1. Master of the CH1/CH2 pair.

Ch2 

LOAD2. Slave of the CH1/CH2 pair.

Ch3 

LOAD3. Slave of the CH0/CH3 pair.

Ch4 

LOAD4. Master of the CH4/CH5 pair.

Ch5 

LOAD5. Slave of the CH4/CH5 pair.

◆ ChannelMode

enum class tle92466ed::ChannelMode : uint8_t
strong

How a channel drives its output (MODE.CH_MODE, section 5.3.3.11).

Enumerator
Off 

Output off, no measurement. Reset value.

CurrentControl 

ICC: the integrating current controller holds the setpoint (4.6.2).

DirectDriveSpi 

On-time on_time_mant per dither period, from SPI (4.8.1).

DirectDriveDrv0 

The output follows the DRV0 pin (4.8.1).

DirectDriveDrv1 

The output follows the DRV1 pin (4.8.1).

Measurement 

Free-running measurement, switch off (4.4.3); CH_MODE = CH.

◆ ClockSource

enum class tle92466ed::ClockSource : uint8_t
strong

Where the PLL takes its reference (CLK_DIV.EXT_CLK, section 4.2.1).

Enumerator
Internal 

The internal oscillator; the dividers are ignored. Reset value.

External 

The CLK pin, Config::external_clock_khz.

◆ DiagCurrent

enum class tle92466ed::DiagCurrent : uint8_t
strong

OFF-state diagnosis current I_HS, I_LS (CH_CONFIG.I_DIAG, Table 15).

Enumerator
Ua80 

80 uA typical. Reset value.

Ua190 

190 uA typical.

Ua720 

720 uA typical.

Ua1250 

1250 uA typical.

◆ Error

enum class tle92466ed::Error : uint8_t
strong

Why a call failed. Every call of the driver returns one of these in its Result.

Values 0 to 9 are the shared base set; chip-specific values start at 16. [[nodiscard]] on the type: a function that returns a bare Error cannot have it ignored either (KB-CPP20-037).

Enumerator
Ok 

The call succeeded.

NotInitialized 

EnsureInitialized() has not succeeded, Deinitialize() ran since, or the chip was found reset (UnexpectedReset).

InvalidArgument 

An argument or a Config field is out of range; nothing was sent.

Bus 

A port hook (Transfer(), EnsureInitialized(), GpioSet(), GpioRead()) returned false.

Timeout 

INIT_DONE did not read 1 within Config::init_timeout_us (section 4.2.1), or the self-test did not finish (section 4.9.8).

DeviceIdMismatch 

ICVID is not manufacturer 0xC1 with a known version (5.3.2.19).

Crc 

A reply's CRC-8 was wrong, or the chip reported a wrong CRC in the driver's frame (status 00010B, sections 5.1.2 and 5.2.3.3).

Busy 

Not returned by this driver: the chip is never busy to SPI.

DeviceFault 

The chip reports damage: OTP_VIRGIN set at start-up (4.9.7), or an internal bus fault in a reply's status (5.2.3.3).

Unsupported 

The port lacks the optional hook this call needs (GpioSet(), GpioRead()).

NoDevice 

MISO read all zeros, all ones or the frame just sent: nothing drives SO (no chip, no VIO, a loose wire) or MOSI is looped back.

CriticalFault 

The chip answered with a critical fault frame (5.2.3.5), twice in a row: it is in the Critical Fault state; GetLastCriticalFault() has the flags. EN is driven low and the driver is uninitialised: only a power-on reset or RESN leaves that state (Figure 4).

ReplyMismatch 

A reply with a valid CRC that does not answer the request: wrong reply mode or width, wrong R/W echo, or the anchor read did not answer as expected (a frame lost or added on the bus).

FrameRejected 

The chip reported an SPI frame error or a write to a read-only register in its reply status (5.2.3.3); the frame was ignored.

WrongState 

The call needs the other operation state (Config Mode or Mission Mode, section 4.3.1), or the channel is the slave of a parallel pair, or it depends on a register an earlier failed write may have changed (docs/contract.md, "Ambiguous writes"). Nothing was sent.

MissionBlocked 

EnterMissionMode() found a fault that keeps the chip in Config Mode (Figure 4) or INIT_DONE = 0, or the chip refused OP_MODE; or an enable found the chip back in Config Mode on its own.

WriteMismatch 

A register read back differs from what was written: at start-up, or with Verify::ReadBack. The chip did not take the write.

NotReady 

No feedback to report: no new values (FB_UPD = 0) or no measurement period (TP_MANT = 0, section 4.10.2).

UnexpectedReset 

The chip reset since the start (POR_event or RES_event in FB_STAT, section 4.1.1). EN is driven low and the driver is uninitialised.

◆ FastFeedback

enum class tle92466ed::FastFeedback : uint8_t
strong

Feedback update interval (DITHER_CTRL.FAST_MEAS, section 4.10.3).

Enumerator
DitherPeriod 

One update per dither period. Reset value.

HalfPeriod 

n_meas_sample = 2.

QuarterPeriod 

n_meas_sample = 4.

◆ GlobalFault

enum class tle92466ed::GlobalFault : uint8_t
strong

Global faults, each named by its register (bits 7..4: 0 GLOBAL_DIAG0, 1 GLOBAL_DIAG1, 2 GLOBAL_DIAG2) and bit (bits 3..0), so Faults::Has() needs no table (sections 5.3.2.5 to 5.3.2.7).

Enumerator
VbatUndervoltage 

GLOBAL_DIAG0.VBAT_UV.

VbatOvervoltage 

GLOBAL_DIAG0.VBAT_OV.

VioUndervoltage 

GLOBAL_DIAG0.VIO_UV.

VioOvervoltage 

GLOBAL_DIAG0.VIO_OV.

VddUndervoltage 

GLOBAL_DIAG0.VDD_UV.

VddOvervoltage 

GLOBAL_DIAG0.VDD_OV.

ClockFault 

GLOBAL_DIAG0.CLK_NOK.

CentralOtError 

GLOBAL_DIAG0.COTERR.

CentralOtWarning 

GLOBAL_DIAG0.COTWARN.

SpiWatchdog 

GLOBAL_DIAG0.SPI_WD_ERR.

BiasCurrentLow 

GLOBAL_DIAG1.VR_IREF_UV.

BiasCurrentHigh 

GLOBAL_DIAG1.VR_IREF_OV.

Supply2v5Low 

GLOBAL_DIAG1.VDD2V5_UV.

Supply2v5High 

GLOBAL_DIAG1.VDD2V5_OV.

ReferenceLow 

GLOBAL_DIAG1.REF_UV.

ReferenceHigh 

GLOBAL_DIAG1.REF_OV.

PreRegulatorHigh 

GLOBAL_DIAG1.VPRE_OV.

MonitorAdc 

GLOBAL_DIAG1.HVADC_ERR.

RegisterEcc 

GLOBAL_DIAG2.REG_ECC_ERR.

OtpEcc 

GLOBAL_DIAG2.OTP_ECC_ERR.

OtpVirgin 

GLOBAL_DIAG2.OTP_VIRGIN.

◆ LogLevel

enum class tle92466ed::LogLevel : uint8_t
strong

Severity passed to the optional Log() hook.

Enumerator
Error 

A call failed.

Warning 

Something unexpected that the driver recovered from.

Info 

Lifecycle events: initialised, reset.

Debug 

Detail for bring-up.

◆ OffStateDiag

enum class tle92466ed::OffStateDiag : uint8_t
strong

OFF-state diagnosis current sources (CH_CONFIG.OFF_DIAG_CH, section 4.9.1).

Enumerator
Enabled 

The OL/SG sequence of Figure 15 runs. Reset value.

LowSideSource 

Only I_LS on.

HighSideSource 

Only I_HS on.

Disabled 

No OFF-state diagnosis.

◆ ParallelPair

enum class tle92466ed::ParallelPair : uint8_t
strong

The channel pairs that can drive one load together (section 4.5.2).

Enumerator
Ch0Ch3 

CH0 master, CH3 slave (CH_CTRL.CH_PAR_0_3).

Ch1Ch2 

CH1 master, CH2 slave (CH_CTRL.CH_PAR_1_2).

Ch4Ch5 

CH4 master, CH5 slave (CH_CTRL.CH_PAR_4_5).

◆ SlewRate

enum class tle92466ed::SlewRate : uint8_t
strong

Output current slew rate (CH_CONFIG.SLEWR, Table 13).

Enumerator
VPerUs1 

1 V/us typical.

VPerUs2p5 

2.5 V/us typical.

VPerUs5 

5 V/us typical.

VPerUs10 

10 V/us typical. Reset value.

◆ Verify

enum class tle92466ed::Verify : uint8_t
strong

Extra traffic a setter may spend to confirm its write (handbook KB-ARCH-041).

Enumerator
None 

No extra frame and no compare. The default.

ReadBack 

Read the written register back (two more frames) and compare it.

◆ VioLevel

enum class tle92466ed::VioLevel : uint8_t
strong

The level of VIO, the SPI output supply (GLOBAL_CONFIG.VIO_SEL, section 4.1.1).

Enumerator
V3V3 

3.3 V: VIO monitored against the 3.3 V thresholds (Table 9).

V5V0 

5.0 V. Reset value.

Function Documentation

◆ CurrentControlChannel()

constexpr ChannelConfig tle92466ed::CurrentControlChannel ( )
constexprnoexcept

A starting point for one current-controlled channel with feedback: ICC, a 1 kHz PWM target (PERIOD_MANT 219, PERIOD_EXP 7), MIN_INT_THRESH 2 (above 1, section 4.6.2.4), a 1 ms dither reference clock with no dither amplitude so the averaged feedback updates every millisecond (sections 4.4.2, 4.7.1), and the reset values elsewhere. Tune it to the load.

Returns
The channel configuration, declared loaded.

◆ DitherAmplitudeUa()

constexpr uint32_t tle92466ed::DitherAmplitudeUa ( const DitherConfig &  dither,
bool  parallel 
)
constexprnoexcept

The dither amplitude I_Dither = STEPS * STEP_SIZE * full scale / (2^15 - 1) (Equation 6).

Parameters
ditherThe dither settings.
paralleltrue for a parallel pair (the TARGET LSB doubles).
Returns
The amplitude in microamps.

◆ GetDriverVersion()

constexpr const char * tle92466ed::GetDriverVersion ( )
constexprnoexcept
Returns
The driver version, e.g. "0.1.0", from the generated tle92466ed_version.h. No I/O.

◆ GetDriverVersionMajor()

constexpr uint32_t tle92466ed::GetDriverVersionMajor ( )
constexprnoexcept
Returns
The major version. No I/O.

◆ GetDriverVersionMinor()

constexpr uint32_t tle92466ed::GetDriverVersionMinor ( )
constexprnoexcept
Returns
The minor version. No I/O.

◆ GetDriverVersionPatch()

constexpr uint32_t tle92466ed::GetDriverVersionPatch ( )
constexprnoexcept
Returns
The patch version. No I/O.

◆ MicroampsFromTarget()

constexpr uint32_t tle92466ed::MicroampsFromTarget ( uint32_t  target,
bool  parallel 
)
constexprnoexcept

The current a TARGET count programs, rounded to the nearest microamp.

Parameters
targetTARGET, 0 to kTargetMax.
paralleltrue for a parallel pair.
Returns
The current in microamps.

◆ PllFbDiv()

constexpr uint32_t tle92466ed::PllFbDiv ( uint32_t  khz)
constexprnoexcept

PLL_FBDIV for an external clock: 56 MHz * PLL_REFDIV / f_CLK, rounded to the nearest as in Table 10 (Equation 3).

Parameters
khzf_CLK in kilohertz, at least 1000.
Returns
The divider; 0 for khz = 0.

◆ PllRefDiv()

constexpr uint32_t tle92466ed::PllRefDiv ( uint32_t  khz)
constexprnoexcept

PLL_REFDIV for an external clock: f_CLK / 1 MHz, rounded down as in Table 10.

Parameters
khzf_CLK in kilohertz.
Returns
The divider.

◆ PwmFrequencyHz()

constexpr uint32_t tle92466ed::PwmFrequencyHz ( const IccConfig &  icc,
uint32_t  system_hz 
)
constexprnoexcept

The PWM frequency the controller is set to: f_SYS / (PERIOD_MANT * 2^PERIOD_EXP), times 1/8 in the low range (Equations 4, 5).

Parameters
iccThe controller settings.
system_hzf_SYS.
Returns
The frequency in hertz, rounded down; 0 when PERIOD_MANT = 0 (controller off).

◆ SystemClockHz()

constexpr uint32_t tle92466ed::SystemClockHz ( const Config &  config)
constexprnoexcept

f_SYS for a configuration: 28 MHz from the internal oscillator, else f_CLK * PLL_FBDIV / (2 * PLL_REFDIV) (Equation 2).

Parameters
configThe configuration.
Returns
f_SYS in hertz; 0 for an external clock outside 1 to 8 MHz.

◆ TargetFromMicroamps()

constexpr uint32_t tle92466ed::TargetFromMicroamps ( uint32_t  microamps,
bool  parallel 
)
constexprnoexcept

The TARGET count of a current, rounded to the nearest (section 5.3.3.3).

Parameters
microampsThe current.
paralleltrue for a parallel pair (4 A full scale).
Returns
TARGET; saturates at kTargetMax.

◆ ToString()

constexpr const char * tle92466ed::ToString ( Error  error)
constexprnoexcept

The name of an error, for logs.

Parameters
errorThe error.
Returns
A static string such as "Timeout"; "Unknown" for a value that is not an enumerator.

◆ Validate()

constexpr Error tle92466ed::Validate ( const Config &  config)
constexprnoexcept

Check a configuration without touching the chip.

Fails when an enumeration holds a value that is not an enumerator, a field does not fit its register, WD_TIME is 0 or above 2047, VBAT_UV_TH is not below VBAT_OV_TH, f_SYS of an external clock is outside 27.5 to 28.5 MHz (Table 6) or not a 500 kHz step of 1 to 8 MHz (Table 10), a PWM target is outside 110 to 4000 Hz (Table 6), AUTO_LIM_VALUE_ABS is not above MIN_INT_THRESH + 3 (4.6.2.3), fast feedback has FLAT of 2 or less (4.10.3), a relative open-load threshold is set outside current control (4.9.2.1), the slave of an enabled pair is declared loaded, or a driver setting is outside its range.

Parameters
configThe configuration.
Returns
Error::Ok or Error::InvalidArgument.

◆ VbatThresholdCode()

constexpr Result< uint8_t > tle92466ed::VbatThresholdCode ( uint32_t  millivolts)
constexprnoexcept

VBAT_UV_TH or VBAT_OV_TH for a threshold voltage, 162.08 mV per count, rounded to the nearest (Equation 1).

Parameters
millivoltsThe threshold.
Returns
The code, or InvalidArgument above 255 counts (41.3 V).

◆ WatchdogReloadCode()

constexpr Result< uint16_t > tle92466ed::WatchdogReloadCode ( uint32_t  timeout_ms,
uint32_t  system_hz 
)
constexprnoexcept

WD_TIME for a watchdog timeout: rounddown(t_SPI_WD * f_SYS / 2^14) (5.3.2.11).

Parameters
timeout_msThe timeout.
system_hzf_SYS, kInternalClockHz unless an external clock is used.
Returns
The code, or InvalidArgument when it would be 0 or above kMaxWatchdogReload.

Variable Documentation

◆ kBistTimeoutUs

constexpr uint32_t tle92466ed::kBistTimeoutUs = 10'000U
inlineconstexpr

Longest wait for SMU_SLF_TST_DONE. The datasheet gives no duration; 10 ms is the design value (not verified on hardware).

◆ kMaxParallelSetpointUa

constexpr uint32_t tle92466ed::kMaxParallelSetpointUa = (kParallelMeasurementRangeUa / 10U) * 9U
inlineconstexpr

Highest setpoint plus dither amplitude of a parallel pair. Table 14 gives 2.7 A including the overshoot; the driver keeps the single-channel headroom (1.8 A of the 2.0 A range, 90 %), so 2.43 A. A design decision, not verified on hardware.

◆ kMinWatchdogReload

constexpr uint16_t tle92466ed::kMinWatchdogReload = 9U
inlineconstexpr

Smallest WD_TIME with the SPI watchdog on: 9 counts, 5.3 ms at 28 MHz, so the application's first ReloadWatchdog() after the start can arrive. A design decision: the reset value 1 (0.585 ms) would expire before any caller could reload it.

◆ kParallelMeasurementRangeUa

constexpr uint32_t tle92466ed::kParallelMeasurementRangeUa = 2'700'000U
inlineconstexpr

Measurement range of a parallel pair, setpoint, dither and overshoot included (Table 14, I_LOADx,y,par).

◆ kResetPulseUs

constexpr uint32_t tle92466ed::kResetPulseUs = 1000U
inlineconstexpr

RESN low time of a reset pulse. The datasheet gives no minimum; 1 ms is the design value (not verified on hardware: bench step in docs/hardware.md).