ARMmbed / ARMmbed/minar

Setting tolerance to zero milliseconds causes strange behavior in scheduling

Open
#41 7 comments 0 reactions 0 assignees View on GitHub
mirrored
Dominant language
C++
Stars
26
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce: Schedule a periodic task. When the tolerance is different from zero, everything works as expected. When tolerance is set to zero, the task (every now and then) will experience random deviations from the scheduled time.

Code (blinky example):

```
#include "mbed-drivers/mbed.h"
#include "mbed-hal/lp_ticker_api.h"
using minar::Scheduler;

DigitalOut led(LED1);

static void blinky(void) {
led = !led;
printf("%lu \r\n", lp_ticker_read());
}

void app_start(int, char**){
Scheduler::postCallback(blinky).tolerance(minar::milliseconds(0)).period(minar::milliseconds(1000));
}
```

I was using an FRDM-K64F board

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the blinky example in the issue and reproduce the timing deviations on an FRDM-K64F with tolerance set to zero, comparing them with a nonzero tolerance. Trace Scheduler::postCallback, tolerance, period, and lp_ticker_read to locate where the schedule diverges. Done means periodic callbacks remain aligned with the scheduled time when zero tolerance is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.