24#include "tle92466ed_version.h"
35template <
typename Port>
36concept DeclaresGpioSet =
40template <
typename Port>
42 requires { ExactHook<Port, bool(
CtrlPin,
GpioSignal)
noexcept>::Take(&Port::GpioSet); };
45template <
typename Port>
46concept DeclaresGpioRead =
50template <
typename Port>
52 requires { ExactHook<Port, bool(
CtrlPin,
GpioSignal&)
noexcept>::Take(&Port::GpioRead); };
55template <
typename Port>
56concept DeclaresDelayUs =
requires(Port& port) { port.DelayUs(1_u32); };
60template <
typename Port>
61concept HasDelayUs =
requires { ExactHook<Port, void(uint32_t)
noexcept>::Take(&Port::DelayUs); };
64template <
typename Port>
65concept DeclaresLog =
requires(Port& port) { port.Log(
LogLevel::Info,
""); };
68template <
typename Port>
70 requires { ExactHook<Port, void(
LogLevel,
const char*)
noexcept>::Take(&Port::Log); };
74template <
typename Port>
75void DelayUs(Port& port, uint32_t us)
noexcept {
76 if constexpr (HasDelayUs<Port>) {
79 static_assert(kAlwaysFalse<Port>,
80 "tle92466ed: the port must implement `void DelayUs(uint32_t us) noexcept`");
85template <
typename Port>
86void Log(Port& port, [[maybe_unused]]
LogLevel level,
87 [[maybe_unused]]
const char* message)
noexcept {
88 if constexpr (HasLog<Port>) {
89 port.Log(level, message);
99[[nodiscard]]
constexpr uint16_t ChannelBit(
Channel channel)
noexcept {
100 return static_cast<uint16_t
>(
101 1U << (
static_cast<uint32_t
>(ToUnderlying(channel)) %
kChannelCount));
105[[nodiscard]]
constexpr uint32_t LoadedMask(
const Config& config)
noexcept {
108 mask |= config.
channels[ch].loaded ? (1U << ch) : 0U;
114[[nodiscard]]
constexpr uint16_t PairBits(
const Config& config)
noexcept {
118 return static_cast<uint16_t
>(bits);
122[[nodiscard]]
constexpr uint16_t GlobalConfigValue(
const Config& config)
noexcept {
127 return static_cast<uint16_t
>(v);
131[[nodiscard]]
constexpr uint16_t ClkDivValue(
const Config& config)
noexcept {
137 return reg::PllRefDiv::Insert(v,
PllRefDiv(khz));
141[[nodiscard]]
constexpr uint16_t VbatThValue(
const Config& config)
noexcept {
142 const auto v = reg::VbatUvTh::Insert(0_u16, config.
vbat_uv_code);
147[[nodiscard]]
constexpr uint16_t FaultMask0Value(
const Config& config)
noexcept {
149 uint32_t v =
static_cast<uint32_t
>(m.
channel_errors) & LoadedMask(config);
153 return static_cast<uint16_t
>(v);
157[[nodiscard]]
constexpr uint16_t FaultMask1Value(
const Config& config)
noexcept {
159 uint32_t v =
static_cast<uint32_t
>(m.
channel_warnings) & LoadedMask(config);
163 return static_cast<uint16_t
>(v);
167[[nodiscard]]
constexpr uint16_t FaultMask2Value(
const Config& config)
noexcept {
170 return static_cast<uint16_t
>(v);
174[[nodiscard]]
constexpr uint16_t ModeValue(
ChannelMode mode)
noexcept {
175 const auto code =
static_cast<uint32_t
>(ToUnderlying(mode));
182[[nodiscard]]
constexpr uint16_t ChConfigValue(
const ChannelConfig& c)
noexcept {
183 auto v = reg::SlewRate::Insert(0_u16, ToUnderlying(c.
slew));
184 v = reg::IDiag::Insert(v, ToUnderlying(c.
diag.
current));
188 return reg::OffDiagCh::Insert(v, ToUnderlying(c.
diag.
off_state));
194[[nodiscard]]
constexpr uint16_t CtrlValue(
const ChannelConfig& c)
noexcept {
195 auto v = reg::MinIntThresh::Insert(
197 v =
static_cast<uint16_t
>(
static_cast<uint32_t
>(v) |
200 return static_cast<uint16_t
>(
static_cast<uint32_t
>(v) |
205[[nodiscard]]
constexpr uint16_t PeriodValue(
const IccConfig& icc)
noexcept {
206 auto v = reg::PeriodMant::Insert(0_u16, icc.
period_mant);
207 v = reg::PeriodExp::Insert(v, icc.
period_exp);
208 v =
static_cast<uint16_t
>(
static_cast<uint32_t
>(v) |
210 return reg::PwmCtrlParam::Insert(v, icc.
ki);
214[[nodiscard]]
constexpr uint16_t IntegratorLimitValue(
const IccConfig& icc)
noexcept {
215 return reg::AutoLimValueAbs::Insert(reg::LimValueAbs::Insert(0_u16, icc.
limit), icc.
auto_limit);
219[[nodiscard]]
constexpr uint16_t DitherClkDivValue(
const DitherConfig& d)
noexcept {
220 auto v = reg::DitherExp::Insert(reg::DitherMant::Insert(0_u16, d.
mant), d.
exp);
223 return static_cast<uint16_t
>(bits);
227[[nodiscard]]
constexpr uint16_t DitherStepValue(
const DitherConfig& d)
noexcept {
228 return reg::DitherSteps::Insert(reg::DitherFlat::Insert(0_u16, d.
flat), d.
steps);
232[[nodiscard]]
constexpr uint16_t DitherCtrlValue(
const DitherConfig& d)
noexcept {
233 auto v = reg::DitherStepSize::Insert(0_u16, d.
step_size);
235 return reg::FastMeas::Insert(v, ToUnderlying(d.
fast));
239[[nodiscard]]
constexpr uint16_t TonValue(
const ChannelConfig& c)
noexcept {
244[[nodiscard]]
constexpr uint16_t SetpointValue(
const IccConfig& icc, uint32_t target)
noexcept {
245 const auto v = reg::Target::Insert(0_u16, target);
246 return static_cast<uint16_t
>(
static_cast<uint32_t
>(v) |
251inline constexpr std::array<uint16_t, 11> kChannelOffsets = {
258inline constexpr std::array<uint16_t, 11> kChannelCompare = {0x000FU, 0x1FFFU, 0x7FFFU, 0xFFFFU,
259 0x7FFFU, 0xFFFFU, 0xFFFFU, 0xEFFFU,
260 0xFFFFU, 0x01FFU, 0xFFFFU};
263[[nodiscard]]
constexpr std::array<uint16_t, 11> ChannelWords(
const ChannelConfig& c)
noexcept {
264 return {ModeValue(c.
mode),
268 IntegratorLimitValue(c.
icc),
269 DitherClkDivValue(c.
dither),
270 DitherStepValue(c.
dither),
271 DitherCtrlValue(c.
dither),
274 SetpointValue(c.
icc, 0U)};
278inline constexpr uint32_t kPairMask = 0x7000U;
287inline constexpr uint16_t kErrClear = 0x1F1FU;
289inline constexpr uint16_t kOcBoth = 0x0404U;
291inline constexpr uint16_t kWarnClear = 0x0F0FU;
293inline constexpr uint16_t kDiag2Clear = 0x000AU;
295inline constexpr uint32_t kDiag0Any = 0x47FFU;
296static_assert(kOcBoth == (
static_cast<uint32_t
>(
reg::kErrOc) * 0x0101U));
302inline constexpr std::array<uint16_t, 5> kFeedbackOffsets = {
306[[nodiscard]]
constexpr DeviceStatus DecodeStatus(uint32_t raw)
noexcept {
318 s.error_groups =
static_cast<uint8_t
>((raw >> 14U) & 0x7U);
319 s.warning_groups =
static_cast<uint8_t
>(raw & 0x7U);
320 s.check_skipped_groups =
static_cast<uint8_t
>((raw >> 3U) & 0x7U);
326[[nodiscard]]
constexpr PinStatus DecodePins(uint32_t raw)
noexcept {
338[[nodiscard]]
constexpr SupplyReadings DecodeSupply(uint32_t v1, uint32_t v2)
noexcept {
340 s.
vio_mv = (reg::VioRaw::Extract(v1) * 34534U) / 10000U;
341 s.vdd_mv = (reg::VddRaw::Extract(v1) * 34534U) / 10000U;
342 s.vbat_mv = (reg::VbatRaw::Extract(v2) * 41470U) / 2047U;
343 const auto temp =
static_cast<int64_t
>(reg::TempRaw::Extract(v2));
344 s.temperature_mc =
static_cast<int32_t
>((511'875'000 - (370'625 * temp)) / 1000);
352 uint32_t system_hz)
noexcept {
353 const uint32_t tp = reg::TpMant::Extract(w[0]);
354 if ((tp == 0U) || (system_hz == 0U)) {
357 const uint32_t to = reg::ToMant::Extract(w[0]);
360 (4'000'000 *
static_cast<int64_t
>(SignExtend<12U>(reg::IAvgMant::Extract(w[2])))) /
361 static_cast<int64_t
>(tp));
362 const uint32_t duty = (to * 10000U) / tp;
364 (duty < 10000U) ? duty : 10000U;
365 f.vbat_mv = (reg::VbatAvgMant::Extract(w[1]) * 41470U) / tp;
366 f.period_us =
static_cast<uint32_t
>(
367 ((
static_cast<uint64_t
>(tp) << reg::FbExp::Extract(w[1])) * 1'000'000U) / system_hz);
368 f.min_current_ua = (4'000'000 * SignExtend<10U>(reg::IMin::Extract(w[3]))) / 511;
369 f.max_current_ua = (4'000'000 * SignExtend<10U>(reg::IMax::Extract(w[3]))) / 511;
370 f.min_pwm_period_ns =
static_cast<uint32_t
>(
371 (
static_cast<uint64_t
>(reg::PMin::Extract(w[4])) * 256'000'000'000U) / system_hz);
372 f.max_pwm_period_ns =
static_cast<uint32_t
>(
373 (
static_cast<uint64_t
>(reg::PMax::Extract(w[4])) * 256'000'000'000U) / system_hz);
374 f.period_count =
static_cast<uint8_t
>(reg::DitherPeriodCnt::Extract(w[1]));
375 f.quad_count =
static_cast<uint8_t
>(reg::DitherQuadCnt::Extract(w[1]));
381static_assert(DecodeSupply(1448U, 0U).
vio_mv == 5000U);
382static_assert(DecodeFeedback({0x0000'0000U, 0U, 0U, 0U, 0U},
kInternalClockHz).error ==
384static_assert(DecodeFeedback({(1000U << 11U) | 2000U, 0x5000U | 1000U, 0x0FFFU, 0U, 0U},
386 .value.average_current_ua == -2000);
387static_assert(DecodeFeedback({(1000U << 11U) | 2000U, 0x5000U | 1000U, 0x0FFFU, 0U, 0U},
389 .value.duty_permyriad == 5000U);
390static_assert(DecodeFeedback({(1000U << 11U) | 2000U, 0x5000U | 1000U, 0x0FFFU, 0U, 0U},
392 .value.period_us == 2285U);
395[[nodiscard]]
constexpr Config AllLoaded()
noexcept {
417static_assert((FaultMask0Value(
Config{}) == 0xC000U) && (FaultMask1Value(
Config{}) == 0x7000U));
459template <SpiPort Port>
461 static_assert(!detail::DeclaresGpioSet<Port> || detail::HasGpioSet<Port>,
462 "tle92466ed: the optional GpioSet hook must be `bool GpioSet(CtrlPin, GpioSignal) "
463 "noexcept`, so that a failed pin write is reported");
464 static_assert(!detail::DeclaresGpioRead<Port> || detail::HasGpioRead<Port>,
465 "tle92466ed: the optional GpioRead hook must be `bool GpioRead(CtrlPin, "
466 "GpioSignal&) noexcept`");
468 !detail::DeclaresDelayUs<Port> || detail::HasDelayUs<Port>,
469 "tle92466ed: the DelayUs hook must be `void DelayUs(uint32_t us) noexcept`, so that no "
470 "wait is truncated");
472 !detail::DeclaresLog<Port> || detail::HasLog<Port>,
473 "tle92466ed: the optional Log hook must be `void Log(LogLevel, const char* message) "
483 : bus_(port), config_(config) {}
894 return bus_.LastReply();
902 return bus_.LastCritical();
907 return bus_.Diagnostics();
914 Result<
void> resetChip() noexcept;
915 Result<
void> waitInitDone() noexcept;
916 Result<
void> identify() noexcept;
917 Result<
void> takeStartupFaults() noexcept;
919 Result<
void> clearAll() noexcept;
921 Result<
void> clearTwice(uint16_t address, uint16_t bits, uint16_t twice) noexcept;
922 Result<
void> armWatchdog(const
Config& config) noexcept;
923 Result<
void> checkMissionEntry() noexcept;
924 Result<
void> checkGroupTemperature(uint32_t group, const
DeviceStatus& status) noexcept;
925 Result<
void> reconcile() noexcept;
926 void adopt(uint16_t chip) noexcept;
927 Result<
void> writeEnables(uint32_t set, uint32_t clear,
Verify verify) noexcept;
928 [[nodiscard]]
Error checkEnable(uint32_t bits) const noexcept;
929 Result<uint32_t> readOnce(uint16_t address) noexcept;
930 void latchAll(const
Faults& f) noexcept;
931 void noteDropped(uint32_t bits) noexcept;
932 Result<uint32_t> waitBist() noexcept;
934 Result<
void> writeGlobal(const
Config& config) noexcept;
936 Result<
void> armResetWatch() noexcept;
937 Result<
void> writeChCtrl(uint16_t value,
Verify verify) noexcept;
939 Result<
void> readFeedbackSet(uint16_t base, std::array<uint32_t, 5>& words) noexcept;
940 Result<uint32_t> read(uint16_t address) noexcept;
941 Result<
void> write(uint16_t address, uint16_t value) noexcept;
942 Result<
void> writeVerified(uint16_t address, uint16_t value, uint16_t compare,
944 [[nodiscard]]
Error checkChannel(
Channel channel) const noexcept;
945 [[nodiscard]]
Error checkKnown(
Channel channel,
bool dither) const noexcept;
946 [[nodiscard]]
bool maybeMission() const noexcept;
947 [[nodiscard]]
Error checkCurrent(
Channel channel, uint32_t microamps,
949 void latch(uint16_t address, uint32_t value) noexcept;
950 void track(
Error error) noexcept;
951 Result<
void> fail(
Error error, const
char* message) noexcept;
953 detail::Transport<Port> bus_;
957 std::array<uint16_t, kChannelCount> setpoint_{};
958 uint16_t ch_ctrl_{0};
963 uint16_t par_unknown_{0};
964 uint8_t config_unknown_{0};
965 uint8_t dither_unknown_{0};
966 bool global_unknown_{
false};
967 bool maybe_mission_{
false};
969 bool reset_watch_{
false};
970 bool initialized_{
false};
978#include "../src/tle92466ed.ipp"
Driver for one TLE92466ED on a platform port.
Definition tle92466ed.hpp:460
TLE92466ED(const TLE92466ED &)=delete
One driver object per chip.
bool IsMissionMode() const noexcept
Definition tle92466ed.hpp:606
Result< void > SetDrivePin(CtrlPin pin, bool high) noexcept
Drive DRV0 or DRV1, the inputs of the direct-drive channels (section 4.8.1).
Result< uint32_t > SetCurrent(Channel channel, uint32_t microamps, Verify verify=Verify::None) noexcept
Set a channel's average current setpoint (SETPOINT.TARGET, section 4.6.1).
Result< void > EnterMissionMode() noexcept
Enter Mission Mode, as Figure 4 allows it. First the entry conditions: FB_STAT (INIT_DONE = 1; no SPI...
Result< void > EnsureInitialized() noexcept
Start the chip, once: the only way to initialise the driver.
uint8_t GetLastCriticalFault() const noexcept
Definition tle92466ed.hpp:901
TLE92466ED & operator=(const TLE92466ED &)=delete
One driver object per chip.
const Faults & GetLatchedFaults() const &noexcept
Definition tle92466ed.hpp:798
bool IsResetWatchArmed() const noexcept
Definition tle92466ed.hpp:875
TLE92466ED(Port &port, const Config &config={}) noexcept
Bind the driver to a port and store the configuration. No I/O, cannot fail.
Definition tle92466ed.hpp:482
Result< DeviceStatus > ReadStatus() noexcept
Read FB_STAT, the one-register summary (section 5.3.2.21). Two frames.
void ClearLatchedFaults() noexcept
Empty the latch of GetLatchedFaults(). No I/O.
Definition tle92466ed.hpp:805
Result< PinStatus > ReadPinStatus() noexcept
Read PIN_STAT (section 5.3.2.20). Two frames.
const Faults & GetStartupFaults() const &noexcept
Definition tle92466ed.hpp:813
void ClearDroppedChannels() noexcept
Empty the record of GetDroppedChannels(). No I/O.
Definition tle92466ed.hpp:668
Result< void > ConfigureChannel(Channel channel, const ChannelConfig &config, Verify verify=Verify::None) noexcept
Write one channel's registers (MODE is writable in Config Mode only, section 4.4.1)....
Result< void > EnterConfigMode() noexcept
Enter Config Mode: OP_MODE 0, which turns every channel off (section 4.3.1), then EN low,...
uint8_t GetIcVersion() const noexcept
Definition tle92466ed.hpp:867
Result< bool > ReadFaultPin() noexcept
Read the FAULTN pin through the port's GpioRead().
Result< void > SetEnabledChannels(uint8_t mask, Verify verify=Verify::None) noexcept
Switch channels on and off together. CH_CTRL is read first, so the copy is the chip's (a channel a fa...
Result< SupplyReadings > ReadSupply() noexcept
Read FB_VOLTAGE1 and FB_VOLTAGE2: VIO, VDD, VBAT and the central temperature (sections 4....
Result< ChipId > ReadChipId() noexcept
Read CHIPID0..2, the unique chip identification. Six frames.
Result< void > Deinitialize() noexcept
Switch every channel off: Config Mode (CH_CTRL with OP_MODE and every EN_CH 0), then EN low....
Result< void > DisableChannel(Channel channel, Verify verify=Verify::None) noexcept
Switch one channel off, leaving the others as they are. Allowed in any state. When the CH_CTRL read f...
Result< void > ReloadWatchdog() noexcept
Reload the SPI watchdog: write Config::watchdog_reload to WD_RELOAD. Call it more often than the time...
bool IsInitialized() const noexcept
Definition tle92466ed.hpp:518
Result< BistResult > RunBist() noexcept
Run the safety flip-flop self-test (section 4.9.8, Config Mode only): start it, poll SMU_SLF_TST_DONE...
Result< Faults > ReadFaults() noexcept
Read the nine diagnosis registers (GLOBAL_DIAG0..2, DIAG_ERR_CHGR0..2, DIAG_WARN_CHGR0....
Result< void > ClearChannelFaults(Channel channel) noexcept
Clear one channel's flags and warnings: its DIAG_ERR_CHGR and DIAG_WARN_CHGR group read and latched (...
Result< uint32_t > ReadRegister(uint16_t address) noexcept
Read one register once: two frames, no retry, no decoding. Reading DIAG_WARN_CHGR clears OLSG_WARN_CH...
Result< void > HardwareReset() noexcept
Pulse RESN and start again as EnsureInitialized() does, with the stored configuration.
void GetConfig() const &&=delete
Not on a temporary driver: the reference would dangle (KB-CPP20-044).
uint8_t GetEnabledChannels() const noexcept
Definition tle92466ed.hpp:677
void GetStartupFaults() const &&=delete
Not on a temporary driver.
Result< void > EnableChannel(Channel channel, Verify verify=Verify::None) noexcept
Switch one channel on, leaving the others as they are. As SetEnabledChannels().
Result< void > SetParallel(ParallelPair pair, bool enabled) noexcept
Join or split a pair (CH_CTRL.CH_PAR, Config Mode only, section 4.5.2). Joining sets the master's SET...
uint32_t GetLastReply() const noexcept
Definition tle92466ed.hpp:893
const Config & GetConfig() const &noexcept
Definition tle92466ed.hpp:551
Result< void > StartOvercurrentCheck(Channel channel) noexcept
Run the OFF-state overcurrent check once (section 4.9.6): set CH_CONFIG.OC_DIAG_EN and the channel's ...
Result< uint16_t > ReadChannelControl() noexcept
Read CH_CTRL: the operation state and the enabled channels as the chip has them. A supply,...
void GetLatchedFaults() const &&=delete
Not on a temporary driver.
Result< void > ApplyConfig(const Config &config) noexcept
Change the whole configuration. Before the start it is only stored, with no I/O; on a started driver ...
uint32_t GetCurrentSetpoint(Channel channel) const noexcept
Result< ChannelFeedback > ReadChannelFeedback(Channel channel) noexcept
Read one measurement period of a channel's feedback, as section 4.10.5 recommends: read FB_UPD; when ...
Result< void > SetDither(Channel channel, const DitherConfig &dither, Verify verify=Verify::None) noexcept
Change a channel's dither at run time (section 4.7.2): DITHER_CLK_DIV (takes effect at once),...
uint8_t GetDroppedChannels() const noexcept
Definition tle92466ed.hpp:664
Result< void > ClearFaults() noexcept
Clear the diagnosis flags on the chip: every diagnosis register is read and latched (GetLatchedFaults...
BusDiagnostics GetBusDiagnostics() const noexcept
Definition tle92466ed.hpp:906
constexpr uint16_t kChConfig
CH_CONFIG: slew, diagnosis, OL limits.
Definition tle92466ed_registers.hpp:71
constexpr uint32_t kOffDiagDisabled
OFF_DIAG_CH = 11B: diagnosis off.
Definition tle92466ed_registers.hpp:305
constexpr uint16_t kLowFreqRangeEn
LOW_FREQ_RANGE_EN: period times 8.
Definition tle92466ed_registers.hpp:273
constexpr uint16_t kPinFaultnFb
FAULTN pin level.
Definition tle92466ed_registers.hpp:231
constexpr uint16_t kAutoLimitDis
AUTO_LIMIT_DIS.
Definition tle92466ed_registers.hpp:256
constexpr uint16_t kDeepDither
DEEP_DITHER.
Definition tle92466ed_registers.hpp:293
constexpr uint16_t kChConfigReset
After reset: 10 V/us, diagnosis on.
Definition tle92466ed_registers.hpp:306
constexpr uint16_t kDiag0PorEvent
POR_EVENT (rw): power-on reset happened.
Definition tle92466ed_registers.hpp:121
constexpr uint16_t kPinEn
EN level.
Definition tle92466ed_registers.hpp:229
constexpr uint16_t kMask1ClkLow
CLK_LOW_MASK.
Definition tle92466ed_registers.hpp:199
constexpr uint32_t kStatSupNokInt
SUP_NOK_INT.
Definition tle92466ed_registers.hpp:245
constexpr uint16_t kCtrlReset
After reset.
Definition tle92466ed_registers.hpp:266
constexpr uint16_t kDiag2OtpEccErr
OTP_ECC_ERR (rwh): two clears (4.9.7).
Definition tle92466ed_registers.hpp:147
constexpr uint32_t kStatInitDone
Definition tle92466ed_registers.hpp:248
constexpr uint32_t kStatPorEvent
POR_event.
Definition tle92466ed_registers.hpp:242
constexpr uint16_t kPeriod
PERIOD: PWM frequency controller.
Definition tle92466ed_registers.hpp:66
constexpr uint16_t kSetpoint
SETPOINT: TARGET, AUTO_LIMIT_DIS.
Definition tle92466ed_registers.hpp:64
constexpr uint16_t kGlobalConfigReset
Definition tle92466ed_registers.hpp:104
constexpr uint16_t kErrOc
OC: overcurrent; two clears (4.9.6, 4.11.2).
Definition tle92466ed_registers.hpp:174
constexpr uint16_t kPinDrv0
DRV0 level.
Definition tle92466ed_registers.hpp:227
constexpr uint16_t kIntegratorLimitReset
After reset: 1023 and 16.
Definition tle92466ed_registers.hpp:281
constexpr uint16_t kGlobalConfigVioSel
VIO_SEL: 0 = 3.3 V, 1 = 5.0 V.
Definition tle92466ed_registers.hpp:103
constexpr uint32_t kStatResEvent
RES_event.
Definition tle92466ed_registers.hpp:241
constexpr uint16_t kDitherClkDiv
DITHER_CLK_DIV: t_ref_clk, sync.
Definition tle92466ed_registers.hpp:68
constexpr uint16_t kMode
MODE (Config Mode only): CH_MODE.
Definition tle92466ed_registers.hpp:72
constexpr uint16_t kChCtrlPar45
CH_PAR_4_5 (Config Mode only).
Definition tle92466ed_registers.hpp:90
constexpr uint16_t kDiag0Flags
The rwh fault flags, cleared by a write of 1 (section 4.1.2).
Definition tle92466ed_registers.hpp:125
constexpr uint16_t kMask0SupExt
SUP_NOK_EXT_MASK.
Definition tle92466ed_registers.hpp:195
constexpr uint16_t kCtrl
CTRL: ICC threshold, OLSG warning.
Definition tle92466ed_registers.hpp:65
constexpr uint16_t kCtrlIntThreshReset
After reset.
Definition tle92466ed_registers.hpp:316
constexpr uint16_t kChCtrlEnMask
EN_CH0..5, bits 5..0.
Definition tle92466ed_registers.hpp:89
constexpr uint16_t kGlobalConfigCrcEn
CRC_EN: check MOSI frame CRCs.
Definition tle92466ed_registers.hpp:102
constexpr uint16_t kMask1CotErr
COTERR_MASK.
Definition tle92466ed_registers.hpp:198
constexpr uint16_t kOlsgWarnEn
OLSG_WARN_EN.
Definition tle92466ed_registers.hpp:265
constexpr uint16_t kMask0EnPin
EN_PIN_MASK.
Definition tle92466ed_registers.hpp:193
constexpr uint16_t kClkDivReset
After reset: REFDIV 2, FBDIV 56, internal.
Definition tle92466ed_registers.hpp:211
constexpr uint16_t kChCtrlPar03
CH_PAR_0_3 (Config Mode only).
Definition tle92466ed_registers.hpp:91
constexpr uint16_t kMask2SpiWd
SPI_WD_MASK.
Definition tle92466ed_registers.hpp:202
constexpr uint32_t kStatCotErr
COTERR.
Definition tle92466ed_registers.hpp:239
constexpr uint16_t kDitherSetpointSyncEn
DITHER_SETPOINT_SYNC_EN.
Definition tle92466ed_registers.hpp:289
constexpr uint16_t kFbIAvg
FB_I_AVG (22 bits): I_AVG_MANT, EXP.
Definition tle92466ed_registers.hpp:77
constexpr uint16_t kVbatThReset
After reset: UV 25 (4.05 V), OV 255.
Definition tle92466ed_registers.hpp:156
constexpr uint32_t kStatCotWarn
COTWARN.
Definition tle92466ed_registers.hpp:240
constexpr uint32_t kData22Mask
Data of a 22-bit reply.
Definition tle92466ed_registers.hpp:357
constexpr uint32_t kStatSpiWdErr
SPI_WD_ERR.
Definition tle92466ed_registers.hpp:247
constexpr uint16_t kMask0Reset
After reset.
Definition tle92466ed_registers.hpp:196
constexpr uint16_t kPinDrv1
DRV1 level.
Definition tle92466ed_registers.hpp:228
constexpr uint32_t kStatSupNokExt
SUP_NOK_EXT.
Definition tle92466ed_registers.hpp:244
constexpr uint16_t kFbIminImax
FB_IMIN_IMAX (22 bits).
Definition tle92466ed_registers.hpp:78
constexpr uint16_t kFbDc
FB_DC (22 bits): TP_MANT, TO_MANT.
Definition tle92466ed_registers.hpp:75
constexpr uint16_t kMask2DataErr
DATA_ERR_MASK.
Definition tle92466ed_registers.hpp:201
constexpr uint16_t kMask0SupInt
SUP_NOK_INT_MASK.
Definition tle92466ed_registers.hpp:194
constexpr uint16_t kPinFaultn
FAULTN internal: 0 = fault.
Definition tle92466ed_registers.hpp:230
constexpr uint16_t kGlobalConfigClkWdEn
CLK_WD_EN: clock watchdog.
Definition tle92466ed_registers.hpp:100
constexpr uint16_t kDitherPwmSyncEn
DITHER_PWM_SYNC_EN.
Definition tle92466ed_registers.hpp:288
constexpr uint16_t kChCtrlPar12
CH_PAR_1_2 (Config Mode only).
Definition tle92466ed_registers.hpp:92
constexpr uint16_t kDitherStep
DITHER_STEP: STEPS, FLAT.
Definition tle92466ed_registers.hpp:69
constexpr uint32_t kChModeMeasurement
CH_MODE = CH: free-running measurement.
Definition tle92466ed_registers.hpp:312
constexpr uint16_t kCtrlIntThresh
CTRL_INT_THRESH: ICC start threshold.
Definition tle92466ed_registers.hpp:74
constexpr uint16_t kFbPeriodMinMax
Definition tle92466ed_registers.hpp:81
constexpr uint16_t kChCtrlOpMode
OP_MODE: 0 Config Mode, 1 Mission Mode.
Definition tle92466ed_registers.hpp:93
constexpr uint16_t kDitherCtrl
DITHER_CTRL: STEP_SIZE, fast feedback.
Definition tle92466ed_registers.hpp:70
constexpr uint16_t kGlobalConfigSpiWdEn
SPI_WD_EN: SPI watchdog.
Definition tle92466ed_registers.hpp:101
constexpr uint16_t kDiag2RegEccErr
REG_ECC_ERR (rwh).
Definition tle92466ed_registers.hpp:146
constexpr uint32_t kStatClkNok
CLK_NOK.
Definition tle92466ed_registers.hpp:238
constexpr uint16_t kClkDivExtClk
EXT_CLK: 1 = clock from the CLK pin.
Definition tle92466ed_registers.hpp:210
constexpr uint16_t kIntegratorLimit
INTEGRATOR_LIMIT: ICC limits.
Definition tle92466ed_registers.hpp:67
constexpr uint16_t kDiag0ResEvent
RES_EVENT (rw): RESN reset happened.
Definition tle92466ed_registers.hpp:120
constexpr uint16_t kPwmPeriodCalcMode
PWM_PERIOD_CALC_MODE.
Definition tle92466ed_registers.hpp:263
constexpr uint32_t kStatDataErr
DATA_err: OTP ECC, OTP virgin, HVADC.
Definition tle92466ed_registers.hpp:243
constexpr uint16_t kMask1Reset
After reset.
Definition tle92466ed_registers.hpp:200
constexpr uint16_t kFbVbat
FB_VBAT (22 bits): VBAT, EXP, counters.
Definition tle92466ed_registers.hpp:76
constexpr uint16_t kTon
TON: on-time, OLSG time-out.
Definition tle92466ed_registers.hpp:73
constexpr uint16_t kMask2Reset
After reset.
Definition tle92466ed_registers.hpp:203
constexpr uint16_t kMask1CotWarn
COTWARN_MASK.
Definition tle92466ed_registers.hpp:197
Error
Why a call failed. Every call of the driver returns one of these in its Result.
Definition tle92466ed_types.hpp:37
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
ChannelMode
How a channel drives its output (MODE.CH_MODE, section 5.3.3.11).
Definition tle92466ed_types.hpp:238
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
ParallelPair
The channel pairs that can drive one load together (section 4.5.2).
Definition tle92466ed_types.hpp:229
constexpr uint32_t kChannelCount
Number of output channels (section 4.5.1).
Definition tle92466ed_types.hpp:226
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
Channel
One of the six output channels.
Definition tle92466ed_types.hpp:217
LogLevel
Severity passed to the optional Log() hook.
Definition tle92466ed_types.hpp:201
@ None
No extra frame and no compare. The default.
@ Measurement
Free-running measurement, switch off (4.4.3); CH_MODE = CH.
@ Off
Output off, no measurement. Reset value.
@ V5V0
5.0 V. Reset value.
@ Internal
The internal oscillator; the dividers are ignored. Reset value.
@ External
The CLK pin, Config::external_clock_khz.
@ Info
Lifecycle events: initialised, reset.
The TLE92466ED driver: everything it declares lives here; internals in detail.
Definition tle92466ed.hpp:26
GpioSignal
Logical level of a control pin; the port maps it to the physical polarity.
Definition tle92466ed_spi_interface.hpp:87
@ ACTIVE
The pin function is asserted.
CtrlPin
The chip's control pins the port drives (GpioSet) or reads (GpioRead).
Definition tle92466ed_spi_interface.hpp:77
@ Reset
RESN, active low: ACTIVE holds the chip in reset (section 4.2.3).
The result of the safety flip-flop self-test (SFF_BIST, section 4.9.8).
Definition tle92466ed_types.hpp:624
Counters of the protocol layer (handbook KB-ARCH-044). No I/O to read them.
Definition tle92466ed_types.hpp:656
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
One measurement period of a channel's feedback, read under the freeze of section 4....
Definition tle92466ed_types.hpp:641
int32_t average_current_ua
Definition tle92466ed_types.hpp:642
The unique chip identification, CHIPID0..2 (sections 5.3.2.24 to 5.3.2.26).
Definition tle92466ed_types.hpp:631
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
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
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
FB_STAT, the chip's one-word status summary, decoded (section 5.3.2.21).
Definition tle92466ed_types.hpp:588
bool init_done
INIT_DONE: clock and logic ready.
Definition tle92466ed_types.hpp:589
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
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 drv0
DRV0 is high.
Definition tle92466ed_types.hpp:616
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
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
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,...
TLE92466ED register map: addresses, bit fields, reset values and the frame CRC (datasheet section 5....
The SPI port of the TLE92466ED driver: the CRTP base, its pin enums, the SpiPort concept,...
Public types of the TLE92466ED driver: errors, Result<T>, configuration, decoded status and feedback,...