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 85ec6a41f9
commit 19fec9f455
4 changed files with 10 additions and 2 deletions

View File

@ -874,7 +874,7 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
/*set channel parameters*/
/* 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] */
/* Note: On ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2, ESP32P4, due to a hardware bug,
/* Note: On ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2 (rev < 1.2), ESP32P4, due to a hardware bug,
* 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)
* will mess up the duty calculation in hardware.

View File

@ -275,6 +275,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.
.. only:: esp32h2
The hardware limitation above only applies to chip revision before v1.2.
Change PWM Duty Cycle Using Hardware
""""""""""""""""""""""""""""""""""""

View File

@ -275,6 +275,10 @@ LEDC 驱动提供了一个辅助函数 :cpp:func:`ledc_find_suitable_duty_resolu
在 {IDF_TARGET_NAME} 上,当通道绑定的定时器配置了其最大 PWM 占空比分辨率( ``MAX_DUTY_RES`` ),通道的占空比不能被设置到 ``(2 ** MAX_DUTY_RES)`` 。否则,硬件内部占空比计数器会溢出,并导致占空比计算错误。
.. only:: esp32h2
以上硬件限制仅在芯片版本低于 v1.2 的 ESP32H2 上存在。
使用硬件改变 PWM 占空比
""""""""""""""""""""""""""""""""""""

View File

@ -19,7 +19,7 @@
#define LEDC_FREQUENCY (4000) // Frequency in Hertz. Set frequency at 4 kHz
/* Warning:
* For ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2, ESP32P4 targets,
* For ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C2, ESP32C6, ESP32H2 (rev < 1.2), ESP32P4 targets,
* 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)).
*/