• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RPI3 one-wire GPIO pin

aonishenko

Member


Messages: 34

#1
Hi!

I have RPI 3 and FreeBSD 12 installed on it.
Unfortunatelly, there is no any dts file on kernel tree and I cannot define one-wire GPIO pin. Is it possible to define one-wire pi without recompilling kernel and dts\dtb files?
 

aragats

Aspiring Daemon

Thanks: 287
Messages: 768

#4
I may get DTS even from Ubuntu and compile it with dtc in FreeBSD
I believe so. The only thing I noticed that in the latest Ubuntu/Debian old DTBs (e.g. from 3.8 kernels) don't work properly and compiling the corresponding old DTSs doesn't help. That means there were some API changes in the past.
 

Phishfry

Daemon

Thanks: 581
Messages: 2,055

#6
Unfortunatelly, there is no any dts file on kernel tree
There are DTS in the FreeBSD source.

Check this directory:
usr/src/sys/boot/fdt/dts/arm/

Perhaps you don't have the /src tree installed?

You will need to load ow and owc and ow-temp(if needed)
kldload will manually load them.
 

aonishenko

Member


Messages: 34

#7
There are DTS in the FreeBSD source.

Check this directory:
usr/src/sys/boot/fdt/dts/arm/

Perhaps you don't have the /src tree installed?

You will need to load ow and owc and ow-temp(if needed)
kldload will manually load them.
I have the source tree, but I haven't RPI3 DTS definition, only RPI2, but it not arm64 arch.
 

Phishfry

Daemon

Thanks: 581
Messages: 2,055

#8
Looks like there were some changes on -CURRENT
/usr/src/sys/gnu/dts/arm/

If there is a download available on the FreeBSD download page then the dts should be in source files.
 

aonishenko

Member


Messages: 34

#9
Looks like there were some changes on -CURRENT
/usr/src/sys/gnu/dts/arm/

If there is a download available on the FreeBSD download page then the dts should be in source files.
Yes, but also, there is no definition for RPI3

Code:
-rw-r--r--  1 root  wheel     513 15 сент. 13:22 bcm2835-rpi-a-plus.dts
-rw-r--r--  1 root  wheel     513 15 сент. 13:22 bcm2835-rpi-b-plus.dts
-rw-r--r--  1 root  wheel     392 15 сент. 13:22 bcm2835-rpi-b-rev2.dts
-rw-r--r--  1 root  wheel     256 15 сент. 13:22 bcm2835-rpi-b.dts
-rw-r--r--  1 root  wheel     825 15 сент. 13:22 bcm2835-rpi.dtsi
-rw-r--r--  1 root  wheel     550 15 сент. 13:22 bcm2836-rpi-2-b.dts
 

Phishfry

Daemon

Thanks: 581
Messages: 2,055

#11
Checkout crochet board file:
https://github.com/freebsd/crochet/blob/master/board/RaspberryPi3/setup.sh

# Fetch the dtb
dtb="bcm2710-rpi-3-b.dtb"
fetch -o ${dtb} "${DTB_REPO}/${dtb}?raw=true"

# Fetch all the overlays we need
mkdir overlays
overlays="mmc.dtbo pi3-disable-bt.dtbo"
for i in ${overlays}; do
fetch -o overlays/${i} "${DTB_REPO}/overlays/${i}?raw=true"

So it looks like they are using the dtb which is precompiled.
Then they use DTBO to disable the GNU supported Bluetooth and MMC (FreeBSD uses different than Linux here).

So I would assume a similar method is needed from source.
Use the above github DTS and make you own DTSO with the OneWire definitions and compile into a DTBO.

You could use Crochet and inject your DTBO to save some legwork.
A user here has a nice write up on the dtso method on Beaglebone.
https://obsigna.net/?p=660
RPi3 will use the same method.
 
Last edited:

Phishfry

Daemon

Thanks: 581
Messages: 2,055

#14
So this overlay method did work with RPi3 with the DS3231 RTC module.

Here is the correct overlay for Pi with the official Linux w1-gpio DTS overlay.
https://github.com/raspberrypi/linux/blob/rpi-4.9.y/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts
You must also add 'dtoverlay' entries to your Arm's config.txt
"dtoverlay=w1-gpio,gpiopin=4"

Here is a good discussion on w1-gpio on Pi.
https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=156734
The w1-gpio-pullup-overlay confused me but this thread explains alot.

But the question remains can you dynamically load the kernel driver modules instead of recompiling the kernel.
Answer is, not for the RTC I got working... Still trying to get onewire overlay working on Pi3.

For my RTC dtso I also edited out all the other RTC modules and only kept ds3231.
Some of the RTC devices in the I2C-rtc overlay are not supported with a driver in FreeBSD.