13#ifndef TLE92466ED_TYPES_HPP
14#define TLE92466ED_TYPES_HPP
20#include "tle92466ed_version.h"
37enum class [[nodiscard]]
Error : uint8_t {
92 return "NotInitialized";
94 return "InvalidArgument";
100 return "DeviceIdMismatch";
106 return "DeviceFault";
108 return "Unsupported";
112 return "CriticalFault";
114 return "ReplyMismatch";
116 return "FrameRejected";
120 return "MissionBlocked";
122 return "WriteMismatch";
126 return "UnexpectedReset";
146 [[nodiscard]]
constexpr bool ok() const noexcept {
147 return error == Error::Ok;
150 constexpr explicit operator bool() const noexcept {
160 return {v, Error::Ok};
178 [[nodiscard]]
constexpr bool ok() const noexcept {
179 return error == Error::Ok;
182 constexpr explicit operator bool() const noexcept {
399 std::array<ChannelConfig, kChannelCount>
channels{};
516 [[nodiscard]]
constexpr bool AnyError() const noexcept {
539 const auto code =
static_cast<uint32_t
>(detail::ToUnderlying(fault));
540 const uint32_t index = (code >> 4U) % 3U;
541 return ((
static_cast<uint32_t
>(
global[index]) >> (code & 0x0FU)) & 1U) != 0U;
550 const auto ch =
static_cast<uint32_t
>(detail::ToUnderlying(channel)) %
kChannelCount;
551 const uint32_t shift = 8U * (ch % 2U);
552 const uint32_t e = (
static_cast<uint32_t
>(
errors[ch / 2U]) >> shift) & 0xFFU;
553 const uint32_t w = (
static_cast<uint32_t
>(
warnings[ch / 2U]) >> shift) & 0xFFU;
555 f.
olsg = (e & 0x01U) != 0U;
556 f.open_load = (e & 0x02U) != 0U;
557 f.overcurrent = (e & 0x04U) != 0U;
558 f.short_to_ground = (e & 0x08U) != 0U;
559 f.overtemperature = (e & 0x10U) != 0U;
560 f.pwm_regulation = (w & 0x01U) != 0U;
561 f.current_regulation = (w & 0x02U) != 0U;
562 f.overtemperature_warning = (w & 0x04U) != 0U;
563 f.olsg_warning = (w & 0x08U) != 0U;
564 f.olsg_check_skipped = (w & 0x10U) != 0U;
572 [[nodiscard]]
constexpr bool Any() const noexcept {
573 uint32_t bits = (
static_cast<uint32_t
>(
global[0]) & 0x41FFU) |
574 (
static_cast<uint32_t
>(
global[1]) & 0x807FU) |
575 (
static_cast<uint32_t
>(
global[2]) & 0x001AU);
576 for (uint32_t g = 0U; g < 3U; ++g) {
577 bits |=
static_cast<uint32_t
>(
errors[g]) & 0x1F1FU;
578 bits |=
static_cast<uint32_t
>(
warnings[g]) & 0x0F0FU;
672[[nodiscard]]
constexpr uint32_t
SystemClockHz(
const Config& config)
noexcept;
679[[nodiscard]]
constexpr uint32_t
PllRefDiv(uint32_t khz)
noexcept {
689[[nodiscard]]
constexpr uint32_t
PllFbDiv(uint32_t khz)
noexcept {
690 return (khz == 0U) ? 0U : (((56'000U *
PllRefDiv(khz)) + (khz / 2U)) / khz);
697 const uint32_t khz = config.external_clock_khz;
698 if ((khz < 1000U) || (khz > 8000U)) {
701 return static_cast<uint32_t
>((
static_cast<uint64_t
>(khz) * 1000U *
PllFbDiv(khz)) /
713 const uint64_t target = ((
static_cast<uint64_t
>(microamps) *
kTargetMax) + (scale / 2U)) / scale;
725 return static_cast<uint32_t
>(
736 bool parallel)
noexcept {
737 const uint32_t counts =
static_cast<uint32_t
>(dither.steps) * dither.step_size;
749 if (icc.period_mant == 0U) {
752 const uint32_t cycles = (
static_cast<uint32_t
>(icc.period_mant) << (icc.period_exp & 0x07U)) *
753 (icc.low_freq_range ? 8U : 1U);
754 return system_hz / cycles;
764 uint32_t system_hz)
noexcept {
765 const uint64_t code =
766 (
static_cast<uint64_t
>(timeout_ms) * system_hz) / (uint64_t{1000} *
kWatchdogDivider);
780 const uint64_t code = ((
static_cast<uint64_t
>(millivolts) * 100U) + 8104U) / 16208U;
866 return kMasters[
static_cast<uint32_t
>(ToUnderlying(pair)) %
kPairCount];
871 return kSlaves[
static_cast<uint32_t
>(ToUnderlying(pair)) %
kPairCount];
875 constexpr std::array<ParallelPair, kChannelCount> kPairs = {
878 return kPairs[
static_cast<uint32_t
>(ToUnderlying(channel)) %
kChannelCount];
881[[nodiscard]]
constexpr bool IsActiveSlave(
const Config& config,
Channel channel)
noexcept {
883 return config.parallel[ToUnderlying(pair)] && (PairSlave(pair) == channel);
886[[nodiscard]]
constexpr bool IsActiveMaster(
const Config& config,
Channel channel)
noexcept {
888 return config.parallel[ToUnderlying(pair)] && (PairMaster(pair) == channel);
892[[nodiscard]]
constexpr bool ChannelEnumsValid(
const ChannelConfig& c)
noexcept {
893 return IsEnumerator(c.mode) && IsEnumerator(c.slew) && IsEnumerator(c.diag.current) &&
894 IsEnumerator(c.diag.off_state) && IsEnumerator(c.dither.fast);
899[[nodiscard]]
constexpr bool IccValid(
const IccConfig& icc, uint32_t system_hz)
noexcept {
900 if ((icc.period_exp > 7U) || (icc.ki > 15U) || (icc.limit > 1023U) || (icc.auto_limit > 31U) ||
901 (icc.int_thresh > 511U)) {
904 if (
static_cast<int32_t
>(icc.auto_limit) <= (
static_cast<int32_t
>(icc.min_int_thresh) + 3)) {
912[[nodiscard]]
constexpr bool DitherValid(
const DitherConfig& dither)
noexcept {
913 if ((dither.mant > 1023U) || (dither.exp > 15U) || (dither.step_size > 4095U)) {
921[[nodiscard]]
constexpr bool DiagValid(
const DiagConfig& diag,
ChannelMode mode)
noexcept {
922 if ((diag.ol_relative_eighths > 7U) || (diag.ol_fixed > 63U) || (diag.olsg_warn_window > 31U) ||
923 (diag.olsg_timeout > 63U)) {
930[[nodiscard]]
constexpr bool ChannelValid(
const ChannelConfig& c, uint32_t system_hz)
noexcept {
931 return ChannelEnumsValid(c) && (c.on_time_mant <= 1023U) && IccValid(c.icc, system_hz) &&
932 DitherValid(c.dither) && DiagValid(c.diag, c.mode);
936[[nodiscard]]
constexpr bool GlobalValid(
const Config& config)
noexcept {
937 if (!IsEnumerator(config.vio) || !IsEnumerator(config.clock)) {
941 if ((config.watchdog_reload < min_reload) || (config.watchdog_reload >
kMaxWatchdogReload) ||
942 (config.vbat_uv_code >= config.vbat_ov_code) || (config.max_retries >
kMaxRetries) ||
952 ((
static_cast<uint32_t
>(config.fault_pin.channel_errors) & ~0x3FU) == 0U) &&
953 ((
static_cast<uint32_t
>(config.fault_pin.channel_warnings) & ~0x3FU) == 0U);
972 if (!detail::GlobalValid(config)) {
977 const auto channel =
static_cast<Channel>(ch);
978 if (!detail::ChannelValid(config.channels[ch], hz) ||
979 (detail::IsActiveSlave(config, channel) && config.channels[ch].loaded)) {
997 c.icc.min_int_thresh = 2;
998 c.icc.period_mant = 219U;
999 c.icc.period_exp = 7U;
1000 c.dither.mant = 875U;
1010[[nodiscard]]
constexpr Config PresetProof() noexcept {
1043 [[nodiscard]]
constexpr const Config&
Get() const& noexcept {
1056 return TLE92466ED_VERSION_STRING;
1060 return TLE92466ED_VERSION_MAJOR;
1064 return TLE92466ED_VERSION_MINOR;
1068 return TLE92466ED_VERSION_PATCH;
A configuration proven valid at build time.
Definition tle92466ed_types.hpp:1031
void Get() const &&=delete
Not on a temporary: the reference would dangle (KB-CPP20-044).
consteval CheckedConfig(const Config &config) noexcept
Check config at build time.
Definition tle92466ed_types.hpp:1037
constexpr const Config & Get() const &noexcept
Definition tle92466ed_types.hpp:1043
constexpr uint32_t kResetPulseUs
Definition tle92466ed_types.hpp:453
constexpr uint32_t kMaxSetpointWithDitherUa
Highest setpoint plus dither amplitude of one channel (Table 14, I_set + I_Dither).
Definition tle92466ed_types.hpp:412
constexpr uint32_t kTargetMax
Largest TARGET value, 2^15 - 1.
Definition tle92466ed_types.hpp:426
Error
Why a call failed. Every call of the driver returns one of these in its Result.
Definition tle92466ed_types.hpp:37
constexpr const char * GetDriverVersion() noexcept
Definition tle92466ed_types.hpp:1055
Verify
Extra traffic a setter may spend to confirm its write (handbook KB-ARCH-041).
Definition tle92466ed_types.hpp:211
constexpr uint32_t PllRefDiv(uint32_t khz) noexcept
PLL_REFDIV for an external clock: f_CLK / 1 MHz, rounded down as in Table 10.
Definition tle92466ed_types.hpp:679
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 (Equati...
Definition tle92466ed_types.hpp:779
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).
Definition tle92466ed_types.hpp:735
GlobalFault
Global faults, each named by its register (bits 7..4: 0 GLOBAL_DIAG0, 1 GLOBAL_DIAG1,...
Definition tle92466ed_types.hpp:478
constexpr uint32_t kMaxPwmHz
Highest PWM frequency, f_PWM max (Table 6).
Definition tle92466ed_types.hpp:436
constexpr uint32_t kWatchdogDivider
The SPI watchdog counts f_SYS / 2^14 (Table 18).
Definition tle92466ed_types.hpp:444
constexpr uint32_t kPollIntervalUs
Interval of the INIT_DONE and self-test polls.
Definition tle92466ed_types.hpp:455
constexpr uint16_t kMaxWatchdogReload
Largest WD_TIME, an 11-bit field (5.3.2.11).
Definition tle92466ed_types.hpp:438
ChannelMode
How a channel drives its output (MODE.CH_MODE, section 5.3.3.11).
Definition tle92466ed_types.hpp:238
constexpr uint32_t kBistTimeoutUs
Definition tle92466ed_types.hpp:462
constexpr uint32_t kPairCount
Number of parallel pairs.
Definition tle92466ed_types.hpp:235
constexpr uint32_t kParallelMeasurementRangeUa
Definition tle92466ed_types.hpp:415
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 (...
Definition tle92466ed_types.hpp:689
constexpr uint32_t GetDriverVersionPatch() noexcept
Definition tle92466ed_types.hpp:1067
constexpr uint32_t kResetReleaseUs
Logic ready after RESN released, t_RESN max (Table 9).
Definition tle92466ed_types.hpp:448
constexpr uint32_t kParallelFullScaleUa
Full scale of TARGET in a parallel pair: the LSB doubles (4.5.2).
Definition tle92466ed_types.hpp:424
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).
Definition tle92466ed_types.hpp:763
constexpr uint32_t kMaxSetpointUa
Highest DC setpoint of one channel, in microamps (Table 14, I_set).
Definition tle92466ed_types.hpp:410
VioLevel
The level of VIO, the SPI output supply (GLOBAL_CONFIG.VIO_SEL, section 4.1.1).
Definition tle92466ed_types.hpp:279
ClockSource
Where the PLL takes its reference (CLK_DIV.EXT_CLK, section 4.2.1).
Definition tle92466ed_types.hpp:285
constexpr uint32_t kMaxOcOnTimeUs
Longest OFF-state overcurrent on-time t_OCon (TON register note, 5.3.3.12), microseconds.
Definition tle92466ed_types.hpp:446
constexpr uint32_t kMinPwmHz
Lowest PWM frequency of the frequency controller, f_PWM min (Table 6).
Definition tle92466ed_types.hpp:434
FastFeedback
Feedback update interval (DITHER_CTRL.FAST_MEAS, section 4.10.3).
Definition tle92466ed_types.hpp:272
constexpr uint32_t kMaxParallelSetpointUa
Definition tle92466ed_types.hpp:419
void ConfigIsInvalid() noexcept
Reached only when a CheckedConfig is built from an invalid configuration: it is never defined,...
constexpr uint32_t kMinInitTimeoutUs
Shortest Config::init_timeout_us.
Definition tle92466ed_types.hpp:457
ParallelPair
The channel pairs that can drive one load together (section 4.5.2).
Definition tle92466ed_types.hpp:229
constexpr Error Validate(const Config &config) noexcept
Check a configuration without touching the chip.
Definition tle92466ed_types.hpp:971
constexpr uint32_t kChannelCount
Number of output channels (section 4.5.1).
Definition tle92466ed_types.hpp:226
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 lo...
Definition tle92466ed_types.hpp:748
constexpr uint8_t kVersionA11
ICVID.VERSION of design step A11.
Definition tle92466ed_types.hpp:468
constexpr uint8_t kVersionA13
ICVID.VERSION of design step A13.
Definition tle92466ed_types.hpp:470
constexpr uint8_t kManufacturerId
ICVID.MANUFACTURER of every TLE92466ED (5.3.2.19).
Definition tle92466ed_types.hpp:466
constexpr uint32_t GetDriverVersionMajor() noexcept
Definition tle92466ed_types.hpp:1059
constexpr uint32_t kMaxInitTimeoutUs
Longest Config::init_timeout_us.
Definition tle92466ed_types.hpp:459
constexpr uint16_t kMinWatchdogReload
Definition tle92466ed_types.hpp:442
DiagCurrent
OFF-state diagnosis current I_HS, I_LS (CH_CONFIG.I_DIAG, Table 15).
Definition tle92466ed_types.hpp:256
constexpr ChannelConfig CurrentControlChannel() noexcept
A starting point for one current-controlled channel with feedback: ICC, a 1 kHz PWM target (PERIOD_MA...
Definition tle92466ed_types.hpp:993
constexpr uint32_t kInternalClockHz
f_SYS of the internal oscillator, typical (Table 6).
Definition tle92466ed_types.hpp:428
constexpr uint32_t MicroampsFromTarget(uint32_t target, bool parallel) noexcept
The current a TARGET count programs, rounded to the nearest microamp.
Definition tle92466ed_types.hpp:723
constexpr uint8_t kMaxRetries
Highest Config::max_retries.
Definition tle92466ed_types.hpp:464
constexpr uint32_t kMinSystemClockHz
Lowest f_SYS (Table 6).
Definition tle92466ed_types.hpp:430
Channel
One of the six output channels.
Definition tle92466ed_types.hpp:217
constexpr uint32_t kPowerOnResetUs
Logic ready after a power-on reset, t_POR max (Table 9).
Definition tle92466ed_types.hpp:450
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_REF...
Definition tle92466ed_types.hpp:693
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).
Definition tle92466ed_types.hpp:711
SlewRate
Output current slew rate (CH_CONFIG.SLEWR, Table 13).
Definition tle92466ed_types.hpp:248
constexpr uint32_t kMaxSystemClockHz
Highest f_SYS (Table 6).
Definition tle92466ed_types.hpp:432
LogLevel
Severity passed to the optional Log() hook.
Definition tle92466ed_types.hpp:201
constexpr uint32_t kSetpointFullScaleUa
Full scale of TARGET, one channel: I_set = 2 A * TARGET / (2^15 - 1) (5.3.3.3).
Definition tle92466ed_types.hpp:422
constexpr const char * ToString(Error error) noexcept
The name of an error, for logs.
Definition tle92466ed_types.hpp:87
OffStateDiag
OFF-state diagnosis current sources (CH_CONFIG.OFF_DIAG_CH, section 4.9.1).
Definition tle92466ed_types.hpp:264
constexpr uint32_t GetDriverVersionMinor() noexcept
Definition tle92466ed_types.hpp:1063
@ InvalidArgument
An argument or a Config field is out of range; nothing was sent.
@ DeviceIdMismatch
ICVID is not manufacturer 0xC1 with a known version (5.3.2.19).
@ Busy
Not returned by this driver: the chip is never busy to SPI.
@ None
No extra frame and no compare. The default.
@ ReadBack
Read the written register back (two more frames) and compare it.
@ CentralOtError
GLOBAL_DIAG0.COTERR.
@ ClockFault
GLOBAL_DIAG0.CLK_NOK.
@ RegisterEcc
GLOBAL_DIAG2.REG_ECC_ERR.
@ OtpEcc
GLOBAL_DIAG2.OTP_ECC_ERR.
@ ReferenceHigh
GLOBAL_DIAG1.REF_OV.
@ ReferenceLow
GLOBAL_DIAG1.REF_UV.
@ BiasCurrentLow
GLOBAL_DIAG1.VR_IREF_UV.
@ OtpVirgin
GLOBAL_DIAG2.OTP_VIRGIN.
@ VioUndervoltage
GLOBAL_DIAG0.VIO_UV.
@ VioOvervoltage
GLOBAL_DIAG0.VIO_OV.
@ PreRegulatorHigh
GLOBAL_DIAG1.VPRE_OV.
@ VbatOvervoltage
GLOBAL_DIAG0.VBAT_OV.
@ VddOvervoltage
GLOBAL_DIAG0.VDD_OV.
@ VbatUndervoltage
GLOBAL_DIAG0.VBAT_UV.
@ CentralOtWarning
GLOBAL_DIAG0.COTWARN.
@ SpiWatchdog
GLOBAL_DIAG0.SPI_WD_ERR.
@ MonitorAdc
GLOBAL_DIAG1.HVADC_ERR.
@ Supply2v5Low
GLOBAL_DIAG1.VDD2V5_UV.
@ VddUndervoltage
GLOBAL_DIAG0.VDD_UV.
@ BiasCurrentHigh
GLOBAL_DIAG1.VR_IREF_OV.
@ Supply2v5High
GLOBAL_DIAG1.VDD2V5_OV.
@ DirectDriveSpi
On-time on_time_mant per dither period, from SPI (4.8.1).
@ Measurement
Free-running measurement, switch off (4.4.3); CH_MODE = CH.
@ DirectDriveDrv1
The output follows the DRV1 pin (4.8.1).
@ CurrentControl
ICC: the integrating current controller holds the setpoint (4.6.2).
@ Off
Output off, no measurement. Reset value.
@ DirectDriveDrv0
The output follows the DRV0 pin (4.8.1).
@ V5V0
5.0 V. Reset value.
@ V3V3
3.3 V: VIO monitored against the 3.3 V thresholds (Table 9).
@ Internal
The internal oscillator; the dividers are ignored. Reset value.
@ External
The CLK pin, Config::external_clock_khz.
@ DitherPeriod
One update per dither period. Reset value.
@ QuarterPeriod
n_meas_sample = 4.
@ HalfPeriod
n_meas_sample = 2.
@ Ch1Ch2
CH1 master, CH2 slave (CH_CTRL.CH_PAR_1_2).
@ Ch0Ch3
CH0 master, CH3 slave (CH_CTRL.CH_PAR_0_3).
@ Ch4Ch5
CH4 master, CH5 slave (CH_CTRL.CH_PAR_4_5).
@ Ua80
80 uA typical. Reset value.
@ Ch4
LOAD4. Master of the CH4/CH5 pair.
@ Ch5
LOAD5. Slave of the CH4/CH5 pair.
@ Ch0
LOAD0. Master of the CH0/CH3 pair.
@ Ch1
LOAD1. Master of the CH1/CH2 pair.
@ Ch3
LOAD3. Slave of the CH0/CH3 pair.
@ Ch2
LOAD2. Slave of the CH1/CH2 pair.
@ VPerUs2p5
2.5 V/us typical.
@ VPerUs10
10 V/us typical. Reset value.
@ Warning
Something unexpected that the driver recovered from.
@ Info
Lifecycle events: initialised, reset.
@ Debug
Detail for bring-up.
@ Enabled
The OL/SG sequence of Figure 15 runs. Reset value.
@ HighSideSource
Only I_HS on.
@ LowSideSource
Only I_LS on.
@ Disabled
No OFF-state diagnosis.
The TLE92466ED driver: everything it declares lives here; internals in detail.
Definition tle92466ed.hpp:26
The result of the safety flip-flop self-test (SFF_BIST, section 4.9.8).
Definition tle92466ed_types.hpp:624
bool passed
SMU_SLF_TST_FAIL = 0.
Definition tle92466ed_types.hpp:625
bool uncorrectable_tested
SMU_SLF_TST_UERR.
Definition tle92466ed_types.hpp:626
bool correctable_tested
SMU_SLF_TST_CERR.
Definition tle92466ed_types.hpp:627
Counters of the protocol layer (handbook KB-ARCH-044). No I/O to read them.
Definition tle92466ed_types.hpp:656
uint32_t rejected_replies
Replies that failed a check (CRC, width, echo, anchor).
Definition tle92466ed_types.hpp:659
uint32_t frames
32-bit frames sent.
Definition tle92466ed_types.hpp:657
uint32_t resyncs
Anchor frames sent alone to restore the pipeline.
Definition tle92466ed_types.hpp:660
uint32_t retries
Reads repeated after a reply failed its checks.
Definition tle92466ed_types.hpp:658
Everything the driver writes for one channel. Defaults are the reset values.
Definition tle92466ed_types.hpp:345
IccConfig icc
Current controller.
Definition tle92466ed_types.hpp:353
ChannelMode mode
MODE.CH_MODE (Config Mode only).
Definition tle92466ed_types.hpp:349
bool loaded
Definition tle92466ed_types.hpp:346
DiagConfig diag
Diagnosis.
Definition tle92466ed_types.hpp:355
SlewRate slew
CH_CONFIG.SLEWR.
Definition tle92466ed_types.hpp:350
DitherConfig dither
Dither and measurement period.
Definition tle92466ed_types.hpp:354
uint16_t on_time_mant
Definition tle92466ed_types.hpp:351
The faults and warnings of one channel, decoded (sections 5.3.2.12, 5.3.2.13).
Definition tle92466ed_types.hpp:503
bool open_load
OL: open load, OFF-state diagnosis (4.9.4).
Definition tle92466ed_types.hpp:505
bool pwm_regulation
PWM_REG_WARN (4.6.2.4).
Definition tle92466ed_types.hpp:509
bool current_regulation
I_REG_WARN (4.6.2.5).
Definition tle92466ed_types.hpp:510
bool olsg
OLSG: open load or short to ground in ON-state (4.9.2).
Definition tle92466ed_types.hpp:504
constexpr bool AnyError() const noexcept
Definition tle92466ed_types.hpp:516
bool short_to_ground
SG: OFF-state diagnosis (4.9.5).
Definition tle92466ed_types.hpp:507
bool overtemperature
OTE: the channel was switched off (4.11.1).
Definition tle92466ed_types.hpp:508
bool olsg_check_skipped
OLSG_WARN_CHK_NOK: no voltage check was possible.
Definition tle92466ed_types.hpp:513
bool olsg_warning
OLSG_WARN (4.9.3).
Definition tle92466ed_types.hpp:512
friend constexpr bool operator==(const ChannelFaults &lhs, const ChannelFaults &rhs) noexcept=default
Field-by-field equality (KB-CPP20-033: integral members only).
bool overcurrent
OC (4.9.6, 4.11.2).
Definition tle92466ed_types.hpp:506
bool overtemperature_warning
OTW.
Definition tle92466ed_types.hpp:511
One measurement period of a channel's feedback, read under the freeze of section 4....
Definition tle92466ed_types.hpp:641
uint32_t duty_permyriad
TO_MANT / TP_MANT, 0 to 10000.
Definition tle92466ed_types.hpp:644
uint8_t quad_count
DITHER_QUAD_CNT (fast feedback only).
Definition tle92466ed_types.hpp:652
uint32_t vbat_mv
VBAT = 41.47 V * VBAT_AVG_MANT / TP_MANT.
Definition tle92466ed_types.hpp:645
uint32_t max_pwm_period_ns
T_PWM_max = PMAX * 256 / f_SYS.
Definition tle92466ed_types.hpp:650
uint32_t min_pwm_period_ns
T_PWM_min = PMIN * 256 / f_SYS.
Definition tle92466ed_types.hpp:649
uint32_t period_us
T_meas = TP_MANT * 2^EXP / f_SYS.
Definition tle92466ed_types.hpp:646
int32_t min_current_ua
I_min = 4 A * IMIN / (2^9 - 1).
Definition tle92466ed_types.hpp:647
int32_t average_current_ua
Definition tle92466ed_types.hpp:642
int32_t max_current_ua
I_max = 4 A * IMAX / (2^9 - 1).
Definition tle92466ed_types.hpp:648
uint8_t period_count
DITHER_PERIOD_CNT (fast feedback only, 4.10.4).
Definition tle92466ed_types.hpp:651
The unique chip identification, CHIPID0..2 (sections 5.3.2.24 to 5.3.2.26).
Definition tle92466ed_types.hpp:631
friend constexpr bool operator==(const ChipId &lhs, const ChipId &rhs) noexcept=default
Word-by-word equality.
std::array< uint16_t, 3 > words
Definition tle92466ed_types.hpp:632
Everything EnsureInitialized() writes to the chip, and the driver's own settings.
Definition tle92466ed_types.hpp:382
bool clock_watchdog
GLOBAL_CONFIG.CLK_WD_EN (4.2.2).
Definition tle92466ed_types.hpp:387
FaultPinMask fault_pin
FAULT_MASK0..2.
Definition tle92466ed_types.hpp:397
uint32_t external_clock_khz
Definition tle92466ed_types.hpp:393
uint8_t vbat_uv_code
VBAT_TH.VBAT_UV_TH, 162.08 mV per count (4.05 V).
Definition tle92466ed_types.hpp:395
bool crc_check
Definition tle92466ed_types.hpp:385
uint32_t init_timeout_us
Definition tle92466ed_types.hpp:400
uint8_t vbat_ov_code
VBAT_TH.VBAT_OV_TH (41.3 V).
Definition tle92466ed_types.hpp:396
ClockSource clock
CLK_DIV.EXT_CLK.
Definition tle92466ed_types.hpp:392
bool spi_watchdog
GLOBAL_CONFIG.SPI_WD_EN (5.2.2).
Definition tle92466ed_types.hpp:388
std::array< ChannelConfig, kChannelCount > channels
Per channel, indexed by Channel.
Definition tle92466ed_types.hpp:399
uint16_t watchdog_reload
Definition tle92466ed_types.hpp:389
std::array< bool, kPairCount > parallel
CH_CTRL.CH_PAR_x_y, indexed by ParallelPair.
Definition tle92466ed_types.hpp:398
VioLevel vio
Definition tle92466ed_types.hpp:383
uint8_t max_retries
Definition tle92466ed_types.hpp:402
FB_STAT, the chip's one-word status summary, decoded (section 5.3.2.21).
Definition tle92466ed_types.hpp:588
bool spi_watchdog_error
SPI_WD_ERR.
Definition tle92466ed_types.hpp:590
bool power_on_event
POR_event: power-on reset since the flag was cleared.
Definition tle92466ed_types.hpp:595
bool data_error
DATA_err: OTP ECC, OTP virgin or monitor ADC error.
Definition tle92466ed_types.hpp:596
uint32_t raw
The 22-bit register.
Definition tle92466ed_types.hpp:602
bool init_done
INIT_DONE: clock and logic ready.
Definition tle92466ed_types.hpp:589
bool central_ot_error
COTERR.
Definition tle92466ed_types.hpp:592
uint8_t warning_groups
DIAG_WARN_CHGR0..2 summary, bit g.
Definition tle92466ed_types.hpp:600
bool supply_external
SUP_NOK_EXT: VIO, VDD or VBAT out of range.
Definition tle92466ed_types.hpp:597
bool supply_internal
SUP_NOK_INT: an internal supply out of range.
Definition tle92466ed_types.hpp:598
bool clock_fault
CLK_NOK.
Definition tle92466ed_types.hpp:591
uint8_t error_groups
ERR_CHGR0..2, bit g: a channel error in group g.
Definition tle92466ed_types.hpp:599
bool reset_event
RES_event: RESN reset since the flag was cleared.
Definition tle92466ed_types.hpp:594
bool central_ot_warning
COTWARN.
Definition tle92466ed_types.hpp:593
uint8_t check_skipped_groups
OLSG_WARN_CHK_NOK summary, bit g.
Definition tle92466ed_types.hpp:601
The diagnosis of one channel (CH_CONFIG, CTRL, TON; section 4.9). Defaults are the reset values....
Definition tle92466ed_types.hpp:332
DiagCurrent current
CH_CONFIG.I_DIAG.
Definition tle92466ed_types.hpp:333
OffStateDiag off_state
CH_CONFIG.OFF_DIAG_CH.
Definition tle92466ed_types.hpp:338
uint8_t olsg_timeout
TON.OLSG_TIMEOUT, 0 to 63 (Equation 15).
Definition tle92466ed_types.hpp:341
uint8_t ol_relative_eighths
Definition tle92466ed_types.hpp:334
uint8_t olsg_warn_window
CTRL.OLSG_WARN_WINDOW, 0 to 31.
Definition tle92466ed_types.hpp:340
uint8_t ol_fixed
Definition tle92466ed_types.hpp:336
bool olsg_warning
CTRL.OLSG_WARN_EN (4.9.3).
Definition tle92466ed_types.hpp:339
The dither generator of one channel (DITHER_CLK_DIV, DITHER_STEP, DITHER_CTRL; section 4....
Definition tle92466ed_types.hpp:315
bool setpoint_sync
DITHER_CLK_DIV.DITHER_SETPOINT_SYNC_EN (4.7.5).
Definition tle92466ed_types.hpp:319
uint8_t exp
DITHER_CLK_DIV.EXP, 0 to 15; also the TON exponent.
Definition tle92466ed_types.hpp:317
uint16_t mant
DITHER_CLK_DIV.MANT of t_ref_clk, 0 to 1023.
Definition tle92466ed_types.hpp:316
uint16_t step_size
DITHER_CTRL.STEP_SIZE, 0 to 4095, in TARGET counts.
Definition tle92466ed_types.hpp:322
uint8_t flat
DITHER_STEP.FLAT reference clocks at each plateau.
Definition tle92466ed_types.hpp:321
FastFeedback fast
DITHER_CTRL.FAST_MEAS (4.10.3).
Definition tle92466ed_types.hpp:324
bool pwm_sync
DITHER_CLK_DIV.DITHER_PWM_SYNC_EN (4.7.3).
Definition tle92466ed_types.hpp:318
bool deep
DITHER_CTRL.DEEP_DITHER (4.7.7).
Definition tle92466ed_types.hpp:323
uint8_t steps
DITHER_STEP.STEPS per quarter period.
Definition tle92466ed_types.hpp:320
Which faults pull FAULTN low (FAULT_MASK0..2, sections 5.3.2.14 to 5.3.2.16); true reports the fault ...
Definition tle92466ed_types.hpp:363
uint8_t channel_warnings
CHx_WARN_MASK, bit x: OTW, I_REG, PWM_REG, OLSG warnings.
Definition tle92466ed_types.hpp:365
bool supply_external
SUP_NOK_EXT_MASK.
Definition tle92466ed_types.hpp:368
bool supply_internal
SUP_NOK_INT_MASK.
Definition tle92466ed_types.hpp:367
bool clock_too_slow
CLK_LOW_MASK.
Definition tle92466ed_types.hpp:371
bool central_ot_warning
COTWARN_MASK.
Definition tle92466ed_types.hpp:369
bool central_ot_error
COTERR_MASK.
Definition tle92466ed_types.hpp:370
bool spi_watchdog
SPI_WD_MASK.
Definition tle92466ed_types.hpp:373
bool en_pin
EN_PIN_MASK: EN low.
Definition tle92466ed_types.hpp:366
bool data_error
DATA_ERR_MASK.
Definition tle92466ed_types.hpp:372
uint8_t channel_errors
CHx_ERR_MASK, bit x: OC, SG, OL, OTE, OLSG of channel x.
Definition tle92466ed_types.hpp:364
The diagnosis registers as read: GLOBAL_DIAG0..2, DIAG_ERR_CHGR0..2 and DIAG_WARN_CHGR0....
Definition tle92466ed_types.hpp:528
friend constexpr bool operator==(const Faults &lhs, const Faults &rhs) noexcept=default
Word-by-word equality (KB-CPP20-033: integral members only).
constexpr bool Any() const noexcept
Definition tle92466ed_types.hpp:572
constexpr bool Has(GlobalFault fault) const noexcept
Whether a global fault is set.
Definition tle92466ed_types.hpp:538
std::array< uint16_t, 3 > warnings
DIAG_WARN_CHGR0, 1, 2.
Definition tle92466ed_types.hpp:531
std::array< uint16_t, 3 > global
GLOBAL_DIAG0, 1, 2.
Definition tle92466ed_types.hpp:529
constexpr ChannelFaults Of(Channel channel) const noexcept
The faults of one channel.
Definition tle92466ed_types.hpp:549
std::array< uint16_t, 3 > errors
DIAG_ERR_CHGR0, 1, 2.
Definition tle92466ed_types.hpp:530
The integrating current controller of one channel (CTRL, PERIOD, INTEGRATOR_LIMIT,...
Definition tle92466ed_types.hpp:294
uint8_t period_exp
PERIOD.PERIOD_EXP, 0 to 7.
Definition tle92466ed_types.hpp:299
uint8_t auto_limit
Definition tle92466ed_types.hpp:303
int8_t min_int_thresh
Definition tle92466ed_types.hpp:295
bool auto_limit_disable
SETPOINT.AUTO_LIMIT_DIS (4.6.2.2).
Definition tle92466ed_types.hpp:305
bool low_freq_range
PERIOD.LOW_FREQ_RANGE_EN: the period times 8.
Definition tle92466ed_types.hpp:300
uint16_t int_thresh
CTRL_INT_THRESH.INT_THRESH, 0 to 511.
Definition tle92466ed_types.hpp:306
uint8_t ki
PERIOD.PWM_CTRL_PARAM, the controller gain, 0 to 15.
Definition tle92466ed_types.hpp:301
bool skip_falling_dither
CTRL.PWM_PERIOD_CALC_MODE (4.6.2.3).
Definition tle92466ed_types.hpp:297
uint16_t limit
INTEGRATOR_LIMIT.LIM_VALUE_ABS, 0 to 1023.
Definition tle92466ed_types.hpp:302
uint8_t period_mant
PERIOD.PERIOD_MANT; 0 turns the PWM controller off.
Definition tle92466ed_types.hpp:298
PIN_STAT, decoded (section 5.3.2.20).
Definition tle92466ed_types.hpp:615
bool enable
EN is high.
Definition tle92466ed_types.hpp:618
bool drv1
DRV1 is high.
Definition tle92466ed_types.hpp:617
bool drv0
DRV0 is high.
Definition tle92466ed_types.hpp:616
bool fault
An unmasked fault (FAULTN bit 0).
Definition tle92466ed_types.hpp:619
bool faultn_high
FAULTN_FB: the pin's level is high.
Definition tle92466ed_types.hpp:620
constexpr bool ok() const noexcept
Definition tle92466ed_types.hpp:178
static constexpr Result Success() noexcept
Definition tle92466ed_types.hpp:187
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition tle92466ed_types.hpp:195
The value of a call, or why there is none.
Definition tle92466ed_types.hpp:141
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition tle92466ed_types.hpp:167
constexpr bool ok() const noexcept
Definition tle92466ed_types.hpp:146
static constexpr Result Success(T v) noexcept
A successful result.
Definition tle92466ed_types.hpp:159
The supply and temperature feedback (FB_VOLTAGE1, FB_VOLTAGE2; 5.3.2.22, 5.3.2.23).
Definition tle92466ed_types.hpp:606
uint32_t vbat_mv
VBAT = 41.47 V * VBAT / (2^11 - 1).
Definition tle92466ed_types.hpp:609
uint32_t vdd_mv
VDD = 3.4534 mV * VDD.
Definition tle92466ed_types.hpp:608
int32_t temperature_mc
Definition tle92466ed_types.hpp:610
uint32_t vio_mv
VIO = 3.4534 mV * VIO.
Definition tle92466ed_types.hpp:607
Compile-time helpers of the TLE92466ED driver: typed integer literals, exact hook matching,...