rtdm timer questions
Is an RTDM timer going to run at a priority higher than any scheduled realtime thread?
How accurate is the timing?
We are seeing the timer running at 125us periodic rate being called much too quickly. At least, I think we are. I can't personally use anything for a little over a week.
Thanks,
Steven
Quoted 8 lines · Steven Seeger
Is an RTDM timer going to run at a priority higher than any scheduled realtime thread?
How accurate is the timing?
We are seeing the timer running at 125us periodic rate being called much too quickly. At least, I think we are. I can't personally use anything for a little over a week.
Yes a timer runs in interrupt context. This is the same design as Linux, VxWorks, RTLinux, RTAI and most known OSes.
I do not understand what you mean by "too quickly", but do you get the same phenomenon with the klatency -t 2 test?
Signature · 1 line
Gilles.
I will ask Mark to run the klatency -t 2 test. I do not have a system or even a piece of a system right now so I can't run anything. Sorry. :(
What happens if I call start on a timer that is already running? Will it change the timing at all or ignore the start?
Is this correct:
rtdm_timer_start(&timer, 2000000, 125000, RTDM_TIMERMODE_ABSOLUTE);
The behavior I want is to start my timer in 2ms and have it fire every 125us. The timer itself will use rtdm_timer_stop_in_handler() to stop itself.
Am I making any mistakes here?
Steven
Quoted 18 lines · Gilles Chanteperdrix
Quoted 8 lines · Steven Seeger
Is an RTDM timer going to run at a priority higher than any scheduled realtime thread?
How accurate is the timing?
We are seeing the timer running at 125us periodic rate being called much too quickly. At least, I think we are. I can't personally use anything for a little over a week.
Yes a timer runs in interrupt context. This is the same design as Linux, VxWorks, RTLinux, RTAI and most known OSes.
I do not understand what you mean by "too quickly", but do you get the same phenomenon with the klatency -t 2 test?
Signature · 1 line
Gilles.
Quoted 4 lines · Steven Seeger
I will ask Mark to run the klatency -t 2 test. I do not have a system or even a piece of a system right now so I can't run anything. Sorry. :(
What happens if I call start on a timer that is already running? Will
Not explicitly specified, but the existing timer will be stopped first and then newly started.
Quoted 7 lines
it change the timing at all or ignore the start?
Is this correct:
rtdm_timer_start(&timer, 2000000, 125000, RTDM_TIMERMODE_ABSOLUTE);The behavior I want is to start my timer in 2ms and have it fire every
"...start ... in 2 ms" sounds a bit like TIMERMODE_RELATIVE, no? :)
Quoted 7 lines
125us. The timer itself will use
rtdm_timer_stop_in_handler()to stop itself.Am I making any mistakes here?
Steven
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Quoted 2 lines
Not explicitly specified, but the existing timer will be stopped first and then newly started.
I should see if we are doing that, then. We are loading bytes into a buffer and calling start if we need to call it. Perhaps the logic is incorrect.
Quoted 1 line
"...start ... in 2 ms" sounds a bit like
TIMERMODE_RELATIVE, no? :)
Yes I made this same mistake when I first wrote the driver. The version we are having issues with does say RELATIVE. I am still adjusting to a new time zone, so I use that as my excuse. :)
Steven
I think I see what my problem is with the driver. The flag that is holding off the extra starts is stupidly not set to volatile. Oops. I'll report back with results later.
Thanks,
Steven
Quoted 3 lines · Steven Seeger
I think I see what my problem is with the driver. The flag that is holding off the extra starts is stupidly not set to volatile. Oops. I'll report back with results later.
Be careful with volatile variables: Unless they refer to hardware-backed data (MMIO), you may just happen to write racy lock-less code - or the volatile is useless anyway.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Quoted 3 lines
Be careful with volatile variables: Unless they refer to hardware-backed data (MMIO), you may just happen to write racy lock-less code - or the volatile is useless anyway.
Yes that is true. In this case, however, writes are atomic (just 0 or 1) and even if something happens the "mode of failure" will be a missed 125us cycle of sound output. I doubt anyone would hear just one.
Steven