mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 10:12:52 +00:00
[tmc2209] Add driver diagnostics and stall detection (#20618)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1d8423edd8
commit
55261ae7e5
@@ -6,6 +6,7 @@ stepper:
|
||||
step_pin: ${step_pin}
|
||||
dir_pin: ${dir_pin}
|
||||
enn_pin: ${enn_pin}
|
||||
diag_pin: ${diag_pin}
|
||||
rsense: 110 mOhm
|
||||
vsense: false
|
||||
ottrim: 1
|
||||
@@ -15,6 +16,17 @@ stepper:
|
||||
max_speed: 2000 steps/s
|
||||
acceleration: 1000 steps/s^2
|
||||
deceleration: 1000 steps/s^2
|
||||
on_stall:
|
||||
- stepper.report_position:
|
||||
id: tmc2209_step_dir
|
||||
position: 0
|
||||
- stepper.set_target:
|
||||
id: tmc2209_step_dir
|
||||
target: 0
|
||||
on_status:
|
||||
- logger.log:
|
||||
format: "Driver event %u active %d"
|
||||
args: [event, active]
|
||||
|
||||
- platform: tmc2209
|
||||
id: tmc2209_serial
|
||||
@@ -24,6 +36,12 @@ stepper:
|
||||
clock_frequency: 12MHz
|
||||
analog_current_scale: true
|
||||
max_speed: 1000 steps/s
|
||||
on_status:
|
||||
- if:
|
||||
condition:
|
||||
lambda: "return event == tmc22xx::DRIVER_EVENT_OVERTEMPERATURE_PREWARNING && active;"
|
||||
then:
|
||||
- tmc2209.disable: tmc2209_serial
|
||||
|
||||
esphome:
|
||||
on_boot:
|
||||
@@ -49,6 +67,17 @@ esphome:
|
||||
id: tmc2209_serial
|
||||
irun: 20
|
||||
ihold: !lambda "return 5;"
|
||||
- tmc2209.stallguard:
|
||||
id: tmc2209_step_dir
|
||||
threshold: 50
|
||||
tcool_threshold: !lambda "return 400;"
|
||||
- tmc2209.coolconf:
|
||||
id: tmc2209_step_dir
|
||||
semin: 5
|
||||
semax: 2
|
||||
seup: 1
|
||||
sedn: 0
|
||||
seimin: true
|
||||
- tmc2209.enable: tmc2209_serial
|
||||
- stepper.set_target:
|
||||
id: tmc2209_serial
|
||||
|
||||
@@ -3,6 +3,7 @@ substitutions:
|
||||
dir_pin: GPIO13
|
||||
enn_pin: GPIO14
|
||||
index_pin: GPIO15
|
||||
diag_pin: GPIO4
|
||||
|
||||
packages:
|
||||
uart_115200: !include ../../test_build_components/common/uart_115200/esp32-idf.yaml
|
||||
|
||||
@@ -3,6 +3,7 @@ substitutions:
|
||||
dir_pin: GPIO13
|
||||
enn_pin: GPIO14
|
||||
index_pin: GPIO15
|
||||
diag_pin: GPIO2
|
||||
|
||||
packages:
|
||||
uart_115200: !include ../../test_build_components/common/uart_115200/esp8266-ard.yaml
|
||||
|
||||
@@ -3,6 +3,7 @@ substitutions:
|
||||
dir_pin: GPIO3
|
||||
enn_pin: GPIO6
|
||||
index_pin: GPIO7
|
||||
diag_pin: GPIO8
|
||||
|
||||
packages:
|
||||
uart_115200: !include ../../test_build_components/common/uart_115200/rp2040-ard.yaml
|
||||
|
||||
Reference in New Issue
Block a user