-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathKconfig
More file actions
193 lines (165 loc) · 7.09 KB
/
Kconfig
File metadata and controls
193 lines (165 loc) · 7.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
menu "espFoC Settings"
menu "Core"
config NOOF_AXIS
int "Number of motor outputs"
range 1 4
default 1
help
Number of FOC channel sets. Each set uses a full inverter,
encoder and current-sensor stack up to the driver limits.
config FOC_TASK_STACK_SIZE
int "Regulator / runner task stack size (bytes)"
default 3072
config ESP_FOC_PWM_RATE_HZ
int "PWM switching frequency [Hz] (MCPWM carrier)"
range 1000 100000
default 20000
help
Carrier frequency for espFoC MCPWM inverter drivers and for
control-loop timing (dt = 1/PWM). Build-time PI autotuning uses
the same value when ESP_FOC_USE_AUTOGEN_GAINS is enabled.
config ESP_FOC_DC_LINK_NOMINAL_MV
int "Nominal DC bus voltage [mV] (SVPWM / Ud Uq volt scaling)"
range 1000 60000
default 12000
help
Used by MCPWM inverter get_dc_link_voltage() when the constructor
dc_link_voltage argument is <= 0. Ud/Uq and SVPWM math assume the
same volt basis as this nominal rail; wrong values make small
tuner voltage commands map to the wrong modulation depth (e.g.
Q16_ONE=1 V treated as full bus made 0.1 V look like 10% PWM).
config ESP_FOC_CUSTOM_MATH
bool "Use espFoC Q16 fast math (LUT sin/cos, etc.)"
default y
endmenu
menu "Scope (telemetry)"
config ESP_FOC_SCOPE
bool "Enable scope channel support"
default n
config ESP_FOC_SCOPE_NUM_CHANNELS
int "Max scope channels"
default 8
config ESP_FOC_SCOPE_LEGACY_CSV
bool "Use legacy SCOPE as CSV floats (sprintf)"
depends on ESP_FOC_SCOPE
default n
help
When n (default) the link sends SCOPE v1 binary (Q16 int32
per channel, see host scope_sample.py). When y, the old
comma-separated %f line is used for a matching host build.
config ESP_FOC_SCOPE_BUFFER_SIZE
int "Scope ring buffer (frames per half-buffer)"
default 4096 if ESP_FOC_SCOPE_NUM_CHANNELS = 8
default 1024
endmenu
menu "Optional hardware drivers"
config ESP_FOC_ENABLE_PCNT_DRIVER
bool "Build PCNT-based rotor sensor driver (encoder pulse counting)"
default n
endmenu
menu "Control loop"
config ESP_FOC_CURRENT_FILTER_CUTOFF_HZ
int "Isensor biquad low-pass cutoff [Hz]"
default 300
help
Cutoff of the 2nd-order Butterworth on raw ADC before gain scaling.
Overridable at runtime when NVS calibration is used.
config ESP_FOC_VELOCITY_FILTER_CUTOFF_HZ
int "Encoder velocity biquad cutoff [Hz]"
default 50
config ESP_FOC_ISR_HOT_PATH
bool "Run inner current loop in PWM timer ISR (full rate)"
default y
help
y: Park / current PI / inverse Park / set_voltages at PWM rate
(default 20 kHz). The user regulation task still runs at
pwm_rate / ESP_FOC_LOW_SPEED_DOWNSAMPLING in legacy path terms.
n: legacy 2.x task-sampled inner loop (lower bandwidth ceiling).
endmenu
menu "Diagnostics"
config ESP_FOC_DEBUG_CORE_TIMING
bool "GPIO pulse around the outer (slow) control loop (timing)"
default n
help
Calls esp_foc_debug_pin_set/clear in the high-level loop. You must
call esp_foc_debug_pin_init(gpio) once in application start; the
GPIO is not set from this menu.
endmenu
menu "Tuner, bridges, NVS"
config ESP_FOC_TUNER_ENABLE
bool "Runtime PI tuner and protocol (esp_foc_tuner)"
default n
help
Compiles the tuner; attach axes and handle requests from UART/USB.
config ESP_FOC_TUNER_ALWAYS_OVERRIDE_VOLTAGE_MODE
bool "Voltage mode + tuner override latched (bring-up)"
depends on ESP_FOC_TUNER_ENABLE
default n
help
Start with skip_torque_control enabled (open-loop Ud/Uq, no current PI).
After a successful CMD_ALIGN_AXIS, tuner override turns on automatically;
CMD_OVERRIDE_OFF is ignored so host motion writes stay enabled.
choice ESP_FOC_TUNER_BRIDGE
prompt "Tuner / scope link"
depends on ESP_FOC_TUNER_ENABLE
default ESP_FOC_BRIDGE_NONE
help
Physical bus for Tuner Studio or custom host tools.
config ESP_FOC_BRIDGE_NONE
bool "None (weak callbacks in application)"
config ESP_FOC_BRIDGE_UART
bool "UART"
help
Works on all targets with a hardware UART.
config ESP_FOC_BRIDGE_USBCDC
bool "USB device CDC (TinyUSB)"
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
help
Native USB on S2/S3/P4; add espressif/tinyusb component.
endchoice
if ESP_FOC_BRIDGE_UART
config ESP_FOC_BRIDGE_UART_NUM
int "UART port index"
range 0 2
default 1
config ESP_FOC_BRIDGE_UART_BAUD
int "UART baud"
default 921600
config ESP_FOC_BRIDGE_UART_TX_PIN
int "UART TX"
default 17
config ESP_FOC_BRIDGE_UART_RX_PIN
int "UART RX"
default 18
endif
config ESP_FOC_CALIBRATION_NVS
bool "Persist current-loop gains to NVS (requires NVS on chip)"
depends on ESP_FOC_TUNER_ENABLE
default y
endmenu
menu "Build-time PI autotuning"
config ESP_FOC_USE_AUTOGEN_GAINS
bool "Seed PI gains from scripts/motors/<profile>.json"
default y
help
When n, Kp/Ki start at zero until the runtime tuner sets them.
config ESP_FOC_PROFILE_VERSION
int "NVS profile invalidation / schema key"
depends on ESP_FOC_USE_AUTOGEN_GAINS
default 1
help
Bump to ignore older NVS calibrations for a given motor name.
config ESP_FOC_MOTOR_PROFILE
string "JSON profile name under scripts/motors/"
depends on ESP_FOC_USE_AUTOGEN_GAINS
default "mf400525t"
config ESP_FOC_AUTOGEN_DECIMATION
int "Autotuner assumed current-loop decimation (vs PWM rate)"
depends on ESP_FOC_USE_AUTOGEN_GAINS
default 1 if ESP_FOC_ISR_HOT_PATH
default 20
help
Current-loop fs = PWM / decimation. ISR_HOT_PATH = 1:1; legacy
task loop matches ESP_FOC_LOW_SPEED_DOWNSAMPLING (20) by default.
endmenu
endmenu