Hardware timer triggering watchdog timer reset
Posted: Mon Feb 15, 2016 2:58 pm
Hi all, I've been following the ESP8266 for the last couple of weeks and after getting a simple working setup with AT firmware, I was really pleased to see the Arduino support and very happy when I was able to make an LED flash through GPIO2 :)
As part of learning more, I have a project in mind which needs me to sample audio, so I need to trigger an ISR very frequently. After reading and searching, I have the following code:
Unfortunately, this only seems to reset every few seconds:
Can anyone suggest what dumb mistake I'm making?
As part of learning more, I have a project in mind which needs me to sample audio, so I need to trigger an ISR very frequently. After reading and searching, I have the following code:
Code: Select all
uint32_t curcount = 0;
void ICACHE_RAM_ATTR pwm_timer_isr(){
if (curcount % 1000) {
Serial.println ("1000 hit");
Serial.printf("curcount is %d\n", curcount);
}
curcount++;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("START1");
timer1_disable();
timer1_attachInterrupt(pwm_timer_isr);
timer1_write(1);
timer1_enable(TIM_DIV265, TIM_EDGE, TIM_LOOP);
Serial.println("START2");
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000);
}
Unfortunately, this only seems to reset every few seconds:
Code: Select all
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
START1
1000 hit
curcount is 1
1000 hit
curcount is 2
1000 hit
curcount is 3
1000 hit
curcount is 4
1000 hit
curcount is 5
1000
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
START1
1000 hit
curcount is 1
1000 hit
curcount is 2
1000 hit
curcount is 3
1000 hit
curcount is 4
1000 hit
curcount is 5
1000
Can anyone suggest what dumb mistake I'm making?