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

Suggestion Frequency fix #5

Open
AramVartanyan opened this issue Feb 24, 2019 · 5 comments
Open

Suggestion Frequency fix #5

AramVartanyan opened this issue Feb 24, 2019 · 5 comments

Comments

@AramVartanyan
Copy link

Dear Sashka,

I am using your library for driving RGB LED dimmer with SuperHouse esp-open-rtos.
I very much appreciate your work.
I want to share with you my last experience with it and I will be glad if it helps you fix the Frequency issue.

The good news is that if I am not using
multipwm_set_freq ()
to set it up, the actual PWM frequency is 1,2kHz. In any other case it stays at 100Hz or less, no matter what number I will choose.
It works very stable with this code:

https://github.com/AramVartanyan/esp-homekit-demo/blob/master/examples/magic_home_strip/magic_home.c

I am curious if it is helpful, but an updated library by Espressif exists. I tried to implement it without success, but it may be useful for you:

https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/components/esp8266/include/driver/pwm.h

https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/components/esp8266/driver/pwm.c

Best Regards,
Aram

@nochkin
Copy link
Owner

nochkin commented Feb 25, 2019

That's interesting. Thank you for sharing.
What was the issue when you tried to implement the Espressif lib?

@AramVartanyan
Copy link
Author

You are welcome.
I didn’t find any issue actually. It is made for the Espressif SDK. I tried to collect and put on place each involved header and source files, but the compiler kept returning errors for undefined library files. I have just gave up.
The library for the memory management is different. Maybe it’s related also with other libraries. I couldn’t make it to the end. I am not on that level yet. 😉

@nochkin
Copy link
Owner

nochkin commented Feb 25, 2019

Right, I did not realize it's not RTOS, but a regular SDK (long day).
I believe I saw it before, but don't remember why I could not use it. I'll take another look at it again.

@mriksman
Copy link

mriksman commented Apr 23, 2020

FYI. I am building esp-homekit with ESP8266 RTOS SDK, and their PWM causes clients to get disconnected. Wi-Fi is OK; just the esp-homekit clients get disconnected. Weird.
Their PWM library uses an undocumented timer called WDEV TSF0 interrupt; not FRC1.
I am currently porting over this repo to use ESP8266 RTOS SDK hw_timer library (which uses FRC1) to see how it will work. Most of the functions of esp-open-rtos have a corresponding function in hw_timer.

I need information on what the multipwm_set_freq() function does...? Sets the CLK DIV of the FRC1 timer... That's about it? The frc1.reload will get set to false when you start multipwm, and the frc1.count.data will be overwritten after the first interrupt.
So how is PERIOD of the PWM actually maintained? It must be part of the set_duty function and the time-slice calculations?

@nochkin
Copy link
Owner

nochkin commented Apr 23, 2020

I did not touch it for a long time, but I believe this is for a divider.
AFAIR, the "set_freq" was not really implemented properly as I had some issues with it and did not have enough time to pursue.

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

No branches or pull requests

3 participants