This interrupt for itself seems to work very reliably. I've checked by toggling a pin and recording it on the oscilloscope. I trigger the interrupt every 1000 us for this test. The remaining jitter is down to +-3 us. This seems good enough for data collection. The interrupt function itself seems to be 100% reliable even when pages are served or the WiFi starts to hang.
I set up a SoftAP and serve a page via ESP8266WebServer. I serve a big page for testing and call "yield()" repeatedly inside the http handler. When the Timer1 interrupt is disabled, this also works very reliably. I've reloaded the page a thousand times without problems.
BUT
With all three Timer1 + SoftAP + Webserver enabled I get the following situation:
Case A: Interrupt is limited to 10 us.
- Everything is fine.
Case B: Interrupt takes 600 us.
- When not serving pages everything seems fine.
- When serving pages it works a few reloads and then hangs.
- The ESP stops serving pages and also stops answering pings at that time.
- After a reset it works again until the page is loaded a few times.
I have tried to find the answers to these questions but didn't find anything useful. A dozen people must have run into the same problems but I didn't find any.
- Is the SoftAP mode not compatible with interrupts?
- Is there a maximum time duration for ISR where they are safe? (10 us seems safe but is too short for me, 600 us is unstable.)
- Is there a maximum processing percentage reserved for interrupt routines? (E.g. 30%)
- Do I need to configure something so it stays stable?