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 Frequency Set Does/Might Not Work #902

Closed
mriksman opened this issue Apr 23, 2020 · 4 comments
Closed

PWM Frequency Set Does/Might Not Work #902

mriksman opened this issue Apr 23, 2020 · 4 comments
Labels
HAA ESP8266 Home Accessory Architect ESP8266

Comments

@mriksman
Copy link

FYI.

I'm working with the multipwm library of esp-open-rtos at the moment, porting it to ESP8266 RTOS SDK, and noticed the multipwm_set_freq() doesn't actually do anything.
https://github.com/RavenSystem/esp-homekit-devices/blob/master/devices/HAA/main.c#L4434

The actual frequency/period is set in the header with
#define MULTIPWM_MAX_PERIOD UINT16_MAX

multipwm_set_freq() will cause the divider to be set to TIMER_CLKDIV_16 (see https://github.com/SuperHouse/esp-open-rtos/blob/master/core/include/esp/timer.h)

So the frequency of the PWM calculates to about 76Hz. If a user selects a frequency > 100kHz, the divider will be TIMER_CLKDIV_1 so the PWM frequency will be 1.22kHz.
This is assuming the clock is running at 80MHz.

Is anyone able to confirm this?

@stale
Copy link

stale bot commented May 18, 2020

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 stale Stale label May 18, 2020
@RavenSystem RavenSystem added the HAA ESP8266 Home Accessory Architect ESP8266 label May 20, 2020
@stale stale bot removed the stale Stale label May 20, 2020
@RavenSystem
Copy link
Owner

I use esp-open-rtos and multipwm_set_freq() works perfectly. I use 1KHz for max value.

@mriksman
Copy link
Author

mriksman commented May 20, 2020

I spoke with the developer of multipwm and he confirmed he never implemented multipwm_set_freq properly. Record the LED with a slow-mo camera (like an iPhone) and you'll see it flashing.
nochkin/multipwm#5

@blaxwan01
Copy link

@RavenSystem any solution? any value of "q" in JSON becomes 76Hz on PWM, I tested a lot of tries with oscilloscope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HAA ESP8266 Home Accessory Architect ESP8266
Projects
None yet
Development

No branches or pull requests

3 participants