Enabling PPS GPIO on Torizon (Colibri iMX7D)

I’m trying to enable PPS on iMX7 running TorizonCore.

The PPS signal is connected to pin 8 on the 50 pin header, which should be SODIMM 135 which maps to GPIO1_IO02 on the iMX7.

I have created the following device tree overlay and activated using the command “dtconf activate pps.dts”.

/dts-v1/;
/plugin/;
/ {
	compatible = "toradex";
    fragment@0 {
        target-path = "/";
        __overlay__ {
            pps {
                compatible = "pps-gpio";
                gpios = <&gpio1 2 0>;
                status = "okay";
            };
        };
    };
};

(I also tried without the status = “okay” as I was not sure it was needed).

When I activate this, I get no errors:

# dtconf activate /root/pps.dts
Device is colibri imx7(0039)
Building /root/pps.dts
Successfully built device tree
Validating ./pps.dts.dtbo
Overlay is valid.

However, I’m not seeing a new pps device appearing after reboot:

$ dmesg | grep pps
[    0.093554] pps_core: LinuxPPS API ver. 1 registered
[    0.093560] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    1.668002] pps pps0: new PPS source ptp0

also:

$ ls -l /sys/class/pps/     
total 0
lrwxrwxrwx 1 root root 0 Jun  3 08:39 pps0 -> ../../devices/virtual/pps/pps0

Is there some issue with my device tree overlay, or is there something else that I’m missing?

Edit:

Could the issue be missing support in the kernel? Does TorizonCore not have pps-gpio support enabled? If so, how to enable that support?

Edit #2:

It seems like this is the case:

$ zcat /proc/config.gz | grep -i pps
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set
# PPS clients support
# CONFIG_PPS_CLIENT_KTIMER is not set
# CONFIG_PPS_CLIENT_LDISC is not set
# CONFIG_PPS_CLIENT_GPIO is not set

Would it be possible to enable these (at least GPIO and LDISC) in the official TorizonCore build? If not, how do I go about building a new image with these enabled?

Greetings @hordur,

I can run this by the development team internally and see if enabling this by default would be possible. As long as there’s no outstanding conflicts or issues then usually we have no problems with enabling additional kernel configs.

For the time being and in-case the answer is no, I’ll outline how you can add these configs yourself. You can follow the general instructions of this document: Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center

The key differences being that for i.MX7 Torizon you want to use the toradex 5.4 branch of our kernel. Also for Torizon we don’t have the kernel config as part of the kernel source. In order to get a kernel source you can just simply copy the one on your Torizon device and transfer it to your development machine like so:
zcat /proc/config.gz > config.txt

Once you got the config you can modify it with your additional PPS related configs and build the kernel as normal. This should produce a zImage kernel file.

Now as for updating the kernel on the running device. The kernel on Torizon gets loaded at boot time from this location on the filesystem: /boot/ostree/torizon-{some checksum} in this directory there’s a file called vmlinuz-*. This file is the kernel file you just need to replace it with the new kernel file, making sure to match the name exactly.

After that a quick reboot should load the new kernel if all went well.

But yes I’ll let you know about the decision behind the official support when I get an answer.

Best Regards,
Jeremias

Thanks for the info.
I’ll be waiting to hear about official support.

Is there any update on this?

Apologies for the delay, this request is still being processed, since the team typically adds and tests new kernel configs in batches. I’ll try and get an update from the team here internally.

Best Regards,
Jeremias

Greetings,

This config should now be enabled in our 5.0.0 BSP images and consequently in Torizon 5.0.0. You can get these images via Easy Installer in the CI feeds. Please check if everything’s okay for you. Depending on how you plan to use this feature there may be additional work that needs to be done on the Torizon userspace side so do let us know.

Best Regards,
Jeremias

Great! I will try it out.

Perfect. Let us know your results.

Best regards,
Jaski