esp32 node32s wifi and reset

I have a prog which tests interrupt timer with software reset…it runs perfectly ok.

I have the exact same code but with the addition of a wifi connect…this gives a meditation error and core dump at the point of interrupt/reset…

does anybody know if there is an incompatibility issue between wifi and interrupt timer/reset?

I have searched and found many issues with interrupt reset from the early days of esp32 but none that seem relevant.

no wifi

//  ************************
//  test the interrupt timer
//  ************************
const int wdtTimeout = 300000;                                      //time in ms to trigger the interrupt(5 mins)
hw_timer_t *timer = NULL;
int counter;
//  ********************************
void IRAM_ATTR resetModule() 
{
  esp_restart();
}
//  *******************************
void setup() 
{
  Serial.begin(19200);
  Serial.println();
  Serial.println("running setup");

  timer = timerBegin(0, 80, true);                            //timer 0, div 80
  timerAttachInterrupt(timer, &resetModule, true);            //attach interrupt routine
  timerAlarmWrite(timer, wdtTimeout * 1000, false);          //set interrupt time us
  timerAlarmEnable(timer);                                      //enable interrupt
}
//  ********************************
void loop() 
{
 delay(60000);
 counter++ ;                              //display 1 minute intervals
 Serial.println(counter); 
}

with wifi

//  ***********************************
//  test the interrupt timer with wifi
//  ***********************************
#include <WiFi.h>
const char* ssid       = "littleshark";
const char* password   = "xxx";

const int wdtTimeout = 300000;                                      //time in ms to trigger the interrupt(5 mins)
hw_timer_t *timer = NULL;
int counter;
//  ********************************
void IRAM_ATTR resetModule() 
{
  esp_restart();
}
//  *******************************
void setup() 
{
  Serial.begin(19200);
  Serial.println();
  Serial.println("running setup");
  
//-------------connect to WiFi-------------
  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) 
 {
      delay(500);
      Serial.print(".");
 }
  Serial.println(" CONNECTED");
// --------------------------------------- 

  timer = timerBegin(0, 80, true);                            //timer 0, div 80
  timerAttachInterrupt(timer, &resetModule, true);            //attach interrupt routine
  timerAlarmWrite(timer, wdtTimeout * 1000, false);          //set interrupt time us
  timerAlarmEnable(timer);                                      //enable interrupt
}
//  ********************************
void loop() 
{
 delay(60000);
 counter++ ;                              //display 1 minute intervals
 Serial.println(counter); 
}