Quickstart¶
Run the driver on your PC first, with no hardware; then regulate a coil current from your MCU: wire the chip, write a small port class, call four driver functions.
Datasheet sections this page relies on
From Infineon IFX-ntz1491827137291 1.2:
- Pins, RESN, EN, DRV0/DRV1 and FAULTN: 2 Pin configuration; 4.2.3 TDS_I/O Pins, p. 7
All of them, with the driver API for each: Datasheet map.
Try it on your PC¶
examples/host/ runs the real driver against a simulated TLE92466ED, through a host
port. From the repository root, with CMake and a C++20 compiler:
cmake -S examples/host -B build-example
cmake --build build-example
./build-example/tle92466ed_host_example
TLE92466ED driver 0.1.0 on the host
tle92466ed: initialised, Config Mode
ICVID version 0xFE, reset watch armed
CH0 setpoint 399976 uA
CH0 397714 uA, duty 40.00 %, VBAT 13981 mV
The calls in main.cpp are the ones below; only the port differs on an MCU. CI builds
and runs this example on every pull request.
1. Wire it¶
| MCU | TLE92466ED | Notes |
|---|---|---|
| SPI SCK | SCK (6) | Mode 1, up to 8 MHz; 2 MHz for bring-up on jumper wires |
| SPI MOSI | SI (7) | |
| SPI MISO | SO (9) | Driven from VIO; high impedance while CSN is high |
| GPIO (chip select) | CSN (5) | Low for one 32-bit frame, then high for at least 600 ns |
| MCU supply | VIO (8) | 3.3 V or 5 V: set Config::vio to match |
| 5 V | VDD (29) | 4.5 V to 5.5 V, 100 nF to GND |
| Load supply | VBAT (22) | 6 V to 18 V; the valve between VBAT and LOAD0, a freewheeling diode to FWD0 |
| GND | GND, GNDP0..5, tab | All grounds together |
For this example tie RESN (26) and EN (27) to VIO through 10 kΩ, DRV0 and DRV1 to GND, and leave FAULTN open: a
port without GpioSet() then starts the chip by waiting t_POR. The Hardware page has every pin,
the timing and the application circuit.
2. Add the driver¶
Add the repository as a submodule and link the tle92466ed::tle92466ed CMake target. Installation
covers CMake on any MCU, the installed package and ESP-IDF.
git submodule add https://github.com/kokeb-labs-drivers/driver-tle92466ed.git external/driver-tle92466ed
3. Write the port¶
The port is the only platform code: it brings the bus up and moves 32-bit frames. Replace the platform_* calls
with your SDK's.
class MyPort : public tle92466ed::SpiInterface<MyPort> {
public:
// Bring the bus up once; later calls return true at once.
bool EnsureInitialized() noexcept {
if (!ready_) {
ready_ = platform_spi_init();
}
return ready_;
}
// One 32-bit frame: CSN low for the 4 bytes, both buffers given, CSN high after.
bool Transfer(const uint8_t* tx, uint8_t* rx, std::size_t len) noexcept {
return platform_spi_transfer(tx, rx, len);
}
// Wait at least `us` microseconds: t_POR and the INIT_DONE polls depend on it.
void DelayUs(uint32_t us) noexcept {
platform_delay_us(us);
}
private:
bool ready_ = false;
};
Porting explains each method, the optional hooks and the transfer rules.
4. Drive a valve¶
#include "tle92466ed.hpp"
int drive_one_valve(MyPort& port) {
tle92466ed::Config config{}; // reset values, no channel loaded
config.vio = tle92466ed::VioLevel::V3V3; // the board's VIO
config.channels[0] = tle92466ed::CurrentControlChannel(); // CH0: a valve, ICC, 1 kHz PWM
tle92466ed::TLE92466ED<MyPort> driver(port, config); // no I/O yet
if (auto r = driver.EnsureInitialized(); !r) { // 1. reset, INIT_DONE, ICVID, every register
return static_cast<int>(r.error); // Bus, NoDevice, Timeout: check the wiring
}
if (auto r = driver.EnterMissionMode(); !r) { // 2. EN high, OP_MODE = 1
return static_cast<int>(r.error); // MissionBlocked: read the faults
}
if (auto r = driver.SetCurrent(tle92466ed::Channel::Ch0, 400'000); !r) { // 3. 400 mA
return static_cast<int>(r.error);
}
return static_cast<int>(driver.EnableChannel(tle92466ed::Channel::Ch0).error); // 4. on
}
What each step does:
EnsureInitialized()brings the port up, resets or waits out the chip, waits for INIT_DONE, checks ICVID, reports and clears the faults found, and writes every register. The chip is in Config Mode, every channel off.EnterMissionMode()checks that no supply, clock or watchdog fault holds the chip in Config Mode, then sets OP_MODE. Only in Mission Mode do the channels switch and their diagnosis run.SetCurrent()programs the average current; the value is checked against 1.5 A, rounded to the 61 µA TARGET step, and the programmed current is returned.EnableChannel()sets EN_CH0: the integrating current controller now holds 400 mA through the valve.
This example is built by the host CI, so it compiles against the current headers.
If it does not work¶
| Symptom | First thing to check |
|---|---|
EnsureInitialized() returns Bus |
Your port's EnsureInitialized() or Transfer() returned false |
EnsureInitialized() returns NoDevice |
VIO, SO and CSN: MISO reads all zeros or all ones (Troubleshooting) |
EnsureInitialized() returns Crc or ReplyMismatch |
The SPI mode (it must be 1) and the clock |
EnsureInitialized() returns Timeout |
VDD and RESN: INIT_DONE never read 1 |
EnterMissionMode() returns MissionBlocked |
Config::vio against the real VIO, then ReadFaults() |
ReadChannelFeedback() returns NotReady |
The channel's dither clock: no measurement period without one |
Next¶
- API guide: states, channels, feedback, faults, the watchdog, errors.
- Configuration: the current-control preset, every
Configfield, Kconfig. - Examples: the host example and the ESP32 example.
- Status and limitations: what still needs a bench.