[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accurate GPIO Clock
From: |
address@hidden |
Subject: |
Re: Accurate GPIO Clock |
Date: |
Sun, 01 Mar 2020 13:09:45 +0000 |
welcome to the field of real time operating systems. There are a few thousand
pages about the latencies introduced by the scheduler in non-real time OS, the
first google hit being
https://www.veterobot.org/2012/04/precise-pwms-with-gpio-using-xenomai.html
A few microseconds is not too bad actually. Unless you shift the hard real time
task to hardware (FPGA), I am not sure you can get any better.
JM
--
JM Friedt, FEMTO-ST Time & Frequency/SENSeOR, 26 rue de l'Epitaphe,
25000 Besancon, France
March 1, 2020 12:57 PM, "Till Hülder" <address@hidden> wrote:
> Hello,
>
> i want to build a accurate GPIO Clock . I wrote a wait function :
>
> void sleepus(int n)
> {
> clock_t end=clock()+n*CLOCKS_PER_SEC/1000000;
> while(clock() < end) continue;
> }
>
> And wait until the value of the bits change .I recognized that the time of
> these wait time is not
> constant. It differs by a few microseconds.
>
> Is there are another way to get a more accurate clock ?
>
> Best regards ,
>
> Till