TLE92466ED Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Namespaces | Classes | Concepts | Enumerations | Functions | Variables
tle92466ed Namespace Reference

The TLE92466ED driver: everything it declares lives here; internals in detail. More...

Namespaces

namespace  reg
 The TLE92466ED register map.
 

Classes

struct  BistResult
 The result of the safety flip-flop self-test (SFF_BIST, section 4.9.8). More...
 
struct  BusDiagnostics
 Counters of the protocol layer (handbook KB-ARCH-044). No I/O to read them. More...
 
struct  ChannelConfig
 Everything the driver writes for one channel. Defaults are the reset values. More...
 
struct  ChannelFaults
 The faults and warnings of one channel, decoded (sections 5.3.2.12, 5.3.2.13). More...
 
struct  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...
 
class  CheckedConfig
 A configuration proven valid at build time. More...
 
struct  ChipId
 The unique chip identification, CHIPID0..2 (sections 5.3.2.24 to 5.3.2.26). More...
 
struct  Config
 Everything EnsureInitialized() writes to the chip, and the driver's own settings. More...
 
struct  DeviceStatus
 FB_STAT, the chip's one-word status summary, decoded (section 5.3.2.21). More...
 
struct  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  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  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  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  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  PinStatus
 PIN_STAT, decoded (section 5.3.2.20). More...
 
struct  Result
 The value of a call, or why there is none. More...
 
struct  Result< void >
 The result of a call that returns no value. More...
 
class  SpiInterface
 CRTP base of the platform SPI port. More...
 
struct  SupplyReadings
 The supply and temperature feedback (FB_VOLTAGE1, FB_VOLTAGE2; 5.3.2.22, 5.3.2.23). More...
 
class  TLE92466ED
 Driver for one TLE92466ED on a platform port. More...
 

Concepts

concept  SpiPort
 Satisfied by a class that derives from SpiInterface<Port> and implements the required hooks with exactly the types above, noexcept and returning bool.
 

Enumerations

enum class  CtrlPin : uint8_t {
  Reset = 0 , Enable = 1 , Drv0 = 2 , Drv1 = 3 ,
  Fault = 4
}
 The chip's control pins the port drives (GpioSet) or reads (GpioRead). More...
 
enum class  GpioSignal : uint8_t { INACTIVE = 0 , ACTIVE = 1 }
 Logical level of a control pin; the port maps it to the physical polarity. More...
 
