[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Problems implementing the transmitter side.

From: Arno Wilhelm
Subject: Re: [Discuss-gnuradio] Problems implementing the transmitter side.
Date: Thu, 15 May 2003 15:09:44 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Saeed Beyty wrote:
Dear GNURadios'
makeing progress in our sdr project now we got in trouble implementing the transmitter side. it's kind of syncnorization problem but in the frequency field (not in phase yet). We need to send samples of sin waves to the soundcard on very accurate intervals (assume a 1khz sin wave to be send). how could we produce sin waves to be send to the soundcards with a specified frequency (independent of CPU speed, number of tasks running,...). we tried a structre named "times" with "it_value.tv_usec", but the most available frequency was much less than needed, making it almost useless. we were thinking of RTlinux or UTIME structure. can any body tell me :
1- Does GNURadio have source codes for the transmitter side too?
2- if not,what do you suggest ?
3- and if yes, i would appritiate any documentations about the procedure!

I have found the nanosleep() call that uses the stucture timespec:

struct timespec
    time_t  tv_sec;         /* seconds */
    long    tv_nsec;        /* nanoseconds */

But the accuracy of the time also depends on the cpu architecture. The manual page says about this:

       The current implementation of nanosleep is based on the  normal  kernel
       timer  mechanism,  which  has  a  resolution  of  1/HZ s (i.e, 10 ms on
       Linux/i386 and  1 ms  on  Linux/Alpha).   Therefore,  nanosleep  pauses
       always for at least the specified time, however it can take up to 10 ms
       longer than specified until the process becomes runnable again. For the
       same  reason,  the value returned in case of a delivered signal in *rem
       is usually rounded to the next larger multiple of 1/HZ s.

       As some applications require much more precise pauses (e.g.,  in  order
       to  control  some time-critical hardware), nanosleep is also capable of
       short high-precision pauses. If the process is scheduled under a  real-
       time policy like SCHED_FIFO or SCHED_RR, then pauses of up to 2 ms will
       be performed as busy waits with microsecond precision.

In order to set the scheduler you can use the sched_setscheduler() call. I guess that also the preemtive linux kernel patch will help to make the time more reliable.
However, if the reolution should be more precise I would recommend RTlinux.

Hope this helps,


Mr Arno Wilhelm
phion Information Technologies GmbH
System Engineer
Eduard-Bodem-Gasse 1
A-6020 Innsbruck
tel: +43 512 39 45 45
fax: +43 512 39 45 45 20

reply via email to

[Prev in Thread] Current Thread [Next in Thread]