0

I'm trying to connect an hx711 to GPIO23 and GPIO24 pins on an RPI3 A+, and I need to specify this in the device tree to have the hx711.ko driver be probed. I've been stuck on this problem for some time now, here is what I have done so far:

-Enabled the hx711 driver using menuconfig and rebuilt the kernel

-Wrote the following device tree overlay based on the suggestion in the hx711 device tree documentation:

/dts-v1/; 
/plugin/;
/{
compatible = "brcm,bcm2708";
fragment@0 {
    __overlay__ {
        target = <&gpio>;       

            weight_gpio: weight_gpio {
                brcm,pins = <0x17 0x18>;
                brcm,function = < 0x00 >;
                #gpio-cells = < 0x02 >;
            };
        };
    };
fragment@1 {
    __overlay__ {
            target = <&soc>;    
            weight: weight {
                compatible = "avia,hx711";
                sck-gpios = <&weight_gpio 0x17 0>;
                dout-gpios = <&weight_gpio 0x18 0>;
                avdd-supply = <&vdd_3v3_reg>;
                status = "okay";
            };
        };
    };
};

-Built using dtc giving the following output:

dtc -@ -I dts -O dtb -o hx711.dtbo hx711.dts
hx711.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
hx711.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property

-added dtoverlay=hx711 line in config.txt

-Examined the currently loaded device tree using dmesg and the dtc command. Here is the output..

I get no information about my overlay. Not even and error saying it wasn't loaded.

I can see that the overlay I wrote for the mpu6050 (i2c device) works fine.

Any suggestions are appreciated.

  • Well, if you build I2C mpu6050 OK, it does not mean non I2C xh711 should be OK. Hx711 protocol is very unusual, so the driver building stuff might not be easily updated, or compatible to every OS version. You might like to let us know the GitHub link and your os version, jessie or stretch etc. – tlfong01 Sep 26 '19 at 5:27
  • I would like to recommend the PyPi python module: pypi.org/project/hx711 – tlfong01 Sep 26 '19 at 6:16
  • You are more likely to get a useful answer at raspberrypi.org/forums/viewforum.php?f=107 – joan Sep 26 '19 at 7:54
0

I was able to create an overlay for hx711 driver for the Raspberry Pi Zero (thanks to Andreas Klinger)

I do not have any experience with the devicetree, but I think you have to target directly the devicetree, not soc or gpio.

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>

/ {
    compatible = "brcm,bcm2835";

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

            // El segundo "hx711" es el nombre que veremos en /proc/device-tree/XXX/
            hx711: hx711 {
                compatible = "avia,hx711";
                sck-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
                dout-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
                avdd-supply = <&vdd_3v3_reg>;
                status = "okay";
            };
        };
    };
};
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.