This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:common:applications:gpio:1wire [2022/07/04 22:31] hyphop [VIM1] |
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 will explain how to use 1-Wire on Khadas SBC. You will learn how to turn it on and how to get sensor data through 1-Wire. | + | This page introduces the usage of 1-Wire |
| - | ===== Enable | + | ===== 1-Wire |
| - | Edit '' | + | You can find the default PIN used for '' |
| - | e.g. | + | | |
| - | ```sh | + | ^ VIM1/ |
| - | overlays=uart4 pwm_ao_a pwm_f i2c0 onewire | + | ^ VIM3/ |
| + | ^ VIM4 | ||
| + | ^ VIM1S | 36 | ||
| + | ^ Edge1 | 30 | ||
| + | | | ||
| + | |||
| + | ===== Enable 1-Wire Bus ===== | ||
| + | |||
| + | In order to use the 1-Wire, you need to enable the '' | ||
| + | |||
| + | <tabbox VIM1/ | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | Take VIM3 as an example to enable '' | ||
| + | |||
| + | ```shell | ||
| + | overlays=onewire | ||
| ``` | ``` | ||
| - | Reboot | + | <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 | ||
| + | |||
| + | ``` | ||
| + | </ | ||
| - | < | + | < |
| - | For details on overlays, please refer to [[products: | + | Reboot the system for this change |
| </ | </ | ||
| - | ===== Get sensor data ===== | + | |
| + | ===== Get Sensor Data ===== | ||
| Here we attach a 1-Wire device '' | Here we attach a 1-Wire device '' | ||
| - | * Enter the driver directory: | + | Enter the driver directory: |
| - | ```sh | + | ```shell |
| khadas@Khadas: | khadas@Khadas: | ||
| khadas@Khadas:/ | khadas@Khadas:/ | ||
| Line 30: | Line 94: | ||
| ``` | ``` | ||
| - | * You can see the node of '' | + | You can see the node of '' |
| - | ```sh | + | ```shell |
| khadas@Khadas:/ | khadas@Khadas:/ | ||
| khadas@Khadas:/ | khadas@Khadas:/ | ||
| Line 37: | Line 101: | ||
| ``` | ``` | ||
| - | * Read '' | + | Read '' |
| - | ```sh | + | ```shell |
| khadas@Khadas:/ | khadas@Khadas:/ | ||
| b1 01 4b 46 7f ff 0c 10 d8 : crc=d8 YES | b1 01 4b 46 7f ff 0c 10 d8 : crc=d8 YES | ||
| Line 44: | Line 108: | ||
| ``` | ``` | ||
| - | * Physical pins of 1-Wire bus: | ||
| - | <tabbox VIM1> | ||
| - | ## asd | ||
| - | ==== asasd ==== | + | ===== 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: |
| - | <tabbox VIM2> | + | |
| - | '' | + | |
| - | <tabbox VIM3/3L> | + | |
| - | '' | + | |
| - | <tabbox Edge1> | + | |
| - | '' | + | |
| - | <tabbox VIM4> | + | |
| - | '' | + | |
| - | </ | + | |