Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:1wire

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:common:applications:gpio:1wire [2022/07/12 23:20]
nick
products:sbc:common:applications:gpio:1wire [2023/11/07 04:59] (current)
nick old revision restored (2023/11/07 04:42)
Line 3: Line 3:
 ===== Introduction ===== ===== Introduction =====
  
-This document mainly introduces the usage of 1-Wire bus on [[products:sbc:common:applications:gpio:40pin-header|40-Pin Header]].+This page introduces the usage of 1-Wire bus on [[products:sbc:common:applications:gpio:40pin-header|40-Pin Header]].
  
 ===== 1-Wire Information ===== ===== 1-Wire Information =====
  
-|            I2C    ^  PIN & GPIO(#number)                                        DT Overlays Node  ^  Bus Number  ^  Device Node  ^ +You can find the default PIN used for ''1-Wire'' bus from the table below.
-^  VIM1/  | I2C A    SCL(22) - GPIODV_25 (#474)\\ SDA (23) - GPIODV_24 (#473)  |  i2c0              |  0            /dev/i2c-0   | +
-^  :::      | I2C B    SCL(25) - GPIODV_27 (#476)\\ SDA(26) - GPIODV_26 (#475)    -                 |            |  /dev/i2c-1   | +
-^  VIM3/3L  | I2CM 3  |  SCL(22) - GPIOA_15 (#475)\\ SDA(23) - GPIOA_14 (#474)      i2c3              |  3            /dev/i2c-3   | +
-^  :::      | I2C AO  |  SCL(25) - GPIOAO_2 (#498)\\ SDA(26) - GPIOAO_3 (#499)      -                  4            /dev/i2c-4   | +
-^  VIM4     | I2CM F  |  SCL(22) - GPIOY_17 (#501)\\ SDA (23) - GPIOY_18 (#502)    |  i2cm_f            |  5            /dev/i2c-5   | +
-^  :::      | I2CM A  |  SCL(25) - GPIOT_20 (#466)\\ SDA(26) - GPIOT_21 (#467)      i2cm_a            |  0            /dev/i2c-0   | +
  
 +|            PIN  ^  GPIO Name  ^  DT Overlays Node  ^  Device Node          ^
 +^  VIM1/   37    GPIOH_5    |  onewire            /sys/bus/w1/devices  |
 +^  VIM3/3L  |  15    GPIOH_6    | :::                | :::                   |
 +^  VIM4      37    GPIOT_19   | :::                | :::                   |
 +^  VIM1S    |  36    GPIOZ_8    | :::                | :::                   |
 +^  Edge1    |  30    GPIO4_A0   | :::                | :::                   |
 +|                             | :::                | :::                   |
  
 ===== Enable 1-Wire Bus ===== ===== Enable 1-Wire Bus =====
  
-You can enable 1-Wire bus via [[products:sbc:common:configurations:device-tree-overlay|Device Tree Overlay]].+In order to use the 1-Wire, you need to enable the ''1-Wire'' function via [[products:sbc:common:configurations:device-tree-overlay|Device Tree Overlay]].
  
 <tabbox VIM1/2/3/3L/Edge1> <tabbox VIM1/2/3/3L/Edge1>
  
-Edit ''/boot/env.txt'' to add ''onewire'' to ''overlays'' node.+Edit ''/boot/env.txt'' to add the onewire node to ''overlays'' node if it doesn't exist. 
 + 
 +Take VIM3 as an example to enable ''1-Wire'', you need to add ''onewire'' node to ''overlays'' node if it doesn't exist.
  
-e.g. 
 ```shell ```shell
-overlays=uart4 pwm_ao_a pwm_f i2c0 onewire+overlays=onewire
 ``` ```
 +<tabbox VIM3 with 5.15 kernel>
 +
 +Edit ''/boot/dtb/amlogic/kvim3.dtb.overlay.env'' to add onewire node to ''fdt_overlays'' node if it doesn't exist.
 +
 +
 +e.g. To enable onewire, you need to add ''onewire'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=onewire
 +
 +```
 +
 +<tabbox VIM3L with 5.15 kernel>
 +
 +Edit ''/boot/dtb/amlogic/kvim3l.dtb.overlay.env'' to add onewire node to ''fdt_overlays'' node if it doesn't exist.
 +
 +
 +e.g. To enable onewire, you need to add ''onewire'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=onewire
 +
 +```
 +
 <tabbox VIM4> <tabbox VIM4>
  
-Edit ''/boot/dtb/amlogic/kvim4.dtb.overlay.env'' to add ''onewire'' to ''fdt_overlays'' node.+Edit ''/boot/dtb/amlogic/kvim4.dtb.overlay.env'' to add onewire node to ''fdt_overlays'' node if it doesn't exist.
  
-e.g. + 
 +e.g. To enable onewire, you need to add ''onewire'' to node ''fdt_overlays'' if it doesn't exist.
  
 ```shell ```shell
Line 39: Line 65:
  
 ``` ```
 +<tabbox VIM1S>
  
 +Edit ''/boot/dtb/amlogic/kvim1s.dtb.overlay.env'' to add onewire node to ''fdt_overlays'' node if it doesn't exist.
 +
 +
 +e.g. To enable onewire, you need to add ''onewire'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=onewire
 +
 +```
 </tabbox> </tabbox>
  
 <WRAP tip > <WRAP tip >
-Reboot to effect.+Reboot the system for this change to take effect.
 </WRAP> </WRAP>
  
Line 72: Line 108:
 ``` ```
  
-Physical pins of 1-Wire bus: + 
-<tabbox VIM1/2>  +===== Disable 1-Wire to Use GPIO ===== 
-''GPIOH_5'' PIN37 + 
-<tabbox VIM3/3L>  +If you want to use normal GPIO instead of 1-Wire, you can remove the 1-Wire node in [[products:sbc:common:configurations:device-tree-overlay|Device Tree Overlay]]. 
-''GPIOH_6'' PIN15 +
-<tabbox VIM4>  +
-''GPIOT_19'' PIN37 +
-<tabbox Edge1> +
-''GPIO4_A0'' PIN30 +
-</tabbox>+
Last modified: 2022/07/12 23:20 by nick