Céu: a high-level programming language that runs on Arduino

Hi,

In your blog you state:

There’s nothing wrong with the RTOSes and the example implementations: the behavior shown in the videos is perfectly valid.

It is not "perfectly valid", in an RTOS such loss of synch is not supposed to happen, the behavior is supposed to be deterministic. I usually run similar tests so it is surprising to see this. Also, I can see at least one obvious error in the ChibiOS code:

chThdSleepMilliseconds(99999);

99999 is out of range for an uint16_t and the thread is placed in the timers delta list incorrectly but probably this is not the cause of the problem. I can't tell because your main() function is not visible and main() threads runs at the same priority of blinkers, any activity in the main thread can shift the timings.

Do you have any other thread running at same or higher priority than blinker threads? In the DuinOS code there is a third thread at same priority that could explain the shift, you should make sure that blinker threads have the highest priority.

Also, about accuracy of timings please read this article:

http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:timing

Giovanni