diff --git a/firmware/controllers/actuators/dc_motors.cpp b/firmware/controllers/actuators/dc_motors.cpp index 3619cab9d4..0f0c0fcd10 100644 --- a/firmware/controllers/actuators/dc_motors.cpp +++ b/firmware/controllers/actuators/dc_motors.cpp @@ -64,6 +64,11 @@ public: // Clamp to >100hz int clampedFrequency = maxI(100, frequency); + if (clampedFrequency > ETB_HW_MAX_FREQUENCY) { + firmwareError(OBD_PCM_Processor_Fault, "Electronic throttle frequency too high, maximum %d hz", ETB_HW_MAX_FREQUENCY); + return; + } + if (useTwoWires) { m_pinEnable.initPin("ETB Enable", pinEnable); diff --git a/firmware/hw_layer/ports/stm32/stm32_common.cpp b/firmware/hw_layer/ports/stm32/stm32_common.cpp index 66ebdb17e8..97c1e41198 100644 --- a/firmware/hw_layer/ports/stm32/stm32_common.cpp +++ b/firmware/hw_layer/ports/stm32/stm32_common.cpp @@ -177,10 +177,8 @@ public: // If we have too few usable bits, we run out of resolution, so don't allow that either. // 200 counts = 0.5% resolution - if (m_period < _2_MHZ / ETB_HW_MAX_FREQUENCY) { - firmwareError(CUSTOM_OBD_HIGH_FREQUENCY, "PWM Frequency too high %d limit %d hz on pin \"%s\"", frequency, - ETB_HW_MAX_FREQUENCY, - msg); + if (m_period < 200) { + firmwareError(CUSTOM_OBD_HIGH_FREQUENCY, "PWM Frequency too high %d hz on pin \"%s\"", frequency, msg); return; } diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 3a67443455..6c7514cfc7 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -135,7 +135,7 @@ struct_no_prefix engine_configuration_s #define TCU_GEAR_COUNT 10 ! Matt says: The problem is the driver chip. Tle9201 can't do 20k. The drivers are too slow. On purpose to reduce EMI -#define ETB_HW_MAX_FREQUENCY 10000 +#define ETB_HW_MAX_FREQUENCY 3000 #define ETB_COUNT 2 #define DC_PER_STEPPER 2