New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp32: Fix PWM not allowing frequencies < 611 Hz. #8200
Conversation
62f8bcd
to
89432ca
Compare
eec2067
to
9e3e995
Compare
Changed, rebased & squashed. The names of #defines chosen by the initial implementation could be more distinctive, but left them as they were. |
Bug is here: micropython/ports/esp32/machine_pwm.c Lines 87 to 92 in 30b6ce8
Algorithm is developed in assumption that HIGHEST_PWM_RES must be 16 or 14 I tried to fix with SOC_LEDC_TIMER_BIT_WIDE_NUM, but SOC_LEDC_TIMER_BIT_WIDE_NUM also is not difined in Micropython compile time This is right version:
and then lines micropython/ports/esp32/machine_pwm.c Line 299 in 30b6ce8
micropython/ports/esp32/machine_pwm.c Line 315 in 30b6ce8
are right too. |
With: |
@robert-hh |
Tested with your version works fine as well on a generic ESP32. The Frequency deviation of 1001.6 Hz instead of 1000Hz stay. GENERIC_C3 and UM_FEATHERS2 show better frequency resolution and granularity. The previous code worked also well on a UM_FEATHERS2 and a GENERIC_C3. |
Tested with duty_u16(), duty() and duty_ns() for frequencies down to 1 Hz.
9e3e995
to
af659fb
Compare
In favor of @IhorNehrutsa's PR, being the initial contributor for this PWM module. |
…-makerdiary-nrf52840-connect 8.2.x backport: Added Makerdiary nRF52840 Connect Kit.
Tested with duty_u16(), duty() and duty_ns() for frequencies down to
1 Hz.
Fixes issue #8189