1

I using Buildroot trying to build a Linux image for the Raspberry Pi 3 in which I have access to pulse-per-second (PPS) inputs on one of the GPIO pins.

First off, I have tried this with the standard Raspbian distribution and got it to work with the following changes:

  • Add dtoverlay=pps-gpio,gpiopin=20 to /boot/config.txt.
  • Add pps-gpio to /etc/modules.

I then get an entry /dev/pps0 and when connecting a wire with PPS signal to physical pin 38 on the RPi3 and running pps-test /dev/pps0 I get the expected one signal per second. So far so good.

Now I would like to recreate this with my own image built with Buildroot. I'm using the default configs/raspberrypi3_64_defconfig configuration, but with the following changes in make nconfig:

  • Using kernel branch rpi-4.14.y-rt from github.com/raspberrypi/linux
  • systemd as init system
  • /dev management using udev (from systemd)
  • Target packages -> Hardware handling -> pps-tools activated

(I think that is all the changes I made, but I might have forgotten something..)

In the sdcard.img which I get as output I see the file pps-gpio.dtbo in the boot partition. I add the line dtoverlay=pps-gpio,gpiopin=20 to the file config.txt. I also add the line pps-gpio to a file named pps.conf which I put in /etc/modules-load.d on the file system.

When I boot the system I get no entry /dev/ppsX but when I run lsmod I get (among others): pps_gpio 16384 0 pps_core 20480 1 pps_gpio

Does this mean the dtoverlay has been correctly loaded? What can I try in order to get an entry in /dev/ppsX?

1

Turns out what was missing was to in make nconfig also select:

  • Kernel -> Build Device Tree with overlay support

Also, in the file <buildroot>/board/raspberrypi3-64/genimage-raspberrypi3-64.cfg add the pps-gpio.dtbo file so that the image boot.vfat section looks like this:

image boot.vfat {
  vfat {
    files = {
      "bcm2710-rpi-3-b.dtb",
      "bcm2710-rpi-3-b-plus.dtb",
      "bcm2837-rpi-3-b.dtb",
      "rpi-firmware/bootcode.bin",
      "rpi-firmware/cmdline.txt",
      "rpi-firmware/config.txt",
      "rpi-firmware/fixup.dat",
      "rpi-firmware/start.elf",
      "Image"
    }

    file overlays/pps-gpio.dtbo {
      image = "rpi-firmware/overlays/pps-gpio.dtbo"
    }
  }
  size = 32M
}

Putting the pps.conf file under etc/modules-load.d is not necessary.

With these changes I get a /dev/pps0 device automatically when booting the system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.