This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
products:sbc:common:applications:gpio:1wire [2022/06/29 23:02] 127.0.0.1 external edit |
products:sbc:common:applications:gpio:1wire [2023/11/07 04:59] (current) nick old revision restored (2023/11/07 04:42) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | # 1Wire | + | ====== 1-Wire ====== |
- | Common part. | + | ===== Introduction ===== |
+ | This page introduces the usage of 1-Wire bus on [[products: | ||
- | <tabbox VIM1> | + | ===== 1-Wire Information ===== |
- | VIM1 | + | You can find the default PIN used for '' |
+ | | | ||
+ | ^ VIM1/ | ||
+ | ^ VIM3/ | ||
+ | ^ VIM4 | ||
+ | ^ VIM1S | 36 | ||
+ | ^ Edge1 | 30 | ||
+ | | | ||
- | **asdasd** | + | ===== Enable 1-Wire Bus ===== |
- | < | + | |
- | VIM2 | + | In order to use the 1-Wire, you need to enable the '' |
- | <tabbox VIM3> | + | |
- | VIM3 | + | < |
- | <tabbox VIM3L> | + | |
- | VIM3L | + | Edit ''/ |
- | <tabbox VIM4> | + | |
- | VIM4 | + | Take VIM3 as an example to enable '' |
+ | |||
+ | ```shell | ||
+ | overlays=onewire | ||
+ | ``` | ||
+ | <tabbox VIM3 with 5.15 kernel> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | e.g. To enable onewire, you need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=onewire | ||
+ | |||
+ | ``` | ||
+ | |||
+ | <tabbox VIM3L with 5.15 kernel> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | e.g. To enable onewire, you need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=onewire | ||
+ | |||
+ | ``` | ||
+ | |||
+ | <tabbox VIM4> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | e.g. To enable onewire, you need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=onewire | ||
+ | |||
+ | ``` | ||
+ | <tabbox VIM1S> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | e.g. To enable onewire, you need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=onewire | ||
+ | |||
+ | ``` | ||
</ | </ | ||
+ | |||
+ | <WRAP tip > | ||
+ | Reboot the system for this change to take effect. | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Get Sensor Data ===== | ||
+ | |||
+ | Here we attach a 1-Wire device '' | ||
+ | |||
+ | Enter the driver directory: | ||
+ | ```shell | ||
+ | khadas@Khadas: | ||
+ | khadas@Khadas:/ | ||
+ | 28-0119395ebf91 | ||
+ | ``` | ||
+ | |||
+ | You can see the node of '' | ||
+ | ```shell | ||
+ | khadas@Khadas:/ | ||
+ | khadas@Khadas:/ | ||
+ | driver | ||
+ | ``` | ||
+ | |||
+ | Read '' | ||
+ | ```shell | ||
+ | khadas@Khadas:/ | ||
+ | b1 01 4b 46 7f ff 0c 10 d8 : crc=d8 YES | ||
+ | b1 01 4b 46 7f ff 0c 10 d8 t=27062 | ||
+ | ``` | ||
+ | |||
+ | |||
+ | ===== Disable 1-Wire to Use GPIO ===== | ||
+ | |||
+ | If you want to use normal GPIO instead of 1-Wire, you can remove the 1-Wire node in [[products: |