I'm troubling with the background/internal task of ESP8266 which affect the main functions.
More specific, I'm controlling the digital LEDs by controlling the logic of GPIO (D7 - GPIO13). When I apply the digital LED protocol to ESP8266 (just change the logic of D7 following the protocol), the LEDs work fine. However, sometimes LEDs flashing with the wrong colour. So I analyzed the signal by using the digital oscilloscope, I realized there are many short stop-time between the data chain, which should not happen. It makes the data is errored. Then I just wrote the simple toggle GPIO code below then analyze the signal, and the result like the pictures below:
// This is ESP8266 - Arduino
void setup() {
pinMode(D7, OUTPUT); // switch the D7 to output
}
void loop() {
digitalWrite(D7, !digitalRead(LED_BUILTIN)); // toggle D7 by reverse the the current state
delayMicroseconds(22); // delay 30 microsecond (compensated 8us for loop() )
}
And this is the results (I've just created this account and don't have enough reputation to post the pictures, so just able to post the image links):
Two first errors slot at ms1243 and ms226
Zoom in at ms124, the normal pulse length is exactly 30us
At ms124, a strange long pulse appears???
At ms129.25, another strange wrong pulse also appears???
At ms154.25, another strange wrong pulse also appears???
At ms226.60, another strange long pulse also appears???
At ms318.20, another strange long pulse also appears???
At ms432.40, another strange long pulse also appears???
It seems the wrong pulses appear randomly, and the long pulses appear every ~100ms. So those pulses make the data become wrong. I guess that there is the affection of background tasks or the internal interrupts of ESP8266. I don't know what are those background tasks and how to stop it.
So is there someone has the solution to stop/prevent/remove this issue?