← Documents Documentation/w1/masters/w1-uart.rst GitHub 원문 ↗

Linux 6.18.37 · 1-Wire / Master

Kernel driver w1-uart

UART baud·byte 조합으로 1-Wire reset과 bit timing을 만드는 방식을 설명합니다.

Source pathDocumentation/w1/masters/w1-uart.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

w1-uart.rst:1-54

UART baud·byte 조합으로 1-Wire reset과 bit timing을 만드는 방식을 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0-or-later
2
3 =====================
4 Kernel driver w1-uart
5 =====================
6
7 Author: Christoph Winklhofer <[email protected]>
8
9
10 Description
11 -----------
12
13 UART 1-Wire bus driver. The driver utilizes the UART interface via the
14 Serial Device Bus to create the 1-Wire timing patterns as described in
15 the document `"Using a UART to Implement a 1-Wire Bus Master"`_.
16
17 .. _"Using a UART to Implement a 1-Wire Bus Master": https://www.analog.com/en/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html
18
19 In short, the UART peripheral must support full-duplex and operate in
20 open-drain mode. The timing patterns are generated by a specific
21 combination of baud-rate and transmitted byte, which corresponds to a
22 1-Wire read bit, write bit or reset pulse.
23
24 For instance the timing pattern for a 1-Wire reset and presence detect uses
25 the baud-rate 9600, i.e. 104.2 us per bit. The transmitted byte 0xf0 over
26 UART (least significant bit first, start-bit low) sets the reset low time
27 for 1-Wire to 521 us. A present 1-Wire device changes the received byte by
28 pulling the line low, which is used by the driver to evaluate the result of
29 the 1-Wire operation.
30
31 Similar for a 1-Wire read bit or write bit, which uses the baud-rate
32 115200, i.e. 8.7 us per bit. The transmitted byte 0x80 is used for a
33 Write-0 operation (low time 69.6us) and the byte 0xff for Read-0, Read-1
34 and Write-1 (low time 8.7us).
35
36 The default baud-rate for reset and presence detection is 9600 and for
37 a 1-Wire read or write operation 115200. In case the actual baud-rate
38 is different from the requested one, the transmitted byte is adapted
39 to generate the 1-Wire timing patterns.
40
41
42 Usage
43 -----
44
45 Specify the UART 1-wire bus in the device tree by adding the single child
46 onewire to the serial node (e.g. uart0). For example:
47 ::
48
49 @uart0 {
50 ...
51 onewire {
52 compatible = "w1-uart";
53 };
54 };
55

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

UART timing 기반 1-Wire

1-20

`w1-uart`는 Serial Device Bus를 통해 UART interface를 사용해 1-Wire timing pattern을 만드는 bus driver이며 원 저자는 Christoph Winklhofer입니다.

동작 방식은 Analog Devices의 'Using a UART to Implement a 1-Wire Bus Master' 문서를 따릅니다.

UART peripheral은 full-duplex와 open-drain mode를 지원해야 합니다.

Baud rate와 transmitted byte 조합이 1-Wire read bit, write bit, reset pulse에 해당하는 timing pattern을 만듭니다.

UART 요구 조건
조건용도
Full-duplexTransmit byte와 received byte 비교
Open-drain1-Wire wired line
Selectable baudReset과 data slot timing
Serial Device BusUART child driver binding

1-Wire waveform을 만들기 위한 hardware 기능입니다.

.. SPDX-License-Identifier: GPL-2.0-or-later

=====================
Kernel driver w1-uart
=====================

Author: Christoph Winklhofer <[email protected]>


Description
-----------

UART 1-Wire bus driver. The driver utilizes the UART interface via the
Serial Device Bus to create the 1-Wire timing patterns as described in
the document `"Using a UART to Implement a 1-Wire Bus Master"`_.

.. _"Using a UART to Implement a 1-Wire Bus Master": https://www.analog.com/en/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html

In short, the UART peripheral must support full-duplex and operate in
open-drain mode. The timing patterns are generated by a specific

Reset·presence·bit timing

21-40

Reset과 presence detect는 9600 baud, 즉 bit당 104.2us를 사용합니다.

UART는 least-significant bit first이며 low start bit 뒤 `0xf0`을 보내 1-Wire reset low time 521us를 만듭니다.

1-Wire device가 존재하면 line을 low로 끌어 received byte를 바꾸고 driver는 이 차이로 presence를 판단합니다.

Read/write bit는 115200 baud, bit당 8.7us를 사용합니다.

`0x80`은 low time 69.6us의 Write-0, `0xff`는 low time 8.7us의 Read-0, Read-1, Write-1에 사용됩니다.

기본 baud는 reset/presence 9600, read/write 115200입니다. 실제 baud가 요청 값과 다르면 transmitted byte를 조정해 같은 1-Wire timing을 만듭니다.

UART-to-1-Wire timing
OperationBaudBit timeTX byteLow time
Reset/presence9600104.2us0xf0521us
Write-01152008.7us0x8069.6us
Read-0/Read-1/Write-11152008.7us0xff8.7us

Baud와 byte가 만드는 bus operation입니다.

Presence detect
UART를 9600 baud로 설정0xf0을 LSB-first로 송신Reset low pulse 521us 생성Slave가 presence 동안 line을 low로 당김수신 byte 변화로 존재 여부 판정

Transmit byte와 received byte 차이를 사용합니다.

combination of baud-rate and transmitted byte, which corresponds to a
1-Wire read bit, write bit or reset pulse.

For instance the timing pattern for a 1-Wire reset and presence detect uses
the baud-rate 9600, i.e. 104.2 us per bit. The transmitted byte 0xf0 over
UART (least significant bit first, start-bit low) sets the reset low time
for 1-Wire to 521 us. A present 1-Wire device changes the received byte by
pulling the line low, which is used by the driver to evaluate the result of
the 1-Wire operation.

Similar for a 1-Wire read bit or write bit, which uses the baud-rate
115200, i.e. 8.7 us per bit. The transmitted byte 0x80 is used for a
Write-0 operation (low time 69.6us) and the byte 0xff for Read-0, Read-1
and Write-1 (low time 8.7us).

The default baud-rate for reset and presence detection is 9600 and for
a 1-Wire read or write operation 115200. In case the actual baud-rate
is different from the requested one, the transmitted byte is adapted
to generate the 1-Wire timing patterns.

Device tree 사용

41-54

UART 1-Wire bus는 serial node, 예를 들어 `uart0` 아래에 단일 `onewire` child를 추가해 device tree에 지정합니다.

Child node의 `compatible`은 `w1-uart`입니다.

이 binding으로 Serial Device Bus가 UART controller와 1-Wire master driver를 연결합니다.

w1-uart DT
NodePropertyValue
uart0parentUART controller
onewirechild1-Wire bus
onewirecompatiblew1-uart

Serial node 아래 child 구성입니다.


Usage
-----

Specify the UART 1-wire bus in the device tree by adding the single child
onewire to the serial node (e.g. uart0). For example:
::

  @uart0 {
    ...
    onewire {
      compatible = "w1-uart";
    };
  };