Skip to content

Commit 6dab3f6

Browse files
committed
Fix LEDC channels above 8 not properly clearing
Fixes: espressif#2660
1 parent 1efcd21 commit 6dab3f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/esp32/esp32-hal-ledc.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void _ledcSetupChannel(uint8_t chan, uint8_t idle_level)
167167
LEDC_CHAN(group, channel).conf0.sig_out_en = 0;//This is the output enable control bit for channel
168168
LEDC_CHAN(group, channel).conf1.duty_start = 0;//When duty_num duty_cycle and duty_scale has been configured. these register won't take effect until set duty_start. this bit is automatically cleared by hardware.
169169
if(group) {
170-
LEDC_CHAN(group, channel).conf0.val &= ~BIT(4);
170+
LEDC_CHAN(group, channel).conf0.low_speed_update = 1;
171171
} else {
172172
LEDC_CHAN(group, channel).conf0.clk_en = 0;
173173
}
@@ -196,15 +196,15 @@ void ledcWrite(uint8_t chan, uint32_t duty)
196196
LEDC_CHAN(group, channel).conf0.sig_out_en = 1;//This is the output enable control bit for channel
197197
LEDC_CHAN(group, channel).conf1.duty_start = 1;//When duty_num duty_cycle and duty_scale has been configured. these register won't take effect until set duty_start. this bit is automatically cleared by hardware.
198198
if(group) {
199-
LEDC_CHAN(group, channel).conf0.val |= BIT(4);
199+
LEDC_CHAN(group, channel).conf0.low_speed_update = 1;
200200
} else {
201201
LEDC_CHAN(group, channel).conf0.clk_en = 1;
202202
}
203203
} else {
204204
LEDC_CHAN(group, channel).conf0.sig_out_en = 0;//This is the output enable control bit for channel
205205
LEDC_CHAN(group, channel).conf1.duty_start = 0;//When duty_num duty_cycle and duty_scale has been configured. these register won't take effect until set duty_start. this bit is automatically cleared by hardware.
206206
if(group) {
207-
LEDC_CHAN(group, channel).conf0.val &= ~BIT(4);
207+
LEDC_CHAN(group, channel).conf0.low_speed_update = 1;
208208
} else {
209209
LEDC_CHAN(group, channel).conf0.clk_en = 0;
210210
}

0 commit comments

Comments
 (0)