Flickering PWM on GPIO15 of ESP8266?

I have built quite a few Wifi dimmers for 12V LED strips using Wemos D1 Mini and IRLZ44N MOSFETs. The MOSFET does not even get warm at 1kHz, so that seems to be hunky-dory.
This worked very well until the last few, which regularly flicker and slightly shift brightness.
Apart from the batch, the only thing I can come up with is that I recently always just pin D8 (GPIO15), since that has a built-in pull-down.
The flickering happens every 10 seconds, with coincides with the interval at which I read a DHT22 on D3.
Does anyone have any experience with this issue or know reasons why the timer for PWM might be unstable?

All parts do have 100nF decoupling caps and there is also a 10µF MLCC after the HT7333 linear regulator. The ESP8266 itself also runs stable. I do not make the brightness level persistent, so the light would be off after a reboot.

Solution: The DHT library (Adafruit Unified Sensor) deactivates interrupts during readout of the sensor. ESP PWM is interrupt driven software PWM.
I can happily report that the readout still works when interrupts are not disabled. Of course, other additional interrupts may mess up the time-critical readout.

Attached is an oscilloscope screenshot of you the PWM was disabled during the DHT22 readout. This is resolved after changing the lib.

DS1Z_QuickPrint4.png

Huh - where'd my post go. I was going to post about that - the ESP8266 doesn't have hardware output compare, so to do PWM, they have to toggle the pin in an ISR - but reading a DHT is time-sensitive, and you can get bogus readings if an ISR fires during the course of reading a DHT.

That's one of the major weaknesses of the ESP8266 - the lack of decent hardware peripherals. Seeing as it was meant as a serial-to-wifi bridge, we should all thank our lucky stars that these $3 wonders are as good as they are.

Well, in this case, my readings are fine. No wrong values. The library rather reports failed readings somtimes (about 15-20%), but it does that with and without interrupts.
I guess the much higher clock compared to the ATMEGA pays off here.

ElCaron:
Well, in this case, my readings are fine. No wrong values. The library rather reports failed readings somtimes (about 15-20%), but it does that with and without interrupts.
I guess the much higher clock compared to the ATMEGA pays off here.

Yeah, if you were to look under the hood, you'd probably find that they were mis-reads that got caught by the checksum.

That is what I expect. I didn't want to make such claims without looking into the data sheet and knowing that there really is a checksum, but how else would the lb report failed readings. Anyway, I am reading often enough to detect outliers. If any problems come up, I'll leave a note here.

Hi,

I made one sample to use the GitHub - StefanBruens/ESP8266_new_pwm: This is a drop-in replacement for the ESP8266 SDK PWM in Arduino.
See it in: GitHub - JoaoLopesF/ESP8266-Arduino-PWM-SDK-Sample: Sample to avoid PWM flickerings using the PWM of SDK improved
Only this works fine to me, without the flickerings :-).
Regards,
Joao