I have a DHT22 temperature and humidity sensor that I'd like to use with my 
BeagleBone Black.  A kind soul has written a GPIO driver for the device, 
and when I contacted him, he even tried to help me get it running on my 
BBB.  Problem is, he has another device, and like me, isn't familiar with 
the BBB's device tree configuration.  The driver in question is available 
in two patches:

http://marc.info/?l=linux-iio&m=138270184408677&w=2
http://marc.info/?l=linux-iio&m=138270172108628&w=2

The patches apply cleanly and build without issue using Robert Nelson's 
3.12.1-bone8 (these scripts are fantastic, thanks!).

I have the sensor's data wire connected to P9 27.  In my attempts to make 
this work, I modified arch/arm/boot/dts/am335x-bone-common.dtsi as follows:

At the bottom of the first section (the one that starts with "/ {", I 
suppose this is the root?), I added:

    humidity_sensor {
        pinctrl-names = "default";
        pinctrl-0 = <&dht22>;

        compatible = "dht11-gpio";
        gpios = <&gpio3 19 0>;
    };

At the bottom of the subsequent section (&am33xx_pinmux), I added:

    dht22: dht22 {
        pinctrl-single,pins = <
            0x1a4 0x17 /* P9_27 */
        >;
    };

My understanding is that this puts P9_27 (0x1a4) into mode 7 (GPIO) for 
output pullup.  In talking with the driver developer, he said, "The point 
of my setup is to enable the internal pullup of the imx23 gpio line."  His 
device tree modifications (for imx23-olinuxino.dts) looked like:

                                dht22: dht22a@0 {
                                        reg = <0>;
                                        fsl,pinmux-ids = <
                                                0x0073 /* 
MX23_PAD_GPMI_D07__GPIO_0_7 */
                                        >;
                                        fsl,drive-strength = <0>;
                                        fsl,voltage = <1>;
                                        fsl,pull-up = <1>;
                                };

When I boot and load the driver module, I do see what should be the 
interface to the device: /sys/devices/humidity_sensor.8/iio:device0, but 
when I attempt to read from it, I get "Invalid argument."

# cat /sys/devices/humidity_sensor.8/iio\:device0/in_temp_input 
cat: /sys/devices/humidity_sensor.8/iio:device0/in_temp_input: Invalid 
argument

Does anyone with more device tree and BBB experience have any suggestions?  
I suspect I'm doing something stupid with that pin configuration...  Any 
help would be greatly appreciated, thank you!

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to