Multiple onewire w1-gpio devices with kernel 4.14.71-ti-r80

79 views
Skip to first unread message

cirnod

unread,
Jul 19, 2019, 3:54:35 AM7/19/19
to BeagleBoard
Dear all

I am trying to get multiple (currently 2) onewire (w1-gpio) devices running at the same time with two entries in the filesystem
/sys/bus/w1/devices/w1_bus_master1
/sys/bus/w1/devices/w1_bus_master2
and mapping to two pins (in my case  pins P8.39 and P8.41). I am using a BeagleBone Green running Debian 9 with kernel 4.14.71-ti-r80.

Unfortunately, I could not get it working so far. The closest I got, is the device tree overlay file below (based on BB-W1-P9.12-00A0.dts from https://github.com/beagleboard/bb.org-overlays):
/*
 * Copyright (C) 2015 Robert Nelson <robert...@gmail.com>
 *
 * Virtual cape for onewire on connector pins P8.39 and P8.41
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

    /* identification */
    part-number = "BB-W1-test";
    version = "00A0";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P8.39",
        "P8.41";

    /*
     * Free up the pins used by the cape from the pinmux helpers.
     */
    fragment@0 {
        target = <&ocp>;
        __overlay__ {
            P8_39_pinmux { status = "disabled"; };
            P8_41_pinmux { status = "disabled"; };
        };
    };

    fragment@1 {
        target = <&am33xx_pinmux>;
        __overlay__ {

            dallas_w1_pins_tx: pinmux_dallas_w1_pins@0 {
                pinctrl-single,pins = <
                    BONE_P8_39 0x37
                >;
            };

            dallas_w1_pins_rx: pinmux_dallas_w1_pins@1 {
                pinctrl-single,pins = <
                    BONE_P8_41 0x37
                >;
            };
        };
    };

    fragment@2 {
        target-path="/";
        __overlay__ {

            w1_1: onewire@0 {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&dallas_w1_pins_tx>;

                compatible = "w1-gpio";
                gpios = <
                  &gpio2 12 GPIO_ACTIVE_HIGH
                >;
            };

            w1_2: onewire@1 {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&dallas_w1_pins_rx>;

                compatible = "w1-gpio";
                gpios = <
                    &gpio2 10 GPIO_ACTIVE_HIGH
                >;
            };
        };
    };
};




With this device tree overlay, I get one fully functional onewire device on P8.41, but the second device on P8.39 fails to setup:

Error messages in dmesg output:
[   27.032134] pinctrl-single 44e10800.pinmux: pin PIN44 already requested by onewire@1; cannot claim for onewire@0
[   27.153240] pinctrl-single 44e10800.pinmux: pin-44 (onewire@0) status -22
[   27.224225] pinctrl-single 44e10800.pinmux: could not request pin 44 (PIN44) from group pinmux_dallas_w1_pins  on device pinctrl-single
[   27.330704] w1-gpio onewire@0: Error applying setting, reverse things back
[   27.442753] w1-gpio: probe of onewire@0 failed with error -22

As a consequence, in the filesystem I only see one device:
/sys/bus/w1/devices/w1_bus_master1

If I comment out one section (w1_1 or w1_2) in fragment@2, I get one working onewire device on either P8.39 or P8.41.

I would be happy for any suggestions or help to get both onewire devices running at the same time.

Jim F

unread,
Jul 19, 2019, 4:48:13 AM7/19/19
to beagl...@googlegroups.com
Congratulations to you on that ;we were completely unable to get 1w working on 4.14. After upgrading to 4.19 and using the default 1w dtb, things worked perfectly. Unfortunately we only use a single device so I can't say whether 4.19 will help you in this case.

Best regards, 
Jim 

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/1d799ac2-7bd9-4c15-91a0-bec7086d0730%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TJF

unread,
Jul 19, 2019, 11:13:09 AM7/19/19
to BeagleBoard
The W1 bus is designed for one master and multiple slave devices -> only one GPIO pin necessary. Unfortunately the kernel driver doesn't support this.

Check out libpruw1 for advanced features, including a bus log function to monitor the line during operation.

Regards

Robert Nelson

unread,
Jul 19, 2019, 11:27:59 AM7/19/19
to Beagle Board, cir...@gmail.com
> fragment@2 {
> target-path="/";
> __overlay__ {
>
> w1_1: onewire@0 {
> status = "okay";
> pinctrl-names = "default";
> pinctrl-0 = <&dallas_w1_pins_tx>;
>
> compatible = "w1-gpio";
> gpios = <
> &gpio2 12 GPIO_ACTIVE_HIGH
> >;
> };
>
> w1_2: onewire@1 {
> status = "okay";
> pinctrl-names = "default";
> pinctrl-0 = <&dallas_w1_pins_rx>;
>
> compatible = "w1-gpio";
> gpios = <
> &gpio2 10 GPIO_ACTIVE_HIGH
> >;
> };
> };
> };
> };

You used the exact same name for both pinmux identifiers:
"dallas_w1_pins_rx"... give each a unique name..

(and use v4.19.x based kernel)..

Regards,

--
Robert Nelson
https://rcn-ee.com/
Reply all
Reply to author
Forward
0 new messages