TLE92466ED Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
tle92466ed_types.hpp File Reference

Public types of the TLE92466ED driver: errors, Result<T>, configuration, decoded status and feedback, and the unit conversions. More...

#include <array>
#include <cstdint>
#include "tle92466ed_detail.hpp"
#include "tle92466ed_version.h"

Go to the source code of this file.

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...
 

Namespaces

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

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
 
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).
 

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.
 

Detailed Description

Public types of the TLE92466ED driver: errors, Result<T>, configuration, decoded status and feedback, and the unit conversions.

Everything here is plain data with no platform dependency, so handlers, tests and tools can include it without the driver template. The configuration defaults are the chip's reset values (TLE92466ED datasheet Rev. 1.2, section 5.3), so Config{} describes a chip that was just reset. Section numbers below refer to that datasheet.