Getting TG0WDT_SYS_RESET in latest code.

harishjp
Posts: 7
Joined: Mon Aug 28, 2017 1:42 am

Getting TG0WDT_SYS_RESET in latest code.

Postby harishjp » Thu Sep 14, 2017 5:55 pm

Hi,

I'm getting the following error continuously in the latest esp32 arduino master.

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO

I've attached the full serial output. The code works if I use and older version: commit hash 856823ef195ef5c28516395356e8a30f8af8e917. I've not tried doing a git bisect to see which patch introduced this. Why is this happening?

The code is approximately following:

Code: Select all

static volatile unsigned long data[1000] = {0};
static volatile uint32_t coreid[1000] = {0};
static volatile long idx = 0;
static volatile long last;

void __zx_isr() {
  unsigned long ccount;
  __asm__ __volatile__ ( "rsr     %0, ccount" : "=a" (ccount) );
  if (idx == 1000) {
    return;
  }
  data[idx] = ccount;
  coreid[idx] = xPortGetCoreID();
  ++idx;
}

void test_zerocrossing() {
  uint32_t pin = 35;
  pinMode(pin, INPUT);
  // Setup an interrupt routine.
  attachInterrupt(pin, __zx_isr, CHANGE);
  Serial.println("Attaching interrupt ...");
  while (idx != 1000) {
    delay(1000);
  }
  Serial.println("Reached counter dumping data");
  Serial.printf("Cpu freq: %d\n", CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
  for (int i = 2; i < 1000; ++i) {
    Serial.printf("Core: %d, Last: %d, Cur: %d, Diff: %d\n", coreid[i], data[i - 1], data[i], data[i] - data[i - 1]);
  }
}

extern "C" void app_main() {
  initArduino();

  // This code will go away in non test mode.
  Serial.begin(115200);
  pinMode(2, OUTPUT);

  Serial.println("Start test ...");
  test_zerocrossing();
  Serial.println("Finished test ...");
}
Attachments
esp32_out.txt
(3.7 KiB) Downloaded 319 times

harishjp
Posts: 7
Joined: Mon Aug 28, 2017 1:42 am

Re: Getting TG0WDT_SYS_RESET in latest code.

Postby harishjp » Wed Sep 20, 2017 12:54 am

I started getting watchdog timer reset for this code too:

Code: Select all

extern "C" void app_main() {
   initArduino();

  // This code will go away in non test mode.
  Serial.begin(115200);
  for (;;) {
    Serial.println(touchRead(T0));
    delay(100);
  }
}
But it stopped coming as soon as I split it into setup and loop. I looked at main.cpp. The the only thing different is that loop runs on a different core. Is this expected?

User avatar
ESP_Me-no-dev
Posts: 69
Joined: Mon Jan 04, 2016 6:30 pm

Re: Getting TG0WDT_SYS_RESET in latest code.

Postby ESP_Me-no-dev » Wed Sep 20, 2017 6:45 am

try to change

Code: Select all

void __zx_isr()
to

Code: Select all

void IRAM_ATTR __zx_isr()

Who is online

Users browsing this forum: No registered users and 12 guests