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…

loaded

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…