PPS through GPIO 26

zajacikzajacik New Member Posts: 5

Hi,
I would like to use UP Board as GPS time server. There is no problem connecting GPS module to the board using uart or usb. I need more precise time measurements, leading to time synchronization via PPS pulse produced by GPS chip.

I would like to use some free GPIO pin (eg. pin 26) as a PPS device. Can anyone point me at a right direction of doing that? Kernel has pps-gpio module, but it needs to specify device in device tree, which is sadly not possible on x86 arch od UP Board.

Tagged:

Comments

  • DCleriDCleri Administrator, AAEON Posts: 997 admin

    PPS-GPIO driver is available as a module on our kernel (for Ubuntu) but we have not tested the functionality.

    I am not sure if you need to configure it in any way before enabling, but you should be able to do it via modproble or adding the modules to the default load list.

    Regarding the PIN 26 on UP board, at the moment there is a bug (we are going to update the wiki with this information as we recently find out) where the pin is stuck as CS1 for the SPI interface.

    You can use another pin, 29, which you can refer via linux sysfs as gpio 5 or gpio 338

  • zajacikzajacik New Member Posts: 5

    Thank you for prompt answer!

    I may have confused you regarding PIN number, PIN 26 is 26 in sysfs, physically it corresponds to pin 37 on 40-pin header. The one above GND pin. I was able to configure it via sysfs as input and read its value with GPS connected (vals are 0 and cca once per second there is 1 as expected). For GPS daemon I need it to operate as a pps device though. But I will try different PIN as you suggest.

    I am indeed using Ubuntu image, tried both 16.04 and 18.04 with UP Board kernel 4.15. There is no problem with loading pps-gpio module, but it sadly takes no parameters (e.g. GPIO number would be nice :smile: ). I was able to make it work on Odroid XU4 (arm architecture) by modifying device tree by adding:
    /* add for pps-gpio */
    pps {
    compatible = "pps-gpio";
    gpios = <&gpx1 2 GPIO_ACTIVE_HIGH>;
    status = "okay";
    };

    Is there any way of achieving this on x86 architecture?

  • DCleriDCleri Administrator, AAEON Posts: 997 admin

    I have found this on Odroid regarding defining the gpio pin for pps: https://wiki.odroid.com/odroid-c2/application_note/gpio/pps

    The pin you have used might be good too, as long as you don't use pin 26 of the header.
    To enable the pin at startup you would need to add a script to export and set the right configuration on a systemd service and enable it.

  • zajacikzajacik New Member Posts: 5

    Yes, I am aware of Odroid C2, but it uses custom 3.14 kernel with different parametrized version of pps-gpio module tailored to Odroid C2. Sadly pps-gpio version in UP Board's 4.15 kernel is different:

    Odroid C2 pps-gpio:
    https://github.com/hardkernel/linux/blob/odroidc2-3.14.y/drivers/pps/clients/pps-gpio.c

    UP Board's pps-gpio:
    https://elixir.bootlin.com/linux/v4.15/source/drivers/pps/clients/pps-gpio.c

    I was hoping there is another way than doing it by creating custom version of pps-gpio kernel module. E.g. like on Odroid XU4 with device tree.

  • zajacikzajacik New Member Posts: 5

    @DCleri Hello again, I want to use physical pin 22, linux gpio 25 as a pps input gpio. I managed to salvage some free time and I am rewriting kernel module from Odroid C2 . Should I refer this pin in my kernel module code as 25, or add some base number (resulting in 358 i guess?)

  • DCleriDCleri Administrator, AAEON Posts: 997 admin

    On UP board Pin22 can be refereed as 25 or 246 (if using the base number).

  • zajacikzajacik New Member Posts: 5

    @DCleri Thank you! How can I find reference using base number for other pins? It would be handy for future purposes.

  • DCleriDCleri Administrator, AAEON Posts: 997 admin

    we will update the UP pinout page soon with the extra information

Sign In or Register to comment.