PWM? Anyone ever get it working? Even via peek/poke directly at control registers? #6301
Replies: 1 comment
-
Posted at 2016-07-19 by @gfwilliams I think the problem is there isn't any PWM at all afaik. It's all software - which Espruino can do, but it's a bit janky. You can buy external PWM chips though. Posted at 2016-07-20 by dwallersv Well, what what got me curious was this text from this page:
It sure seems to imply there is hardware support for PWM -- after all, why would there be the odd 10-bit PW setting. I doubt when porting the Arduino code to the ESP8266 someone decided to expand the software PWM pulse width resolution to 10 bits. I didn't look any further, but will dig a bit more. In any case it works on the competition -- we need to get it working for Espruino. After all, Javascript is soooooo much better a platform... Posted at 2016-07-20 by DrAzzy Here's their implementation of it: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/core_esp8266_wiring_pwm.c They use one of the hardware timers, but twiddle the pin in the ISR. Posted at 2016-07-20 by @allObjects Software PWM (pins not directly hardware gate connected to timer hardware) has always glitches... You may not notice as long as the PWM 'frequencies' are low (on/off pulse widths are wide) compared to processor speed and to processor hogging code sequences. I experienced similar issues with stepper motor(s) driven by Espruino, where timing is essential and irregularities can be heard easily: the sound/humming has a stuttering once in a while when running over a decent time at a constant frequency. With dimming this is not really an issue. Electrical issues - instable rails - are a different story. Posted at 2016-07-21 by @gfwilliams Potentially someone could make the UtilTimer in jsharware.c do this using the hardware timer and interrupt - that's what it was originally meant for. It's like 3 functions to implement and then you can have proper soft PWM.
You know the price goes down a lot if you order directly, and in bulk? If you buy 100 it's £12 each for the Pico - so I guess it depends how many strips you're doing and how much you think your time is worth ;) Posted at 2017-01-26 by Will Any update on this? Would love pwm on esp8266 Posted at 2017-09-05 by navas Is there any progress? Thanks Posted at 2017-09-05 by @MaBecker Yes, there is a possible substitution for the existing code. Welcome to jump in and take over the implementation named in issue 914 Posted at 2017-09-06 by PeterS Yes, would be great to have flicker-free LED dimming. Posted at 2019-09-17 by @MaBecker yep, it is implemented |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-07-19 by dwallersv
No analog output without it, right?
Could be limiting for the project I have in mind... I have a dozen raw 12E boards I bought for $1.99 ea from China for this particular (lightstrip) project. Since each strip -- and there are many -- needs its own MCU, it simply isn't financially practical to do this with the official boards :-(
Beta Was this translation helpful? Give feedback.
All reactions