Timer0 interrupts? Getting watchdog resets.
Posted: Fri Sep 04, 2015 8:03 am
Hi. I am trying to port an Arduino project to ESP. It used the AVR timer registers. It is necessary for me to use hardware timers of ESP.
I learned from the Servo library and Arduino.h about the timer0 and timer1 functions , though there seems to be no official documentation on this.
Test code:
Im getting:
What is the correct way to use timer0, and trigger a callback, after every X ticks?
I learned from the Servo library and Arduino.h about the timer0 and timer1 functions , though there seems to be no official documentation on this.
Test code:
Code: Select all
void inline handler (void){
digitalWrite(BUILTIN_LED,1 /* !digitalRead(BUILTIN_LED) */ ); //the led doesnt toggle, nor glow even faintly
}
void setup() {
pinMode(BUILTIN_LED, OUTPUT);
Serial.begin(115200);
noInterrupts();
timer0_isr_init();
timer0_attachInterrupt(handler);
timer0_write(4166);
interrupts();
}
void loop() {
delay(1000);
}
Im getting:
Code: Select all
ets Jan 8 2013,rst cause:4, boot mode:(3,3)
wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
À
What is the correct way to use timer0, and trigger a callback, after every X ticks?