TLE92466ED Driver 0.1.0-dev
Modern C++20 driver for Infineon TLE92466ED Six-Channel Low-Side Solenoid Driver
Loading...
Searching...
No Matches
esp32_tle92466ed_test_config.hpp
Go to the documentation of this file.
1
13#pragma once
14
15#include <cstdint>
16
17//==============================================================================
18// COMPILE-TIME CONFIGURATION FLAGS
19//==============================================================================
20
35#ifndef ESP32_TLE_COMM_ENABLE_DETAILED_SPI_LOGGING
36#define ESP32_TLE_COMM_ENABLE_DETAILED_SPI_LOGGING 0
37#endif
38
40
47struct SPIPins {
48 static constexpr uint8_t MISO = 2;
49 static constexpr uint8_t MOSI = 7;
50 static constexpr uint8_t SCLK = 6;
51 static constexpr uint8_t CS = 18;
52};
53
61 static constexpr uint8_t RESN = 21;
62 static constexpr uint8_t EN = 20;
63 static constexpr uint8_t FAULTN = 19;
64 static constexpr uint8_t DRV0 = 22;
65 static constexpr uint8_t DRV1 = 23;
66};
67
74struct ADCConfig {
75 static constexpr uint8_t PIN = 0;
76 static constexpr float VREF_MV = 3300.0f;
77 static constexpr float MIN_VOLTAGE = 0.0f;
78 static constexpr float MAX_VOLTAGE = 3.3f;
79};
80
95struct SPIParams {
96 static constexpr uint32_t FREQUENCY = 1000000;
97 static constexpr uint8_t MODE = 1;
98 static constexpr uint8_t QUEUE_SIZE = 1;
99 static constexpr uint8_t CS_ENA_PRETRANS = 1;
100 static constexpr uint8_t CS_ENA_POSTTRANS = 1;
101};
102
111 static constexpr uint16_t SINGLE_CHANNEL_MIN = 0;
112 static constexpr uint16_t SINGLE_CHANNEL_MAX = 2000;
113 static constexpr uint16_t PARALLEL_CHANNEL_MAX = 4000;
114 static constexpr uint16_t RESOLUTION = 61;
115};
116
124 static constexpr float VBAT_MIN = 8.0f;
125 static constexpr float VBAT_NOM = 12.0f;
126 static constexpr float VBAT_MAX = 28.0f;
127 static constexpr float VDD_NOM = 3.3f;
128};
129
136 static constexpr int16_t OPERATING_MIN = -40;
137 static constexpr int16_t OPERATING_MAX = 150;
138 static constexpr int16_t JUNCTION_MAX = 150;
139 static constexpr int16_t WARNING_THRESHOLD = 130;
140};
141
147struct Timing {
148 static constexpr uint16_t CS_SETUP_US = 1;
149 static constexpr uint16_t CS_HOLD_US = 1;
150 static constexpr uint16_t INTER_FRAME_US = 10;
151 static constexpr uint16_t POWER_ON_DELAY_MS = 50;
152 static constexpr uint16_t RESET_DELAY_MS = 10;
153};
154
161 static constexpr uint16_t OVERCURRENT_THRESHOLD_MA = 2100;
162 static constexpr uint16_t POLL_INTERVAL_MS = 100;
163 static constexpr uint8_t MAX_RETRY_COUNT = 3;
164};
165
172 static constexpr uint16_t DEFAULT_TEST_CURRENT = 500;
173 static constexpr uint16_t TEST_DURATION_MS = 5000;
174 static constexpr uint16_t RAMP_STEP_MA = 100;
175 static constexpr uint16_t RAMP_STEP_DELAY_MS = 500;
176};
177
183struct AppConfig {
184 // Logging
185 static constexpr bool ENABLE_DEBUG_LOGGING = true;
186 static constexpr bool ENABLE_SPI_LOGGING = false;
187
188 // Performance
189 static constexpr bool ENABLE_PERFORMANCE_MONITORING = true;
190 static constexpr uint16_t STATS_REPORT_INTERVAL_MS = 10000;
191
192 // Error handling
193 static constexpr bool ENABLE_AUTO_RECOVERY = true;
194 static constexpr uint8_t MAX_ERROR_COUNT = 10;
195};
196
197} // namespace TLE92466ED_TestConfig
198
205 "Single channel current exceeds hardware limit of 2000mA");
206
208 "Parallel channel current exceeds hardware limit of 4000mA");
209
210static_assert(TLE92466ED_TestConfig::SPIParams::FREQUENCY <= 8000000,
211 "SPI frequency exceeds TLE92466ED maximum of 8MHz");
212
214 "TLE92466ED requires SPI Mode 1 (CPOL=0, CPHA=1)");
215
219#define TLE92466ED_VALIDATE_CURRENT(current_ma) \
220 static_assert((current_ma) <= TLE92466ED_TestConfig::CurrentLimits::SINGLE_CHANNEL_MAX, \
221 "Current exceeds maximum limit")
222
226#define TLE92466ED_VALIDATE_GPIO(pin) \
227 static_assert((pin) >= 0 && (pin) < 30, "Invalid GPIO pin number for ESP32-C6")
228
Definition esp32_tle92466ed_test_config.hpp:39
ADC Configuration for Solenoid Control Test.
Definition esp32_tle92466ed_test_config.hpp:74
static constexpr float MAX_VOLTAGE
Maximum input voltage (V)
Definition esp32_tle92466ed_test_config.hpp:78
static constexpr uint8_t PIN
GPIO0 - ADC input pin (ADC1_CH0)
Definition esp32_tle92466ed_test_config.hpp:75
static constexpr float VREF_MV
Reference voltage in millivolts (3.3V)
Definition esp32_tle92466ed_test_config.hpp:76
static constexpr float MIN_VOLTAGE
Minimum input voltage (V)
Definition esp32_tle92466ed_test_config.hpp:77
Application-specific Configuration.
Definition esp32_tle92466ed_test_config.hpp:183
static constexpr bool ENABLE_AUTO_RECOVERY
Enable automatic error recovery.
Definition esp32_tle92466ed_test_config.hpp:193
static constexpr bool ENABLE_DEBUG_LOGGING
Enable detailed debug logs.
Definition esp32_tle92466ed_test_config.hpp:185
static constexpr uint16_t STATS_REPORT_INTERVAL_MS
Statistics reporting interval.
Definition esp32_tle92466ed_test_config.hpp:190
static constexpr uint8_t MAX_ERROR_COUNT
Maximum errors before failsafe.
Definition esp32_tle92466ed_test_config.hpp:194
static constexpr bool ENABLE_SPI_LOGGING
Enable SPI transaction logs.
Definition esp32_tle92466ed_test_config.hpp:186
static constexpr bool ENABLE_PERFORMANCE_MONITORING
Enable performance metrics.
Definition esp32_tle92466ed_test_config.hpp:189
Control GPIO Pins for TLE92466ED.
Definition esp32_tle92466ed_test_config.hpp:60
static constexpr uint8_t DRV0
GPIO pin for DRV0 external drive control.
Definition esp32_tle92466ed_test_config.hpp:64
static constexpr uint8_t RESN
GPIO21 - Reset pin (active low, must be HIGH for operation)
Definition esp32_tle92466ed_test_config.hpp:61
static constexpr uint8_t EN
GPIO20 - Enable pin (active high, enables outputs)
Definition esp32_tle92466ed_test_config.hpp:62
static constexpr uint8_t FAULTN
GPIO19 - Fault pin (active low, indicates fault condition)
Definition esp32_tle92466ed_test_config.hpp:63
static constexpr uint8_t DRV1
GPIO pin for DRV1 external drive control.
Definition esp32_tle92466ed_test_config.hpp:65
Current Control Limits (milliamps)
Definition esp32_tle92466ed_test_config.hpp:110
static constexpr uint16_t PARALLEL_CHANNEL_MAX
Maximum parallel channel current (mA)
Definition esp32_tle92466ed_test_config.hpp:113
static constexpr uint16_t RESOLUTION
Current resolution (μA per LSB)
Definition esp32_tle92466ed_test_config.hpp:114
static constexpr uint16_t SINGLE_CHANNEL_MIN
Minimum current (mA)
Definition esp32_tle92466ed_test_config.hpp:111
static constexpr uint16_t SINGLE_CHANNEL_MAX
Maximum single channel current (mA)
Definition esp32_tle92466ed_test_config.hpp:112
Diagnostic Thresholds.
Definition esp32_tle92466ed_test_config.hpp:160
static constexpr uint16_t OVERCURRENT_THRESHOLD_MA
Overcurrent fault threshold (mA)
Definition esp32_tle92466ed_test_config.hpp:161
static constexpr uint8_t MAX_RETRY_COUNT
Maximum communication retries.
Definition esp32_tle92466ed_test_config.hpp:163
static constexpr uint16_t POLL_INTERVAL_MS
Diagnostic polling interval (ms)
Definition esp32_tle92466ed_test_config.hpp:162
SPI Communication Parameters.
Definition esp32_tle92466ed_test_config.hpp:95
static constexpr uint8_t MODE
SPI Mode 1 (CPOL=0, CPHA=1)
Definition esp32_tle92466ed_test_config.hpp:97
static constexpr uint32_t FREQUENCY
1MHz SPI frequency
Definition esp32_tle92466ed_test_config.hpp:96
static constexpr uint8_t CS_ENA_PRETRANS
CS asserted N clock cycles before transaction.
Definition esp32_tle92466ed_test_config.hpp:99
static constexpr uint8_t CS_ENA_POSTTRANS
CS held N clock cycles after transaction.
Definition esp32_tle92466ed_test_config.hpp:100
static constexpr uint8_t QUEUE_SIZE
Transaction queue size.
Definition esp32_tle92466ed_test_config.hpp:98
SPI Configuration for ESP32-C6.
Definition esp32_tle92466ed_test_config.hpp:47
static constexpr uint8_t CS
GPIO18 - Chip Select (active low)
Definition esp32_tle92466ed_test_config.hpp:51
static constexpr uint8_t MOSI
GPIO7 - SPI MOSI (Master Out Slave In)
Definition esp32_tle92466ed_test_config.hpp:49
static constexpr uint8_t SCLK
GPIO6 - SPI Clock.
Definition esp32_tle92466ed_test_config.hpp:50
static constexpr uint8_t MISO
GPIO2 - SPI MISO (Master In Slave Out)
Definition esp32_tle92466ed_test_config.hpp:48
Supply Voltage Specifications (volts)
Definition esp32_tle92466ed_test_config.hpp:123
static constexpr float VBAT_MAX
Maximum VBAT voltage (V)
Definition esp32_tle92466ed_test_config.hpp:126
static constexpr float VBAT_MIN
Minimum VBAT voltage (V)
Definition esp32_tle92466ed_test_config.hpp:124
static constexpr float VDD_NOM
Logic supply voltage (V)
Definition esp32_tle92466ed_test_config.hpp:127
static constexpr float VBAT_NOM
Nominal VBAT voltage (V)
Definition esp32_tle92466ed_test_config.hpp:125
Temperature Specifications (celsius)
Definition esp32_tle92466ed_test_config.hpp:135
static constexpr int16_t OPERATING_MAX
Maximum operating temperature (°C)
Definition esp32_tle92466ed_test_config.hpp:137
static constexpr int16_t WARNING_THRESHOLD
Temperature warning threshold (°C)
Definition esp32_tle92466ed_test_config.hpp:139
static constexpr int16_t JUNCTION_MAX
Maximum junction temperature (°C)
Definition esp32_tle92466ed_test_config.hpp:138
static constexpr int16_t OPERATING_MIN
Minimum operating temperature (°C)
Definition esp32_tle92466ed_test_config.hpp:136
Test Configuration.
Definition esp32_tle92466ed_test_config.hpp:171
static constexpr uint16_t TEST_DURATION_MS
Test duration (ms)
Definition esp32_tle92466ed_test_config.hpp:173
static constexpr uint16_t DEFAULT_TEST_CURRENT
Default test current (mA)
Definition esp32_tle92466ed_test_config.hpp:172
static constexpr uint16_t RAMP_STEP_DELAY_MS
Delay between ramp steps (ms)
Definition esp32_tle92466ed_test_config.hpp:175
static constexpr uint16_t RAMP_STEP_MA
Current ramp step size (mA)
Definition esp32_tle92466ed_test_config.hpp:174
Timing Parameters (microseconds)
Definition esp32_tle92466ed_test_config.hpp:147
static constexpr uint16_t POWER_ON_DELAY_MS
Power-on initialization delay (ms)
Definition esp32_tle92466ed_test_config.hpp:151
static constexpr uint16_t INTER_FRAME_US
Minimum time between frames (μs)
Definition esp32_tle92466ed_test_config.hpp:150
static constexpr uint16_t RESET_DELAY_MS
Reset pulse duration (ms)
Definition esp32_tle92466ed_test_config.hpp:152
static constexpr uint16_t CS_HOLD_US
CS hold time after SCLK (μs)
Definition esp32_tle92466ed_test_config.hpp:149
static constexpr uint16_t CS_SETUP_US
CS setup time before SCLK (μs)
Definition esp32_tle92466ed_test_config.hpp:148