enum class  Error : uint8_t {
  Error::Ok = 0 , Error::NotInitialized = 1 , Error::InvalidArgument = 2 , Error::Bus = 3 ,
  Error::Timeout = 4 , Error::DeviceIdMismatch = 5 , Error::Crc = 6 , Error::Busy = 7 ,
  Error::DeviceFault = 8 , Error::Unsupported = 9 , Error::NoDevice = 16 , Error::CriticalFault = 17 ,
  Error::ReplyMismatch = 18 , Error::FrameRejected = 19 , Error::WrongState = 20 , Error::MissionBlocked = 21 ,
  Error::WriteMismatch = 22 , Error::NotReady = 23 , Error::UnexpectedReset = 24
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  LogLevel : uint8_t { LogLevel::Error = 0 , LogLevel::Warning , LogLevel::Info , LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  Verify : uint8_t { Verify::None = 0 , Verify::ReadBack = 1 }
 Extra traffic a setter may spend to confirm its write (handbook KB-ARCH-041). More...
 
enum class  Channel : uint8_t {
  Channel::Ch0 = 0 , Channel::Ch1 = 1 , Channel::Ch2 = 2 , Channel::Ch3 = 3 ,
  Channel::Ch4 = 4 , Channel::Ch5 = 5
}
 One of the six output channels. More...
 
enum class  ParallelPair : uint8_t { ParallelPair::Ch0Ch3 = 0 , ParallelPair::Ch1Ch2 = 1 , ParallelPair::Ch4Ch5 = 2 }
 The channel pairs that can drive one load together (section 4.5.2). More...
 
enum class  ChannelMode : uint8_t {
  ChannelMode::Off = 0 , ChannelMode::CurrentControl = 1 , ChannelMode::DirectDriveSpi = 2 , ChannelMode::DirectDriveDrv0 = 3 ,
  ChannelMode::DirectDriveDrv1 = 4 , ChannelMode::Measurement = 5
}
 How a channel drives its output (MODE.CH_MODE, section 5.3.3.11). More...
 
enum class  SlewRate : uint8_t { SlewRate::VPerUs1 = 0 , SlewRate::VPerUs2p5 = 1 , SlewRate::VPerUs5 = 2 , SlewRate::VPerUs10 = 3 }
 Output current slew rate (CH_CONFIG.SLEWR, Table 13). More...
 
enum class  DiagCurrent : uint8_t { DiagCurrent::Ua80 = 0 , DiagCurrent::Ua190 = 1 , DiagCurrent::Ua720 = 2 , DiagCurrent::Ua1250 = 3 }
 OFF-state diagnosis current I_HS, I_LS (CH_CONFIG.I_DIAG, Table 15). More...
 
enum class  OffStateDiag : uint8_t { OffStateDiag::Enabled = 0 , OffStateDiag::LowSideSource = 1 , OffStateDiag::HighSideSource = 2 , OffStateDiag::Disabled = 3 }
 OFF-state diagnosis current sources (CH_CONFIG.OFF_DIAG_CH, section 4.9.1). More...
 
enum class  FastFeedback : uint8_t { FastFeedback::DitherPeriod = 0 , FastFeedback::HalfPeriod = 1 , FastFeedback::QuarterPeriod = 2 }
 Feedback update interval (DITHER_CTRL.FAST_MEAS, section 4.10.3). More...
 
enum class  VioLevel : uint8_t { VioLevel::V3V3 = 0 , VioLevel::V5V0 = 1 }
 The level of VIO, the SPI output supply (GLOBAL_CONFIG.VIO_SEL, section 4.1.1). More...
 
enum class  ClockSource : uint8_t { ClockSource::Internal = 0 , ClockSource::External = 1 }
 Where the PLL takes its reference (CLK_DIV.EXT_CLK, section 4.2.1). More...
 
enum class  GlobalFault : uint8_t {
  GlobalFault::VbatUndervoltage = 0x00U , GlobalFault::VbatOvervoltage = 0x01U , GlobalFault::VioUndervoltage = 0x02U , GlobalFault::VioOvervoltage = 0x03U ,
  GlobalFault::VddUndervoltage = 0x04U , GlobalFault::VddOvervoltage = 0x05U , GlobalFault::ClockFault = 0x06U , GlobalFault::CentralOtError = 0x07U ,
  GlobalFault::CentralOtWarning = 0x08U , GlobalFault::SpiWatchdog = 0x0EU , GlobalFault::BiasCurrentLow = 0x10U , GlobalFault::BiasCurrentHigh = 0x11U ,
  GlobalFault::Supply2v5Low = 0x12U , GlobalFault::Supply2v5High = 0x13U , GlobalFault::ReferenceLow = 0x14U , GlobalFault::ReferenceHigh = 0x15U ,
  GlobalFault::PreRegulatorHigh = 0x16U , GlobalFault::MonitorAdc = 0x1FU , GlobalFault::RegisterEcc = 0x21U , GlobalFault::OtpEcc = 0x23U ,
  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 Config KconfigDefaults () noexcept
 The configuration menuconfig selected, on top of the datasheet defaults.
 
constexpr const char * ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr Error Validate (const Config &config) noexcept
 Check a configuration without touching the chip.
 
constexpr ChannelConfig 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 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 * GetDriverVersion () noexcept
 
constexpr uint32_t GetDriverVersionMajor () noexcept
 
constexpr uint32_t GetDriverVersionMinor () noexcept
 
constexpr uint32_t GetDriverVersionPatch () noexcept
 
Conversions (constexpr, proved below with the datasheet's own numbers)
constexpr uint32_t 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 PllRefDiv (uint32_t khz) noexcept
 PLL_REFDIV for an external clock: f_CLK / 1 MHz, rounded down as in Table 10.
 
constexpr uint32_t 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 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 MicroampsFromTarget (uint32_t target, bool parallel) noexcept
 The current a TARGET count programs, rounded to the nearest microamp.
 
constexpr uint32_t 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 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 > 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 > 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).
 

Variables

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

What the TLE92466ED needs from the SPI bus (sections 5.1.1, 5.1.3, 5.2.1; Table 18). A port and a board configuration check their settings against these with static_assert (handbook KB-CPP-123).

constexpr uint8_t kSpiMode = 1
 
constexpr bool kMsbFirst = true
 Each frame is sent most significant bit first, on SI and SO alike (section 5.2.1).
 
constexpr uint32_t kMaxClockHz = 8'000'000
 Highest SCK frequency, f_SCK max (Table 18).
 
constexpr uint32_t kMinCsHighNs = 600
 Shortest CSN high time between two frames, t_CSN_TD (Table 18).
 
constexpr uint32_t kCsSetupNs = 250
 CSN falling edge to the first SCK rising edge, t_CSN_LEAD (Table 18).
 
constexpr uint32_t kCsHoldNs = 250
 Last SCK falling edge to CSN rising, t_CSN_LAG (Table 18).
 
constexpr bool kContinuousWord = false
 
constexpr std::size_t kFrameBytes = 4
 Bytes per transfer: one 32-bit frame per CSN low period (section 5.1.1).
 
Limits and timing (datasheet sections 3.2, 4.1.3, 4.6.3, 5.1.4)
constexpr uint32_t kMaxSetpointUa = 1'500'000U
 Highest DC setpoint of one channel, in microamps (Table 14, I_set).
 
constexpr uint32_t kMaxSetpointWithDitherUa = 1'800'000U
 Highest setpoint plus dither amplitude of one channel (Table 14, I_set + I_Dither).
 
constexpr uint32_t kParallelMeasurementRangeUa = 2'700'000U
 
constexpr uint32_t kMaxParallelSetpointUa = (kParallelMeasurementRangeUa / 10U) * 9U
 
constexpr uint32_t 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 kParallelFullScaleUa = 4'000'000U
 Full scale of TARGET in a parallel pair: the LSB doubles (4.5.2).
 
constexpr uint32_t kTargetMax = 32767U
 Largest TARGET value, 2^15 - 1.
 
constexpr uint32_t kInternalClockHz = 28'000'000U
 f_SYS of the internal oscillator, typical (Table 6).
 
constexpr uint32_t kMinSystemClockHz = 27'500'000U
 Lowest f_SYS (Table 6).
 
constexpr uint32_t kMaxSystemClockHz = 28'500'000U
 Highest f_SYS (Table 6).
 
constexpr uint32_t kMinPwmHz = 110U
 Lowest PWM frequency of the frequency controller, f_PWM min (Table 6).
 
constexpr uint32_t kMaxPwmHz = 4000U
 Highest PWM frequency, f_PWM max (Table 6).
 
constexpr uint16_t kMaxWatchdogReload = 2047U
 Largest WD_TIME, an 11-bit field (5.3.2.11).
 
constexpr uint16_t kMinWatchdogReload = 9U
 
constexpr uint32_t kWatchdogDivider = 16384U
 The SPI watchdog counts f_SYS / 2^14 (Table 18).
 
constexpr uint32_t kMaxOcOnTimeUs = 300'000U
 Longest OFF-state overcurrent on-time t_OCon (TON register note, 5.3.3.12), microseconds.
 
constexpr uint32_t kResetReleaseUs = 100U
 Logic ready after RESN released, t_RESN max (Table 9).
 
constexpr uint32_t kPowerOnResetUs = 10'000U
 Logic ready after a power-on reset, t_POR max (Table 9).
 
constexpr uint32_t kResetPulseUs = 1000U
 
constexpr uint32_t kPollIntervalUs = 100U
 Interval of the INIT_DONE and self-test polls.
 
constexpr uint32_t kMinInitTimeoutUs = 100U
 Shortest Config::init_timeout_us.
 
constexpr uint32_t kMaxInitTimeoutUs = 100'000U
 Longest Config::init_timeout_us.
 
constexpr uint32_t kBistTimeoutUs = 10'000U
 
constexpr uint8_t kMaxRetries = 3U
 Highest Config::max_retries.
 
constexpr uint8_t kManufacturerId = 0xC1U
 ICVID.MANUFACTURER of every TLE92466ED (5.3.2.19).
 
constexpr uint8_t kVersionA11 = 0xFCU
 ICVID.VERSION of design step A11.
 
constexpr uint8_t kVersionA13 = 0xFEU
 ICVID.VERSION of design step A13.
 

Detailed Description

The TLE92466ED driver: everything it declares lives here; internals in detail.

Enumeration Type Documentation

◆ CtrlPin

enum class tle92466ed::CtrlPin : uint8_t
strong

The chip's control pins the port drives (GpioSet) or reads (GpioRead).

Enumerator
Reset 

RESN, active low: ACTIVE holds the chip in reset (section 4.2.3).

Enable 

EN, active high: ACTIVE lets the channels switch (section 4.2.3).

Drv0 

DRV0, active high: the direct-drive input of channels in that mode.

Drv1 

DRV1, active high: as DRV0.

Fault 

FAULTN, open drain, active low on the pin: read only; ACTIVE while a fault is reported (section 4.2.3).

◆ GpioSignal

enum class tle92466ed::GpioSignal : uint8_t
strong

Logical level of a control pin; the port maps it to the physical polarity.

Enumerator
INACTIVE 

The pin function is deasserted.

ACTIVE 

The pin function is asserted.

Function Documentation

◆ KconfigDefaults()

constexpr Config tle92466ed::KconfigDefaults ( )
constexprnoexcept

The configuration menuconfig selected, on top of the datasheet defaults.

Returns
Config{} with VIO, the CRC check, the SPI watchdog, the clock and the driver's timing taken from Kconfig. A watchdog timeout out of range leaves WD_TIME at 0, which Validate() rejects.

Variable Documentation

◆ kContinuousWord

constexpr bool tle92466ed::kContinuousWord = false
inlineconstexpr

false: the datasheet sets no limit on idle SCK time inside a frame; the chip counts 32 clocks between the CSN edges (section 5.1.1).

◆ kSpiMode

constexpr uint8_t tle92466ed::kSpiMode = 1
inlineconstexpr

SPI mode 1: SCK idles low, SO changes on the rising edge and SI is sampled on the falling edge (section 5.1.1).