Re: rt_com call-back function

"Diekie Huyzers" <[email protected]> Thu, 17 Feb 2005 08:34:10 +0200
Newsgroups gmane.linux.real-time.rtlinux.general
Organization OTB
Message-ID <001101c514ba$b10fc340$87020164@diekie>
Hi Pieter,

We've had a similar experience with the Linux real time clock going bonkers.
After a lot of digging around, we found that the culprit was a call to
nanosleep().  Be careful where you call nanosleep().  The man pages state
that nanosleep should not be called within an interrupt service routine.
You could also try to use a semaphore to start your thread in stead of
pthread_wakeup_np(), because pthread_wakeup_np() calls for a re-schedule
(possibly causing the ISR to be interrupted?).  Thoughts anyone?

Hope this helps,

Diekie Huyzers



----- Original Message -----
From: "Pieter van der Meer" <[email protected]>
To: <[email protected]>
Sent: Wednesday, 16 February 2005 13:59
Subject: [Rtl] rt_com call-back function


> Hi everyone,
>
> Recently, I've tried to run serial communications in real-time using
> RTLinux. For this I use the rt_com module. Since the module doesn't
> offer blocking reads I made my own blocking read with time-out. I used
> the call-back function to wake up my real-time thread when the UART's
> read FIFO is triggered. The time-out feature was done by a nanosleep
> with an interval proportional to the number of bytes to read. This
> seemed to do the trick, and the whole thing runs very efficiently.
>
> However, when I looked I looked at the Linux system clock I noticed it
> jumped around like a madman. Once of twice per minute it does jumps of
> 4 seconds. After some investigation it seemed the rt_com call-back
> function was the cause. I disabled the call-back and made the thread
> periodic. This seemed to stop the jumps from occuring.
>
> The way it runs now is very satisfying. However, I still would like to
> have some insight into the flaws of this call-back mechanism. My guess
> is it disables interrupts for a long time, which causes the system
> timer to malfunction? Can it be that "pthread_wakeup_np()" also
> contributes to this effect? Does anyone share similar experiences?
>
> My setup is a 350 MHz PII with kernel 2.4.20, RTLinux 3.2-pre2, rt_com
0.5.5.
>
> Kind regards,
>
> Pieter van der Meer
> _______________________________________________
> Rtl mailing list
> [email protected]
> http://www2.fsmlabs.com/mailman/listinfo/rtl

_______________________________________________
Rtl mailing list
[email protected]
http://www2.fsmlabs.com/mailman/listinfo/rtl
InterScan_Disclaimer.txt (text/plain, 628 B)
This e-mail and any files transmitted with it are confidential and intended solely for
the use of the individual or entity to whom they are addressed. If you have received
this e-mail in error please notify the sender immediately by e-mail and delete this e-mail
from your system. Please note that any views or opinions presented in this e-mail are
solely those of the author and do not necessarily represent those of OTB.
Although OTB has taken reasonable precautions to ensure no viruses are present
in this e-mail, OTB cannot accept responsibility for any loss or damage arising from
the use of this e-mail or attachments.