How to get IEEE 1588 1PPS on iMX6ULL?

Good morning
we need to get out IEEE 1588 1PPS on iMX6ULL in order to connect it to our data acquisition system. we are interested in having a PPS with an accuracy up to 100 us. Currently we can synchronize via PTP protocol our module iMX6ULL with Linux image BSP 5.7.0 version

Hi @idir !

Sorry for the delay.

Could you please share more information about the setup you are using?

  • Which exact Colibri iMX6ULL are you using? Please share its full name and version
  • Are you building your image using Yocto and BSP 5.7? Or TorizonCore 5.7?
  • Are you using an upstream or downstream based kernel?

Best regards,

Hi @henrique.tx ,
i am using Colibri iMX6ULL 512MB IT V1.1 A, with BSP 5.7.0 image builded using Yocto and upstream based kernel

Hi @idir !

We have the kernel configurations related to IEEE1588 and PPS already enabled by default, as seen below:

root@colibri-imx6ull-emmc-07201242:~# cat /etc/os-release
ID=tdx-xwayland-upstream
NAME="TDX Wayland with XWayland Upstream"
VERSION="5.7.0+build.20 (dunfell)"
VERSION_ID=5.7.0-build.20
PRETTY_NAME="TDX Wayland with XWayland Upstream 5.7.0+build.20 (dunfell)"
DISTRO_CODENAME="dunfell"

root@colibri-imx6ull-emmc-07201242:~# zcat /proc/config.gz | grep -iE "1588|ptp|pps"
CONFIG_HAVE_OPTPROBES=y
CONFIG_NET_PTP_CLASSIFY=y
CONFIG_NF_CONNTRACK_PPTP=m
CONFIG_NF_NAT_PPTP=m
# CONFIG_PPTP is not set
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set
# PPS clients support
# CONFIG_PPS_CLIENT_KTIMER is not set
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y
# PPS generators support
# PTP clock support
CONFIG_PTP_1588_CLOCK=y
# end of PTP clock support

To activate the PPS, you can refer to this solved question from NXP’s forum: Solved: How to get IEEE 1588 1PPS on i.MX6Q? - NXP Community

The ptp4l command there comes from NXP’s i.MX Linux Reference Manual, downloadable from Embedded Linux for i.MX Applications Processors | NXP Semiconductors. For BSP 5, please access the “Documentation” link from “Linux 5.4.70_2.3.0” release. The section “ENET IEEE-1588” will be helpful for you. You will need to create an account to download it.

Let us know if this helps you.

Best regards,

Hi @henrique.tx
thank you for your answer, I checked our iMX6ULL, indeed, it has same configurations as yours with EEE1588 and PPS enabled and I can also sync it with PTP using the ptp4l command, but I still can’t enable PPS output on GPIO. I have read the documentation that you have indicated to me however honestly I struggle to understand which file tds I have to modify and which string I have to add in it for iMX6ULL , I will be grateful if you give me some hints about it

hey @idir,

Sorry for the late response! Do you still need some guidance on this one?

To use a GPIO as a GPIO PPS generator. You’ll have to configure the specific GPIO pin in the device tree. This will also include disabling that pins previous functionality.

here is our write up on it.

-Eric

Hi @eric.tx , yes I still need some guidance in order to generate PPS . I looked at the link you sent me; however, it seems that it concerns the enabling of receiving the PPS not the generation of it. Reading various posts about how to enable the generation of PPS, I noticed that I have to modify device tree file but I need to know how to do it for iM6ULL.

Hey @idir,

How* familiar with how to modify the device tree?

What is left is to modify the device tree with the correct GPIO pin that you want to use. (Do you need to use a specific GPIO pin?)

Our example that adds a pps node under the root node in the device tree:

  / {
      model = "Toradex Colibri iMX7D 1GB on Colibri Evaluation Board V3 Testing for custom carrier";
      compatible = "toradex,colibri_imx7d_emmc-eval", "toradex,colibri_imx7d_emmc", \
               "fsl,imx7d";
      pps {
          compatible = "pps-gpio";
          gpios = <&gpio1 2 0>;
          assert-falling-edge;
     };
  };

So model/compatibility need to match yours and the correct gpios need to be modified to your situation. But this should produce the designed output results. I was able to test on the Colibri and it appears to be working.

Edit: So I misunderstood PPS source vs generation. Let me do some more research and i will come back!

-Eric

Hey @eric.tx,
thanks , I’m not a device tree expert, but I’m able to make changes and recompile it as I did in the past. in order to generate PPS signal I would like to use GPIO1_IO26 but we have no restriction to use any GPIO.
I’m waiting for you to let me know something.
Idir

Hey @idir,

I’m trying to find out more information internally. But it may be that while we have an included driver for pps generator, we may not officially support/have resources for the generator aspect of PPS.

Driver in question:
https://git.toradex.com/cgit/linux-toradex.git/tree/drivers/pps/generators/pps_gen_parport.c?h=colibri

Still trying to find out more information.

-Eric

@idir,

How have you been getting on with this? We tried to load the driver I previously mentioned. Unfortunate it is quite dated (2009) and I believe support might have dropped has it has listed broken dependence when attempting to config it in the kernel. There is a chance this could still load and work with some tweaking, but as of right now it still does not seem supported.

Here is some more information.

https://www.kernel.org/doc/html/v5.6/driver-api/pps.html#generators

Are you able to find a work around?

-Eric

Hi @eric.tx ,
Unfortunately I haven’t found any solution yet