ESP8266 and Interrupts - not possible? I'm planning to use an ESP8266 (Wemos D1 Mini) to use as a software SPI monitor to send over WiFi.
As a test, I've done a cut-down sketch that just counts the interrupts, a simple frequency counter. I've made it as simple as possible but it won't stay connected to WiFi and crashes after about 10 seconds.
The input signal to CLKPin is 6667Hz.
Here's the sketch:
#include &lt;ESP8266WiFi.h&gt;

const char* ssid     = &quot;SSID&quot;;
const char* password = &quot;PASSWORD&quot;;

long nextPrint = 1000; // when to print the next message to serial

const int CLKPin = 5; // Pin connected to CLK
volatile long ClkCount = 0; // number of times clock interrupt has fired

void CLK_ISR() {
  ClkCount++;
}

void setup() {
  Serial.begin(115200);
  long startTime = millis();

  WiFi.begin(ssid, password);             // Connect to the network
  Serial.print(&quot;Connecting to &quot;);
  Serial.print(ssid); Serial.println(&quot; ...&quot;);

  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(500);
    Serial.print(&quot;.&quot;);
  }
  Serial.println(&quot;\nConnected to wifi&quot;);

  attachInterrupt(CLKPin, CLK_ISR, RISING);

  //Set the CLK-pin to input
  pinMode(CLKPin, INPUT);
}

void loop() {
  if (millis() &gt; nextPrint) {
    Serial.print(&quot;Freq is: &quot;);
    Serial.println(ClkCount);
    ClkCount = 0;
    nextPrint += 1000;
  }
  yield();
}

It always gets in a reboot/crash loop (no idea why the first few counts are wrong - I guess the ESP isn't ready yet):
Connecting to SSID ...
.Connected to wifi
Freq is: 1
Freq is: 1
Freq is: 0
Freq is: 0
Freq is: 1
Freq is: 0
Freq is: 2313
Freq is: 6667
Freq is: 6666
Freq is: 6667
Freq is: 6667
Freq is: 6667
Freq is: 6667
Freq is: 6667
Freq is: 6667
Freq is: 6667

Exception (0):
epc1=0x40202034 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffc40 end: 3fffffb0 offset: 01a0

&gt;&gt;&gt;stack&gt;&gt;&gt;
3ffffde0:  401067da 00000026 00000000 00000001  
3ffffdf0:  c0017025 3ffe8d04 3ffee188 00000001  
3ffffe00:  00000003 00000008 3ffee99c 00000022  
3ffffe10:  3fffc200 401067a0 3fffc258 4000050c  
3ffffe20:  40004384 00000030 00000012 ffffffff  
3ffffe30:  60000200 00000006 30043003 80000000  
3ffffe40:  20000000 3fff0c38 80000000 203fc120  
3ffffe50:  00000000 3fffc6fc 00000001 3fff0c3c  
3ffffe60:  00000154 003fc120 60000600 00000030  
3ffffe70:  40106845 00000080 00000022 3fffc200  
3ffffe80:  c0017025 3fffc258 4000050c 00000022  
3ffffe90:  3fffc200 401067a0 3fffc258 00000022  
3ffffea0:  3fffc200 401067a0 3fffc258 4000050c  
3ffffeb0:  40202b20 00000030 00000012 ffffffff  
3ffffec0:  40000f49 3ffee9e8 00000000 3fffd9d0  
3ffffed0:  00000000 00000000 00000000 fffffffe  
3ffffee0:  ffffffff 3fffc6fc 00000001 3fffdab0  
3ffffef0:  00000000 3fffdad0 3ffee9e8 00000030  
3fffff00:  3ffee99c 0000000a 3ffe8bc8 402094cc  
3fffff10:  00000000 400042db 3ffeff84 40104580  
3fffff20:  40004b31 3fff0b84 000001f4 003fc080  
3fffff30:  40105aac 000001f4 3ffed190 401004f4  
3fffff40:  40106e4d 3fff0b84 00000000 00f8676f  
3fffff50:  3ffe8bc8 3ffe8d04 3ffed190 40224d02  
3fffff60:  40223d49 40223d52 3ffed004 3ffee1b0  
3fffff70:  40228445 3ffed004 3ffee1b0 00f857fe  
3fffff80:  4022848a 3fffdab0 00000000 3fffdcb0  
3fffff90:  3ffee1c8 3fffdad0 3ffee9e8 40202b43  
3fffffa0:  40000f49 40000f49 3fffdab0 40000f49  
&lt;&lt;&lt;stack&lt;&lt;&lt;

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)


 ets Jan  8 2013,rst cause:4, boot mode:(1,6)

wdt reset

What am I doing wrong, or is it just not possible to stay connected to WiFi while using interrupts on an ESP8266?
Yes possible, but the ESP8266 only has one core and one set of peripherals. WiFi uses time, interrupts, and even the ADC peripheral, and maybe more.
This is why anything timing-critical, or time-intensive, is a pain to get to work properly on an ESP8266. It depends one what you are trying to do, of course, and also on if you can unload what you want to a peripheral the WiFi doesn't use, or if switching off WiFi is an option during parts of your code.
Generally, for applications such as yours, I would get an ESP32 or an Arduino Nano 33 IoT or any other solution that has a core for handling WiFi, and a core for you to use without restrictions. It makes development a more pleasant experience.
If, for some reason, you are bound to using an ESP8266, you would have to be more specific about what your eventual goal is; maybe a workaround can be found.