Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
en:c2_hardware_1w [2016/02/29 14:13] ck.kim |
en:c2_hardware_1w [2016/11/03 09:02] odroid [Change the Default GPIO pin for 1-Wire interface] |
||
---|---|---|---|
Line 5: | Line 5: | ||
- | Default GPIO for 1-Wire is **Pin #7 (GPIOX_21, GPIO113)** | + | Default GPIO for 1-Wire is **Pin #7 (GPIOX.BIT21)** |
* **Connection: With External-Supply** | * **Connection: With External-Supply** | ||
Line 12: | Line 12: | ||
Pin 1 (Left): Ground (-) | Pin 1 (Left): Ground (-) | ||
- | Pin 2 (Middle): Pin #7 C2 (GPIOX_21, GPIO113) | + | Pin 2 (Middle): Pin #7 C2 (GPIOX.BIT21) |
Pin 3 (Right): VCC (3.3V) | Pin 3 (Right): VCC (3.3V) | ||
Line 23: | Line 23: | ||
Pin 1 (Left): Ground (-) | Pin 1 (Left): Ground (-) | ||
- | Pin 2 (Middle): Pin #7 C2 (GPIOX_21, GPIO113) | + | Pin 2 (Middle): Pin #7 C2 (GPIOX.BIT21) |
Pin 3 (Right): Ground (-) | Pin 3 (Right): Ground (-) | ||
Line 30: | Line 30: | ||
* Load the required kernel modules: <code>modprobe w1-gpio && modprobe w1-therm</code> | * Load the required kernel modules: <code>modprobe w1-gpio && modprobe w1-therm</code> | ||
- | * Check if your sensor is working: <code>root@odroid:~# cd /sys/bus/w1/devices/ | + | * Check if your sensor is working: <code>odroid@odroid64:~$ cd /sys/bus/w1/devices/ |
- | root@odroid:/sys/bus/w1/devices# ls | + | odroid@odroid64:/sys/bus/w1/devices# ls |
10-000802f41d67 w1_bus_master1 | 10-000802f41d67 w1_bus_master1 | ||
- | root@odroid:/sys/bus/w1/devices#</code> | + | odroid@odroid64:/sys/bus/w1/devices#</code> |
- | As you can see my sensor is detected as **10-000802f41d67**, each sensor has a different id. So yours will be different. | + | As you can see my sensor is detected as **10-000802f38c57**, each sensor has a different id. So yours will be different. |
- | * Read the temperature:<code>root@odroid:/sys/bus/w1/devices# cd 10-000802f41d67 | + | * Read the temperature: |
- | root@odroid:/sys/bus/w1/devices/10-000802f41d67# cat w1_slave | + | <code> |
+ | odroid@odroid64:/sys/bus/w1/devices$ cd 10-000802f38c57 | ||
+ | odroid@odroid64:/sys/bus/w1/devices/10-000802f38c57# cat w1_slave | ||
33 00 4b 46 ff ff 03 10 30 : crc=30 YES | 33 00 4b 46 ff ff 03 10 30 : crc=30 YES | ||
33 00 4b 46 ff ff 03 10 30 t=25562 | 33 00 4b 46 ff ff 03 10 30 t=25562 | ||
- | root@odroid:/sys/bus/w1/devices/10-000802f41d67# | + | odroid@odroid64:/sys/bus/w1/devices/10-000802f38c57# |
</code> | </code> | ||
Line 52: | Line 54: | ||
<code> | <code> | ||
- | root@bigsmall:/sys/bus/w1/devices# ls | + | odroid@odroid64:/sys/bus/w1/devices# ls |
- | 10-000802f37119 10-000802f41d67 w1_bus_master1 | + | 10-000802f38c57 10-000802f41d67 w1_bus_master1 |
</code> | </code> | ||
Two sensors in parallel. | Two sensors in parallel. | ||
- | **Change the Default GPIO pin for 1-Wire interface** \\ | + | ===== Change the Default GPIO pin for 1-Wire interface ===== |
- | Ex) Default GPIO pin change to GPIOX_19(GPIO111) | + | Ex) Default GPIO pin change to GPIOX.BIT19 \\ |
+ | Please refer to below links for details related to gpio mapping in the device-tree.\\ | ||
+ | [[https://github.com/hardkernel/linux/blob/odroidc2-3.14.y/include/dt-bindings/gpio/gxbb.h | C2 gpio mapping in the device-tree]] \\ | ||
<code> | <code> | ||
odroid@odroid64:~$ sudo apt-get install device-tree-compiler | odroid@odroid64:~$ sudo apt-get install device-tree-compiler | ||
odroid@odroid64:~$ fdtget /media/boot/meson64_odroidc2.dtb /onewire gpios | odroid@odroid64:~$ fdtget /media/boot/meson64_odroidc2.dtb /onewire gpios | ||
- | 31 113 0 | + | 18 113 0 |
- | odroid@odroid64:~$ fdtput /media/boot/meson64_odroidc2.dtb /onewire gpios 31 111 0 | + | odroid@odroid64:~$ fdtput /media/boot/meson64_odroidc2.dtb /onewire gpios 18 111 0 |
odroid@odroid64:~$ fdtget /media/boot/meson64_odroidc2.dtb /onewire gpios | odroid@odroid64:~$ fdtget /media/boot/meson64_odroidc2.dtb /onewire gpios | ||
- | 31 111 0 | + | 18 111 0 |
odroid@odroid64:~$ sudo reboot | odroid@odroid64:~$ sudo reboot | ||
</code> | </code> | ||
+ | If the reboot doesn't affect the dtb update, you need a hard reset(power off/on).\\ | ||
- | DS1820 change to connection Pin #11 | + | **Don't change the first number in the fdtget command output. 18(0x12) is the GPIO group number.** |
+ | |||
+ | DS1820 is connected to Pin #11 | ||
Pin 1 (Left): Ground (-) | Pin 1 (Left): Ground (-) | ||
- | Pin 2 (Middle): Pin #11 C2 (GPIOX_19, GPIO111) | + | Pin 2 (Middle): Pin #11 C2 (GPIOX.BIT19) |
Pin 3 (Right): Ground (-) | Pin 3 (Right): Ground (-) | ||
- | |||