Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Mar 2018 18:12:02 -0700
From:      Oleksandr Tymoshenko <gonzo@bluezbox.com>
To:        Shamim Shahriar <shamim.shahriar@gmail.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: PPS or /dev/ppsN on Raspberry Pi 3
Message-ID:  <20180312011202.GA60784@bluezbox.com>
In-Reply-To: <819975e8-56a8-677b-e5f5-003ff2091553@gmail.com>
References:  <819975e8-56a8-677b-e5f5-003ff2091553@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Shamim Shahriar (shamim.shahriar@gmail.com) wrote:
> Good evening everyone.
> 
> Objective: get a GPS module work with Raspberry Pi 3 and FreeBSD 
> v12-CURRENT (it has been indicated on several sites that the earlier 
> versions of FreeBSD do not play well with Pi3), and get a /dev/pps0 so I 
> can get the PPS from gpio 18 and time from a usb serial converter.
> 
> I have the hardware and they are all plugged in exactly as they should. 
> if I replace the pi with a Pi-B then it all works exactly as they 
> should, but with Pi3 it is proving to be more challenging. I had been 
> trying various things in the Kernel to get the /dev/pps0 (and also 
> /dev/pps1, which I am enabling in case I get to use another module) 
> which has not created even once so far.
> 
> IAll the documentation I have come across refers to rPi up to model 2, 
> and nothing on 3. As far as I can gather, I need to put
> options         PPS_SYNC
> 
> in the kernel configuration, which I did. There are also instructions on 
> adding pps lines to the various dtb files that goes into the /boot/msdos 
> folder -- but Rasperry Pi3 /does not/ have the /boot/msdos, it has efi, 
> and my understanding is that the content of the efi is actually pulled 
> from the github (no source available, only the final binaries to put in 
> there). I tried to put those on rpi2.dts, didn't work.
> 
> here are the relevant lines from the file. Please note, I want to PPS, 
> one on gpio18 the other on gpio 23/
> 
>          rpi_ft5406 {
>                  compatible = "rpi,rpi-ft5406";
>                  status = "okay";
>          };
> 
> 
>          pps@0 {
>                  compatible = "pps-gpio";
>                  gpios = <&gpio 18 0>;
>                  status = "okay";
>          };
> 
>          pps@1 {
>                  compatible = "pps-gpio";
>                  gpios = <&gpio 23 0>;
>                  status = "okay";
>          };
> 
> 
>          leds {
>                  compatible = "gpio-leds";
> 
> 
> my understanding is, whatever dtb file is being used on RPi3, these are 
> downloaded from github 
> (https://github.com/raspberrypi/firmware/tree/master/boot) and there is 
> no way of modifying them as they are all binary files. Would appreciate 
> if someone could please confirm that for me.
> 
> Would appreciate if someone could please point me to the correct 
> direction as I seem to be going around very blindly and not seeing the 
> possible solution to the problem.

You can use FDT overlays for this:

- Use https://people.freebsd.org/~gonzo/pps-overlay-example.dts as
  a starting point.
- Compile overlay: dtc -@ -o pps.dtbo pps-overlay-example.dts
- Copy pps.dtbo to overlays/ directory on FAT partition
- Add "dtoverlay=pps" to config.txt on FAT partition.
- Reboot Pi3 and check if pps nodes are in active DTB:
  sysctl -b hw.fdt.dtb | dtc -I dtb -O dts | grep pps

The problem with this approach is that it depends on
default pinmux configuration. The right way is to use
this example as a base:
https://github.com/raspberrypi/linux/blob/rpi-4.9.y/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts

This is self-contained overlay that also includes
pinmux configuration but requires pinctrl driver.
Driver is implemented but not committed to HEAD yet
because it depends on couple of changes that
are still pending reviews.

-- 
gonzo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180312011202.GA60784>