-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ticker stops unexpectedly #1695
Comments
ARM Internal Ref: IOTMORF-197 |
on some st platforms using 16-bit timer there is a check for the past event in function us_ticker_set_interrupt
when the condition happens, it will cause processing of the event immediately. In the Ticker class, the processor function will schedule the next event, the calling path may trigger a recursive call along the calling path of ticker_insert_event, us_ticker_set_interrupt, us_ticker_irq_handler ..., In a high load system, some ticker event may miss it's window and cause the condition to happen. But in the ticker_insert_event function, the following piece of code have one reentry issue:
the obj->next pointer modification is after set_interrupt. When the reentry condition happens, the pointer final value will be wrong. |
@aetheln Thanks for the reporting. The HAL should not call irq handler directly if delta <= 0. As you proposed to schedule in a near feature, or set a flag that would trigger the us ticker irq. To the second, we shall have a look. Might be worth doing anyway. @bcostm @adustm @LMESTM please could you have a look at this? |
@aetheln It might e better to track this issue separately, the above issue might have been already solved |
Still an issue for me, NRF51(4/8)22 targets |
@smarek Can you plesae be more specific? cc @nvlsianpu @pan- |
Also I've just tested with latest release (branch mbed-os-5.4), and the issue is still present. |
Can you test 5.5 ? |
@0xc0170 ok, I've tested with 5.5 and the problem, that appears while using Ticker is gone. Code as follows: #include "mbed.h"
Thread led_blink1;
DigitalOut led1(P0_8);
DigitalOut led2(P0_9);
DigitalOut led3(P0_10);
void topledTick() {
while(1){
led1 = !led1;
led2 = !led2;
led3 = !led3;
wait(1);
}
}
int main() {
led_blink1.start(callback(topledTick));
while (1) { }
} This will randomly hang in between 2 and 30 seconds |
@smarek I've tested the code above with 5.5 on an NRF51_DK (replacing P0_8 by LED1, P0_9 by LED2 and P0_10 by LED3) and it doesn't hang. The issue might live in your custom target code. |
The Ticker class is bugged for NUCLEO-F030R8 and NUCLEO-L053R8 as for some frequency high enough the Ticker stops unexpectedly. I.e for a 0.0001s period, the ticker stops after about 390ms.
The code used is:
The text was updated successfully, but these errors were encountered: