I was using the DueTimer library by ivanseidel. Initially it was working fine but suddenly I noticed that using the interrupt with high frequency causes the micros() and millis() function to become erratic. Can someone test the code below and see if it is hardware related issue? I tested the code before with much high frequency (3600 Hz) or 278 microsecond period and I swear it was working fine.
Board: Arduino Due
Baud: 115200
Arduino v1.5.8
#include <DueTimer.h>
void firstHandler(){
Serial.println(micros());}
void setup(){
Serial.begin(115200);
Timer1.attachInterrupt(firstHandler).start(500); // Every 500 microsecond
}
void loop(){}
This is the output that I get whenever I run that code:
Here is the link to the DueTimer library: GitHub - ivanseidel/DueTimer: ⏳ Timer Library fully implemented for Arduino DUE
Thank you for your time.