[LEDC-3.12] When the LEDC Is in Decremental Fade Mode, a Duty Overflow Error May Occur
Description
This issue may happen when the LEDC is in decremental fade mode and LEDC_DUTY_SCALE_HSCHn is 1. If the duty is 2LEDC_HSTIMERx_DUTY_RES, then the next one should be 2LEDC_HSTIMERx_DUTY_RES – 1, however, the next duty is actually 2LEDC_HSTIMERx_DUTY_RES+1, which indicates a duty overflow error. (HSCHn refers to high-speed channel with n being 0-7; HSTIMERx refers to high-speed timer with x being 0-3.)
For low-speed channels, the same issue may also happen.
Workarounds
When using LEDC, avoid the concurrence of following three cases:
The LEDC is in decremental fade mode;
The scale register is set to 1;
The duty is 2LEDC_HSTIMERx_DUTY_RES or 2LEDC_LSTIMERx_DUTY_RES.
Solution
This issue is automatically worked around in the LEDC driver since the ESP-IDF commit ID b2e264e and is released in ESP-IDF v3.1.