TLE92466ED Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Enumerations
tle92466ed_spi_interface.hpp File Reference

The SPI port of the TLE92466ED driver: the CRTP base, its pin enums, the SpiPort concept, the bus requirements, and the frame codec and pipeline of section 5.2. More...

#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include "tle92466ed_detail.hpp"
#include "tle92466ed_registers.hpp"
#include "tle92466ed_types.hpp"

Go to the source code of this file.

Classes

class  tle92466ed::SpiInterface< Derived >
 CRTP base of the platform SPI port. More...
 

Namespaces

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

Concepts

concept  tle92466ed::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  tle92466ed::CtrlPin : uint8_t {
  tle92466ed::Reset = 0 , tle92466ed::Enable = 1 , tle92466ed::Drv0 = 2 , tle92466ed::Drv1 = 3 ,
  tle92466ed::Fault = 4
}
 The chip's control pins the port drives (GpioSet) or reads (GpioRead). More...
 
enum class  tle92466ed::GpioSignal : uint8_t { tle92466ed::INACTIVE = 0 , tle92466ed::ACTIVE = 1 }
 Logical level of a control pin; the port maps it to the physical polarity. More...
 

Variables

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 tle92466ed::kSpiMode = 1
 
constexpr bool tle92466ed::kMsbFirst = true
 Each frame is sent most significant bit first, on SI and SO alike (section 5.2.1).
 
constexpr uint32_t tle92466ed::kMaxClockHz = 8'000'000
 Highest SCK frequency, f_SCK max (Table 18).
 
constexpr uint32_t tle92466ed::kMinCsHighNs = 600
 Shortest CSN high time between two frames, t_CSN_TD (Table 18).
 
constexpr uint32_t tle92466ed::kCsSetupNs = 250
 CSN falling edge to the first SCK rising edge, t_CSN_LEAD (Table 18).
 
constexpr uint32_t tle92466ed::kCsHoldNs = 250
 Last SCK falling edge to CSN rising, t_CSN_LAG (Table 18).
 
constexpr bool tle92466ed::kContinuousWord = false
 
constexpr std::size_t tle92466ed::kFrameBytes = 4
 Bytes per transfer: one 32-bit frame per CSN low period (section 5.1.1).
 

Detailed Description

The SPI port of the TLE92466ED driver: the CRTP base, its pin enums, the SpiPort concept, the bus requirements, and the frame codec and pipeline of section 5.2.

The driver never calls an SDK. It calls hooks on a class you derive from tle92466ed::SpiInterface<Self>:

Hook Contract
bool EnsureInitialized() noexcept Bring the bus and the control outputs up on the first call, each output at its idle level; true at once afterwards
bool Transfer(const uint8_t* tx, uint8_t* rx, std::size_t len) noexcept One full-duplex transfer of len = 4 bytes, both buffers given, CSN low for the 32 bits and high after
void DelayUs(uint32_t us) noexcept Wait at least us microseconds

Every frame is 32 bits in one CSN low period (section 5.1.1): a transfer of any other length is ignored by the chip. The port moves raw bytes: it never retries, never interprets the frame and never configures the chip. What the chip needs from the bus is below as constexpr values (kSpiMode to kFrameBytes, Table 18); a port checks its settings against them with static_assert.

Control pins and their idle levels (handbook KB-HW-018): the port drives each output to its idle level before it enables the pin's output driver and before the first transfer. RESN idles in reset (GpioSignal::ACTIVE, low: every channel off until the driver releases it), EN idles low (GpioSignal::INACTIVE: every channel off), DRV0 and DRV1 idle low (INACTIVE). FAULTN is an open-drain input. A pin that is not wired to the MCU returns true from GpioSet() without doing anything (RESN pulled up, EN tied high, DRVx tied to GND).