Open AramVartanyan opened 5 years ago
That's interesting. Thank you for sharing. What was the issue when you tried to implement the Espressif lib?
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. 😉
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.
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?
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.
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