*1-wire workflow:*

*Hardware setup:*

Everything is directly connected via jumper wires, with no additional
components.

DS18B20 PIN1 connected to Beaglebone P9.1  (ground)
DS18B20 PIN2 connected to Beaglebone P9.22 (1-wire data)
DS18B20 PIN3 connected to Beaglebone P9.5  (Vdd 5v)


Remove any currently loaded overlays that might be using P9_22, then reboot.

Install git if need be:
william@beaglebone:~/dev$ sudo apt-get install git

git clone the bb.org-overlays repo:
william@beaglebone:~/dev$ git clone
https://github.com/beagleboard/bb.org-overlays

Move into the source directory:
william@beaglebone:~/dev$ cd ./bb.org-overlays/src/arm

Find the file we're looking for:
william@beaglebone:~/dev/bb.org-overlays/src/arm$ ls |grep W1
BB-W1-P9.12-00A0.dts

Make a copy of the file while renaming it in one go:
william@beaglebone:~/dev/bb.org-overlays/src/arm$ cp BB-W1-P9.12-00A0.dts
BB-W1-P9.22-00A0.dts


Edit copied 1-wire overlay source to suit our needs:
william@beaglebone:~/dev/bb.org-overlays/src/arm$ diff BB-W1-P9.12-00A0.dts
BB-W1-P9.22-00A0.dts
4c4
<  * Virtual cape for onewire on connector pin P9.12
---
>  * Virtual cape for onewire on connector pin P9.22
21c21
<       part-number = "BB-W1-P9.12";
---
>       part-number = "BB-W1-P9.22";
27c27
<               "P9.12";
---
>               "P9.22";
35c35
<                                       BONE_P9_12 0x37
---
>                                       BONE_P9_22 0x37
51c51
<                               gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
---
>                               gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;

Backout to the base path:
william@beaglebone:~/dev/bb.org-overlays/src/arm$ cd ../..

Build our newly created overlay:
william@beaglebone:~/dev/bb.org-overlays$ make
./src/arm/BB-W1-P9.22-00A0.dtbo

"Install" our overlay:
william@beaglebone:~/dev/bb.org-overlays$ sudo cp
./src/arm/BB-W1-P9.22-00A0.dtbo /lib/firmware/

Load our overlay:
william@beaglebone:~/dev/bb.org-overlays$ sudo sh -c "echo 'BB-W1-P9.22' >
/sys/devices/platform/bone_capemgr/slots"

Check if the overlay loaded:
william@beaglebone:~/dev/bb.org-overlays$ cat
/sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
 4: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-W1-P9.22

 william@beaglebone:~/dev/bb.org-overlays$ dmesg |grep W1
[ 2826.626795] bone_capemgr bone_capemgr: part_number 'BB-W1-P9.22',
version 'N/A'
[ 2826.626871] bone_capemgr bone_capemgr: slot #4: 'Override Board
Name,00A0,Override Manuf,BB-W1-P9.22'
[ 2826.641278] bone_capemgr bone_capemgr: slot #4: dtbo
'BB-W1-P9.22-00A0.dtbo' loaded; overlay id #0

Check to make sure kernel modules loaded or not:
william@beaglebone:~/dev/bb.org-overlays$ lsmod |grep w1
w1_therm                4886  0
w1_gpio                 3764  0
wire                   35398  2 w1_gpio,w1_therm

Check sysfs:
william@beaglebone:~/dev/bb.org-overlays$ ls /sys/bus/w1/devices/
28-00000647ddf6  w1_bus_master1

Read from our sensor:
william@beaglebone:~/dev/bb.org-overlays$ cat
/sys/bus/w1/devices/28-00000647ddf6/w1_slave
16 01 4b 46 7f ff 0a 10 98 : crc=98 YES
16 01 4b 46 7f ff 0a 10 98 t=17375

Pat self on back for job well done !

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CALHSORo6Yn3ORAM8V4VJbN%3D%2B6ZPEddPtFfQ4BTuvvmOH20%2Bs6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to