As the title says, can the call app_timer_cnt_get()
be interrupted by the SoftDevice and return an outdated value?
As the title says, can the call app_timer_cnt_get()
be interrupted by the SoftDevice and return an outdated value?
Anything which takes longer than one instruction can get interrupted by anything with a higher interrupt priority, so not only could app_timer_cnt_get() be interrupted after it reads the count and before it returns it, the code it returns to could get interrupted before it processes the value (which is much more likely as when optimised reading the counter is one single instruction).
You should basically assume that between any two instructions anywhere in your code there could be an indeterminate gap caused by an interrupt, softdevice or other.
well that really has nothing to do with your original question. It doesn't matter how you read the counter, that's not the issue, it's the fact your function itself gets interrupted so the counter keeps counting whilst the softdevice or other interrupt is running the function.
You can't do it like that. You need to use a proper profiler which can track where your code is and allow for interrupted times or ... something else.
well that really has nothing to do with your original question. It doesn't matter how you read the counter, that's not the issue, it's the fact your function itself gets interrupted so the counter keeps counting whilst the softdevice or other interrupt is running the function.
You can't do it like that. You need to use a proper profiler which can track where your code is and allow for interrupted times or ... something else.