Help with Device Tree, Trying to expose kernel pps

Hello, I am new to the Beagle Bone platform and Linux/Unix. I am working on a project to generate a kernel 1pps from the bbb platform over the gpio/header.

I followed Derek Molloy’s video series on kernel modules before beginning ( [Writing a Linux Loadable Kernel Module (LKM) - Interfacing to GPIOs | derekmolloy.ie](Writing a Linux Loadable Kernel Module (LKM) - Interfacing to GPIOs | derekmolloy.ie)) . I was able to compile his modules.

I tried to use a github ( [jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins (github.com)](GitHub - jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins))

I could not get am335x to work or find it on my beagle, so i changed a gps device tree to pps out not pps in. The kernel module told me I had more than one pps generator and stopped.

When the github failed, I tried to follow the published guide ( SetupGuide.632280828.pdf (usermanual.wiki)) i found online.

I could not find (apt-get install linux-image-4.12.14.bone4) anymore and I used a 4.14 version that was slightly newer. This was on image Debian 9.3 2018-01-28 4GB SD LXQT.

When I tried the step “build_kernel.sh” it ran out of space. I tried to downside the packages, I removed about 1gb worth but it was not enough. It looked like the build_kernel was downloading more than 4gb.

I also tried to follow this guide: [PTP Time Synchronization for FlockLab 2 (ethz.ch)](https://pub.tik.ee.ethz.ch/students/2020-FS/SA-2020-01.pdf) but it did not have posted code.

Sorry for my poor english, it is my second language and I do microcontroller work as a contractor. I am learning but this project I have is tough :slight_smile:

Hi @rony_vargas you don’t need a custom or older kernel build anymore… PPS is built-in today, just use the latest image and customize your overlays.

What’s your goal for this signal?

Do you have a PPS coming from a GPS device, or is your goal to generate your own PPS signal (will it reference something like GPS?)

or…

Edit: update, well there really isn’t a in-kernel generator at this point for us… Kconfig « generators « pps « drivers - kernel/git/torvalds/linux.git - Linux kernel source tree

Probably best to forward port: GitHub - jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins to newer kernel’s…

Regards,

I want to generate my own PPS signal. So I need this PPS to be Control by upstream NTP or PTP source. My device has not GPS.

Do you have an advise or suggestions for forwarding the port of “pps-gen-gpio?” for new kernel? Should I try this on latest 4 or latest 5?

Thank you,

How much linux kernel experience do you have?

You can rebuild 4.12.x but you’ll need to do it on an x86, as the full build will take a large amount of space… (and it slow on an am335x…)

Regards,

Well I don’t have a lot experince in linux kernel.

Where is this dts (am335x-boneblack.dts)? Do I need to make a new one?

Hello Robert, is the am335x-boneblack.dts file for when you compile the kernel on another machine?

How should I port this forward from here; do i need a better overlay file?

Do i download the overlays and use it to generate my overlay file?

Anyways, I installed the overlays and I did my overlay file to generate the pps but it didn’t work. Here is my overlay file
DD-GPS-00A0.dts.txt (2,2 KB)

I proved the github program of the pps of this jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins (github.com), but when I proved it, it gived me an error that the library #include <linux/init.h> is not there, so I didn’t understand why is that problem.

But, When I changed the Makefile to this:
obj-m+=pps_gen_gpio.o

all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean

it make the kernel module but I proved it, it didn’t give the output of the pps.
kernel pps
Here is the picture when I proved it.

Thank you,
Rony Vargas

sudo apt install linux-headers-`uname -r`

PS, this is why screen shot’s suck…

it loaded…

Your overlay looks fine…

you should have a directory under /opt/source/bb.org-overlays/

So copy your overlay to /opt/source/bb.org-overlays/src/arm/

Then run:

cd /opt/source/bb.org-overlays/
make
sudo make install

Then as long as you reference DD-GPS-00A0.dtbo in /boot/uEnv.txt it should load…

Regards,

Hello Robert, sorry for annoy again about this program of the PPS. Well I was proving again the program of the PPS,but it is not working, I checked the pin of the beaglebone to see If I see an output, but nothing yet. The DTS file that I posted, well it did not work. I had to remove some syntax from it and only have the pps gen and no pps in. I compiled it with the make and make install, and edited the /boot/uEnv.txt file to load it. Here is the overlay file:

forRobert.dts (2,2 KB)

I put the kernel files in /usr/src/linux-headers-4.19.94-ti-r42/drivers/pps/generators to build kernel module. When I used the original Makefile of the program and start to build the kernel. it gived me this error:

Original Makefile error

/// This is the original Makefile

Makefile for PPS generators.

obj-$(CONFIG_PPS_GENERATOR_PARPORT) += pps_gen_parport.o
obj-$(CONFIG_PPS_GENERATOR_GPIO) += pps_gen_gpio.o

ifeq ($(CONFIG_PPS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
endif

But when I changed the Makefile to this:
obj-m+=pps_gen_gpio.o

all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean

it built the kernel module and when I did the dmesg,it said this:

it seems to be working but I only see the message “GPIO PPS signal generator”, the others that has to show doesn’t appear in the terminal.

Sorry I can only post one picture because I am new user :frowning:

Any thoughts or guidance friends?

Thank you,
Rony Vargas

Hope you had a good holiday my friend,
If you have any advice please share.
I checked the headers and they are the same as “uname” command.
Thank you,
Rony

@Robert Hope you had a good holiday…

@RobertCNelson Hello my friend, do you think you could offer some help please? I have tried many things but alas, nothing. no pps.

@rony_vargas I have some interest in having a beagle as a sourced pps reference, so i hope you can share if you make a break thru. :smiley:

Could you re-detail what steps you have taken to get you where in a single post?
I think Robert recommended you install the dts overlay file and i believe he implied that should make everything work but did you already have an overlay file installed? The file that @RobertCNelson said should work, did it actually compile in the place he told you about?

Hello my friend @BobTheBuilder is a pleasure, Well I proved the github program of the pps of this link: jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins (github.com), but when I proved it, it gived me an error that the library #include <linux/init.h> is not there, so I didn’t understand why is that problem.

But, When I changed the Makefile to this:
obj-m+=pps_gen_gpio.o

all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean

it make the kernel module but I proved it, it didn’t give the output of the pps.
image

The DTS overlay file that Roberts recommended me I installed in the directory that it told me : cd /opt/source/bb.org-overlays/ and I used make and sudo make install

The overlay file That I used is this:
forRobert.dts (2,2 KB)

Thank you,
Rony Vargas

Hello my friend @RobertCNelson, How are you? Well I was checking this dts file " am335x-boneblack.dts", jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins (github.com) , but I saw three dtsi include:

#include “am33xx.dtsi”
#include “am335x-bone-common.dtsi”
#include “am335x-boneblack-common.dtsi”

Where I can find those dtsi files?.

Thank you,
Rony Vargas

1 Like

That is kernel 4.19.x. There are more kernels in the menu for selecting the kernels that are available.

Seth

P.S. I think some .dts/.dtsi files are in the kernel now, too. Here is the link to the kernel docs. for the am335x which the BBB holds: dts « boot « arm « arch - kernel/git/torvalds/linux.git - Linux kernel source tree

That is of course the latest/greatest but you can view whatever kernel they have available (I think).

Would it be better to add this into a kernel instead of as a kernel module? I think you would still need the cape overlays.

Could someone help me with this (pps)? I am not sure where i have gotten lost on this module.

@silver2row @BobTheBuilder @RobertCNelson

@rony_vargas, I am sorry I cannot be much help on this. I do generic linux R&D with user space applications. I am not versed in kernel space that well and hit a hiccup with your device tree file. I can ask, did you properly install the headers like Robert mentioned?
@RobertCNelson or @silver2row would be better help.

Strange thing: I found that someone has “port forwarded” it to 5.4 and claimed they tested it on kernel 5.4.152 w/ P9 pin16 as PPS output. It looks like 1-to-1 copy of the code from GitHub - jsln/pps-gen-gpio: Linux kernel PPS generator using GPIO pins that @rony_vargas linked.

Side note: A pps that is generated out of the beagle would be 3.3v correct? An adapter board could be implemented if 5v logic was needed, say for interfacing with some video/audio capture equipment.

1 Like

Yes my friend but I did all the steps that @RobertCNelson told me, I installed the headers like Robert mentioned. I don’t know what is the problem,I did the steps about the link but it is not working.

@RobertCNelson my friend I saw that you contributed in the post about the pps overlays( Issues creating a PPS overlay · Issue #91 · beagleboard/bb.org-overlays · GitHub. Do you think this is what I need? the overlays to create the pps gpio output for the signal?

Best Regards,
Rony Vargas.

Any help @RobertCNelson @silver2row @BobTheBuilder?

Thank you,
Rony Vargas