[LinuxPPS] GPIO PPS Generator

Drasko DRASKOVIC drasko.draskovic at gmail.com
Thu May 23 12:03:03 CEST 2013


Hello Igor,
think you very much for the code and the instructions. It has been
extremely helpful, and I integrated
your code in Ubuntu Precise 3.2 Linux kernel for my Pandaboard.

Everything seems to work, and I can see PPS on the oscilloscope.

My use case is not a standard PPS generator, though. I thought that I
can use this mechanism to observe clock synchronicity (offest +
jitter) between two Pandaboards.

However, driver's hrtimer is started at the moment the driver is
inserted into the kernel, and keeps pulsing every second. While this
can be adequate for observing clock jitter between two boards, it is
impossible to have offset observation, as initial offset will be
unpredictable.

What I am looking now is to have a pulse at exact sharp second in the
sense : 1:00, 2:00, etc..., so, zero nanoseconds after round sharp
second in local time.

>From what I can see in the code, we are always setting hrtimer to
expire a little before and using getnstimeofday() to get our (local)
time and conclude second. That would mean (I think) that if we can
just start our hrtimer on exact round second, then after this it would
continue pulsing on each second exactly.

Do you have some suggestions how this can be done ?

Thanks and best regards,
Drasko

On Tue, May 21, 2013 at 4:26 PM, Igor Plyatov <plyatov at gmail.com> wrote:
> Hi Drasko!
>
>
>> Hi Igor,
>> I am trying to add the files you sent.  However, I can see now that
>> pps-generator-gpio.c includes corresponding header file, and you
>> forgot so send it, so the compilation fails (fatal error:
>> linux/pps-generator-gpio.h: No such file or directory).
>>
>> Do you have this file at your disposal?
>
>
> File is attached.
>
> Here is an example from BSP, which shows how to setup platform data for the
> driver.
>
> ...
> #include <linux/pps-generator-gpio.h>
> ...
> static struct pps_generator_gpio_platform_data pps_generator_gpios_data = {
>     .gpio            = AT91_PIN_PB20,
>     .desc            = "pps0 generator"
> };
>
> static struct platform_device pps_generator_gpio_device = {
>     .name        = "pps-gen-gpio",
>     .id        = 0,
>     .dev        = {
>         .platform_data    = &pps_generator_gpios_data,
>     }
> };
> ...
> static void __init gsia18s_board_init(void)
> {
> ...
>     platform_device_register(&pps_generator_gpio_device);
> ...
>
> Best regards!
> --
> Igor Plyatov
>
>
>> BR,
>> Drasko
>>
>>
>> On Fri, May 17, 2013 at 7:41 PM, Igor Plyatov <plyatov at gmail.com> wrote:
>>>
>>> Sorry, but I do not understand what you mean. Can you be more specific -
>>> acceptable for what?
>>>
>>> 17.05.2013 18:59 пользователь "Drasko DRASKOVIC"
>>> <drasko.draskovic at gmail.com> написал:
>>>
>>>> Hi Igor,
>>>> thanks a lot.
>>>>
>>>>
>>>> On Fri, May 17, 2013 at 4:36 PM, Igor Plyatov <plyatov at gmail.com> wrote:
>>>>>
>>>>> Dear guys,
>>>>>
>>>>> here is an experimental driver for GPIO pps generator attached.
>>>>>
>>>>> It was made from pps_gen_parport.c by me and tested with Linux
>>>>> 2.6.39.3.
>>>>>
>>>>> Of course it have some drawbacks, but can be improved by yours if
>>>>> needed.
>>>>>
>>>>> Unfortunately I don't have time to improve it now.
>>>>>
>>>>> Good luck and best regards!
>>>>
>>>> I will certainly look at i and test it.
>>>>
>>>> As I understand simple GPIO toggle for userspace is out of question,
>>>> because of OS jitter.
>>>>
>>>> But would simple GPIO toggel from kernel space be acceptible,
>>>> something like this :
>>>> https://github.com/mirko/gpio-toggling---linux-kernel-module ?
>>>>
>>>> BR,
>>>> Drasko
>
>
>
> --
> Igor Plyatov
>




More information about the discussions mailing list