Skip to content
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

PWM functionallity is not workling correctly on channels > 7 #1909

Closed
hengesb opened this issue Sep 29, 2018 · 7 comments
Closed

PWM functionallity is not workling correctly on channels > 7 #1909

hengesb opened this issue Sep 29, 2018 · 7 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@hengesb
Copy link

hengesb commented Sep 29, 2018

The PWM functionality is not working correctly on channels 8 - 15. My program below works when I use a channel between 0 an 7 (an LED blinks). When I change to a channel above 7 than setting the value 0 is ignored, setting every other value works.

I take a look in esp32-hal-ledc.c in method ledcWrite and see that there is a different behavior between group 0 an 1 and when setting the value 0 and every other value (lines 174 - 178). I think here must be something wrong for group 1 setting value 0.

PWM Freq = 5000
PWM resolution = 8

Hardware:

Board: MH-ET LIVE ESP32 DevKit
Core Installation/update date: 14/jul/2018
IDE name: Arduino IDE and Platform.io
Flash Frequency: 80Mhz
PSRAM enabled: ?
Upload Speed: 921600
Computer OS: Ubuntu

#include <Arduino.h>

#define CHANNEL 8        // Change channel to < 8 to get a working example

void setup() {
  ledcSetup(CHANNEL, 5000, 8);
  ledcAttachPin(22, CHANNEL);
}

void loop() {
  ledcWrite(CHANNEL, 0);       // change value to >0 to see changing values even on channels > 7
  delay(1000);
  ledcWrite(CHANNEL, 100);  
  delay(1000);
}
@nkast
Copy link

nkast commented Mar 14, 2019

I can confirm.
When I set duty = 0 on channels 8 - 15 the PWM is not turned off.

if(duty) {
LEDC_CHAN(group, channel).conf0.sig_out_en = 1;//This is the output enable control bit for channel
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.
if(group) {
LEDC_CHAN(group, channel).conf0.val |= BIT(4);
} else {
LEDC_CHAN(group, channel).conf0.clk_en = 1;
}
} else {
LEDC_CHAN(group, channel).conf0.sig_out_en = 0;//This is the output enable control bit for channel
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.
if(group) {
LEDC_CHAN(group, channel).conf0.val &= ~BIT(4);
} else {
LEDC_CHAN(group, channel).conf0.clk_en = 0;
}

@stale
Copy link

stale bot commented Aug 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@nkast
Copy link

nkast commented Aug 1, 2019

bump

@stale
Copy link

stale bot commented Aug 1, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@lbernstone
Copy link
Contributor

This was fixed 12/4/19. Please test with v1.0.2. I can confirm it is working now.

@stale
Copy link

stale bot commented Sep 30, 2019

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Sep 30, 2019
@stale
Copy link

stale bot commented Oct 14, 2019

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

3 participants