I have the RPi3 running on FreeBSD -CURRENT r327524 with the onewire driver.
There are two ways I have found to enable OneWire on RPi3.
Simplest is to use the GNU device tree source file and alter one setting. phandle hex address.
Here is the GNU DTS:
https://github.com/krzk/tizen-tv-rp...rch/arm/boot/dts/overlays/w1-gpio-overlay.dts
On Line 16 you must edit and change this:
<&gpio 4 0>
to this:
<0xc 4 0>
This represents 'phandle' 0xc which is the gpioc0 controller. "4" being the pin used and "0" sets the state.
So the device tree overlay method works but 2 drawbacks.
#1 You cannot change the gpio pin in the /boot/msdos/config.txt file that is used for overlays.
So while your modifying the overlay feel free to use another pin.
I prefer to use GPIO 17(header pin 11). So you must change all instances of "4" in the w1-gpio-overlay.dts.
So now its time to save your overlay file on the RPi3.
It should be named this: /boot/msdos/overlays/w1-gpio-overlays.dts
Now to compile it.
Now to add the overlay to your environment:
So one problem here. You can only use pin4. The overlay method on does not work correctly here.
You should be able to specify a pin like this in your /boot/msdos/config.txt
Unfortunately it does not use the gpiopin=* number specified. It defaults to pin 4.
Now add the Onewire modules to load on boot:
#2 The second major problem is that I can only create 1 onewire bus via the overlay method.
Whereas you should be able to create multiple pins/buses in the config.txt like this:
It does not work correctly and only uses the first line and only uses gpio pin 4.
You can modify the above overlay to use other pins.
You can also create additional overlay files for each pin/bus.(See below for example)
https://www.raspberrypi.org/forums/viewtopic.php?t=156734
There is another harder way I will show in my next post. Better suited to multiple pins.
Decompiling the dtb
There are two ways I have found to enable OneWire on RPi3.
Simplest is to use the GNU device tree source file and alter one setting. phandle hex address.
Here is the GNU DTS:
https://github.com/krzk/tizen-tv-rp...rch/arm/boot/dts/overlays/w1-gpio-overlay.dts
On Line 16 you must edit and change this:
<&gpio 4 0>
to this:
<0xc 4 0>
This represents 'phandle' 0xc which is the gpioc0 controller. "4" being the pin used and "0" sets the state.
So the device tree overlay method works but 2 drawbacks.
#1 You cannot change the gpio pin in the /boot/msdos/config.txt file that is used for overlays.
So while your modifying the overlay feel free to use another pin.
I prefer to use GPIO 17(header pin 11). So you must change all instances of "4" in the w1-gpio-overlay.dts.
So now its time to save your overlay file on the RPi3.
It should be named this: /boot/msdos/overlays/w1-gpio-overlays.dts
Now to compile it.
cd /boot/msdos/overlays/
dtc -I dts -O dtb -o w1-gpio-overlay.dtbo w1-gpio-overlay.dts
Now to add the overlay to your environment:
echo "dtoverlay=w1-gpio-overlay" >>/boot/msdos/config.txt
So one problem here. You can only use pin4. The overlay method on does not work correctly here.
You should be able to specify a pin like this in your /boot/msdos/config.txt
Code:
dtoverlay=w1-gpio-overlay,gpiopin=17
Now add the Onewire modules to load on boot:
echo "owc_load="YES">>/boot/loader.conf
echo "ow_load="YES">>/boot/loader.conf
echo "ow_temp_load="YES">>/boot/loader.conf
#2 The second major problem is that I can only create 1 onewire bus via the overlay method.
Whereas you should be able to create multiple pins/buses in the config.txt like this:
Code:
dtoverlay=w1-gpio-overlay,gpiopin=17
dtoverlay=w1-gpio-overlay,gpiopin=27
dtoverlay=w1-gpio-overlay,gpiopin=22
You can modify the above overlay to use other pins.
You can also create additional overlay files for each pin/bus.(See below for example)
https://www.raspberrypi.org/forums/viewtopic.php?t=156734
There is another harder way I will show in my next post. Better suited to multiple pins.
Decompiling the dtb