Enabling ADC on a Beaglebone Black running FreeBSD 12.0-CURRENT (BEAGLEBONE)
Emmanuel Vadot
manu at bidouilliste.com
Thu Mar 30 20:42:20 UTC 2017
On Thu, 30 Mar 2017 13:28:58 -0700
Oleksandr Tymoshenko <gonzo at bluezbox.com> wrote:
> Dr. Rolf Jansen (rj at obsigna.com) wrote:
> > Today I updated once again my Beaglebone Black by
> > merging-in the latest FreeBSD 12.0-CURRENT (BEAGLEBONE)
> > snapshot, and once again I enabled the ADCs on the
> > Beaglebone in the device tree blob am335x-boneblack.dtb,
> > and the ADC is still working fine.
> >
> > Even if it is not that a big hassle to modify the device
> > tree blob, I am curious on why the ADC has been disabled
> > in the blob in the first place, end even more, given the
> > fact that the device ti_adc driver is built-in to kernel
> > and once enabled, the ADC is functional.
> >
> > Didn't it work at some time in the past? Now it is.
> >
> > What is missing to activate the ADC in the device tree
> > blob by default?
>
> Few months ago FreeBSD switched to using upstream DTB files
> instead of custom-made ones. For some reason ADC is disabled
> in upstream. If you're running recent FreeBSD you can use
> dtb overlays to enable ADC without hassle of maintaining
> custom dts file. You can do following:
>
> 1. Create am335x-beaglebone-tscadc.dts with following
> content:
>
> /dts-v1/;
> /plugin/;
>
> / {
> compatible = "ti,am335x-bone-green", "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
>
> fragment at 0 {
> target = <&tscadc>;
> __overlay__ {
> status = "okay";
> adc {
> ti,adc-channels = <0 1 2 3 4 5 6>;
> };
> };
> };
> };
>
> 2. Compile overlay:
> $ dtc -I dts -O dtb -o am335x-beaglebone-tscadc.dtbo am335x-beaglebone-tscadc.dts
>
> 3. Copy it to /boot/dtb/ directory on your BBB
>
> 4. Enable overlay in /boot/loader.conf by adding following line:
>
> fdt_overlays="am335x-beaglebone-tscadc.dtbo"
>
> --
> gonzo
I guess that ADC uses pins that can be used for other purpose so they
didn't enabled it by default ? If it's not the case they should be
enable by default.
Note 1 : You need to use a recent dtc (i.e. the latest dtc imported in
HEAD)
Note 2 : We really need to add some dtbo facility for people in the
buildkernel process.
--
Emmanuel Vadot <manu at bidouilliste.com> <manu at freebsd.org>
More information about the freebsd-arm
mailing list