This is my first thread here, I'm sorry if I go against some rule, please inform me if I do. I apologize in advance.
I've been experiencing major timing problems with the millis() function that is part of wiring.c (the same library that delivers the so famous delay() function). Once I set the PWM frequency scaller (MS_TIMER_TICK_EVERY_X_CYCLES) to something other than 64 the problems begin. If the scaller is 1 the timings are exactly two times slower than expected, and the problem persists with the rest of the possible values too (8, 256, 1024).
//do_someting() will be executed after two seconds if MS_TIMER_TICK_EVERY_X_CYCLES is set to 1
time=millis();
while (millis()-time < 1000) do_nothing();
do_something();
The problem appears only when "Digispark (Default - 16.5MHz)" is selected as a board, with the rest of the options (No USB) everything works as expected. Is it possible that the clock calibration breaks it somehow? Should this be submitted as a bug? Am I doing something wrong?
P.S: The delay() function works OK as far as I noticed.