fix(ledc): updated docs for esp32h2 eco5 bugfix

This commit is contained in:
Song Ruo Jing
2024-12-20 19:17:08 +08:00
parent 6ff5fca12d
commit 1281508bd7
4 changed files with 10 additions and 2 deletions

View File

@@ -602,7 +602,7 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
/*set channel parameters*/ /*set channel parameters*/
/* channel parameters decide how the waveform looks like in one period */ /* channel parameters decide how the waveform looks like in one period */
/* set channel duty and hpoint value, duty range is [0, (2**duty_res)], hpoint range is [0, (2**duty_res)-1] */ /* set channel duty and hpoint value, duty range is [0, (2**duty_res)], hpoint range is [0, (2**duty_res)-1] */
/* Note: On ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2, due to a hardware bug, /* Note: On ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2 (rev < 1.2), due to a hardware bug,
* 100% duty cycle (i.e. 2**duty_res) is not reachable when the binded timer selects the maximum duty * 100% duty cycle (i.e. 2**duty_res) is not reachable when the binded timer selects the maximum duty
* resolution. For example, the max duty resolution on ESP32C3 is 14-bit width, then set duty to (2**14) * resolution. For example, the max duty resolution on ESP32C3 is 14-bit width, then set duty to (2**14)
* will mess up the duty calculation in hardware. * will mess up the duty calculation in hardware.

View File

@@ -247,6 +247,10 @@ The range of the duty cycle values passed to functions depends on selected ``dut
On {IDF_TARGET_NAME}, when channel's binded timer selects its maximum duty resolution, the duty cycle value cannot be set to ``(2 ** duty_resolution)``. Otherwise, the internal duty counter in the hardware will overflow and be messed up. On {IDF_TARGET_NAME}, when channel's binded timer selects its maximum duty resolution, the duty cycle value cannot be set to ``(2 ** duty_resolution)``. Otherwise, the internal duty counter in the hardware will overflow and be messed up.
.. only:: esp32h2
The hardware limitation above only applies to chip revision before v1.2.
Change PWM Duty Cycle using Hardware Change PWM Duty Cycle using Hardware
"""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""

View File

@@ -247,6 +247,10 @@ LED PWM 控制器可在无需 CPU 干预的情况下自动改变占空比,实
在 {IDF_TARGET_NAME} 上,当通道绑定的定时器配置了其最大 PWM 占空比分辨率( ``MAX_DUTY_RES`` ),通道的占空比不能被设置到 ``(2 ** MAX_DUTY_RES)`` 。否则,硬件内部占空比计数器会溢出,并导致占空比计算错误。 在 {IDF_TARGET_NAME} 上,当通道绑定的定时器配置了其最大 PWM 占空比分辨率( ``MAX_DUTY_RES`` ),通道的占空比不能被设置到 ``(2 ** MAX_DUTY_RES)`` 。否则,硬件内部占空比计数器会溢出,并导致占空比计算错误。
.. only:: esp32h2
以上硬件限制仅在芯片版本低于 v1.2 的 ESP32H2 上存在。
使用硬件改变 PWM 占空比 使用硬件改变 PWM 占空比
"""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""

View File

@@ -19,7 +19,7 @@
#define LEDC_FREQUENCY (5000) // Frequency in Hertz. Set frequency at 5 kHz #define LEDC_FREQUENCY (5000) // Frequency in Hertz. Set frequency at 5 kHz
/* Warning: /* Warning:
* For ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2 targets, * For ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2 (rev < 1.2) targets,
* when LEDC_DUTY_RES selects the maximum duty resolution (i.e. value equal to SOC_LEDC_TIMER_BIT_WIDTH), * when LEDC_DUTY_RES selects the maximum duty resolution (i.e. value equal to SOC_LEDC_TIMER_BIT_WIDTH),
* 100% duty cycle is not reachable (duty cannot be set to (2 ** SOC_LEDC_TIMER_BIT_WIDTH)). * 100% duty cycle is not reachable (duty cannot be set to (2 ** SOC_LEDC_TIMER_BIT_WIDTH)).
*/ */