← Documents Documentation/spi/spi-lm70llp.rst GitHub 원문 ↗

Linux 6.18.37 · SPI

spi_lm70llp LM70-LLP 병렬 포트-SPI 어댑터

LM70 LLP 평가 보드를 병렬 포트 기반 SPI master로 연결하는 배선, 3-wire SI/O, Mode 0 bitbang과 Q1 회로 때문에 MISO를 반전하는 이유를 설명합니다.

Source pathDocumentation/spi/spi-lm70llp.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

spi-lm70llp.rst:1-84

LM70 LLP 평가 보드를 병렬 포트 기반 SPI master로 연결하는 배선, 3-wire SI/O, Mode 0 bitbang과 Q1 회로 때문에 MISO를 반전하는 이유를 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ==============================================
2 spi_lm70llp : LM70-LLP parport-to-SPI adapter
3 ==============================================
4
5 Supported board/chip:
6
7 * National Semiconductor LM70 LLP evaluation board
8
9 Datasheet: https://www.ti.com/lit/gpn/lm70
10
11 Author:
12 Kaiwan N Billimoria <kaiwan@designergraphix.com>
13
14 Description
15 -----------
16 This driver provides glue code connecting a National Semiconductor LM70 LLP
17 temperature sensor evaluation board to the kernel's SPI core subsystem.
18
19 This is a SPI master controller driver. It can be used in conjunction with
20 (layered under) the LM70 logical driver (a "SPI protocol driver").
21 In effect, this driver turns the parallel port interface on the eval board
22 into a SPI bus with a single device, which will be driven by the generic
23 LM70 driver (drivers/hwmon/lm70.c).
24
25
26 Hardware Interfacing
27 --------------------
28 The schematic for this particular board (the LM70EVAL-LLP) is
29 available (on page 4) here:
30
31 https://download.datasheets.com/pdfs/documentation/nat/kit&board/lm70llpevalmanual.pdf
32
33 The hardware interfacing on the LM70 LLP eval board is as follows:
34
35 ======== == ========= ==========
36 Parallel LM70 LLP
37 Port . Direction JP2 Header
38 ======== == ========= ==========
39 D0 2 - -
40 D1 3 --> V+ 5
41 D2 4 --> V+ 5
42 D3 5 --> V+ 5
43 D4 6 --> V+ 5
44 D5 7 --> nCS 8
45 D6 8 --> SCLK 3
46 D7 9 --> SI/O 5
47 GND 25 - GND 7
48 Select 13 <-- SI/O 1
49 ======== == ========= ==========
50
51 Note that since the LM70 uses a "3-wire" variant of SPI, the SI/SO pin
52 is connected to both pin D7 (as Master Out) and Select (as Master In)
53 using an arrangement that lets either the parport or the LM70 pull the
54 pin low. This can't be shared with true SPI devices, but other 3-wire
55 devices might share the same SI/SO pin.
56
57 The bitbanger routine in this driver (lm70_txrx) is called back from
58 the bound "hwmon/lm70" protocol driver through its sysfs hook, using a
59 spi_write_then_read() call. It performs Mode 0 (SPI/Microwire) bitbanging.
60 The lm70 driver then interprets the resulting digital temperature value
61 and exports it through sysfs.
62
63 A "gotcha": National Semiconductor's LM70 LLP eval board circuit schematic
64 shows that the SI/O line from the LM70 chip is connected to the base of a
65 transistor Q1 (and also a pullup, and a zener diode to D7); while the
66 collector is tied to VCC.
67
68 Interpreting this circuit, when the LM70 SI/O line is High (or tristate
69 and not grounded by the host via D7), the transistor conducts and switches
70 the collector to zero, which is reflected on pin 13 of the DB25 parport
71 connector. When SI/O is Low (driven by the LM70 or the host) on the other
72 hand, the transistor is cut off and the voltage tied to its collector is
73 reflected on pin 13 as a High level.
74
75 So: the getmiso inline routine in this driver takes this fact into account,
76 inverting the value read at pin 13.
77
78
79 Thanks to
80 ---------
81
82 - David Brownell for mentoring the SPI-side driver development.
83 - Dr.Craig Hollabaugh for the (early) "manual" bitbanging driver version.
84 - Nadir Billimoria for help interpreting the circuit schematic.
85

3. 한국어 전문 번역

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

지원 보드와 드라이버 역할

1-23

`spi_lm70llp`는 National Semiconductor LM70 LLP evaluation board를 지원한다. 데이터시트 주소와 저자 Kaiwan N Billimoria의 정보는 원문에 제시되어 있다.

드라이버는 LM70 LLP temperature sensor evaluation board를 커널 SPI core subsystem에 연결하는 glue code를 제공한다. SPI master controller driver이며, 위 계층의 LM70 logical driver인 SPI protocol driver와 함께 사용한다.

결과적으로 evaluation board의 parallel port interface가 장치 하나를 가진 SPI bus가 되고, 일반 LM70 driver `drivers/hwmon/lm70.c`가 그 장치를 구동한다.

LM70 드라이버 계층
LM70 LLP parport hardwarespi_lm70llp master controllerSPI coredrivers/hwmon/lm70.c protocol driversysfs temperature

병렬 포트 controller와 hwmon protocol driver가 SPI core를 사이에 두고 결합한다.

==============================================
spi_lm70llp :  LM70-LLP parport-to-SPI adapter
==============================================

Supported board/chip:

  * National Semiconductor LM70 LLP evaluation board

    Datasheet: https://www.ti.com/lit/gpn/lm70

Author:
        Kaiwan N Billimoria <kaiwan@designergraphix.com>

Description
-----------
This driver provides glue code connecting a National Semiconductor LM70 LLP
temperature sensor evaluation board to the kernel's SPI core subsystem.

This is a SPI master controller driver. It can be used in conjunction with
(layered under) the LM70 logical driver (a "SPI protocol driver").
In effect, this driver turns the parallel port interface on the eval board
into a SPI bus with a single device, which will be driven by the generic
LM70 driver (drivers/hwmon/lm70.c).

LM70EVAL-LLP 하드웨어 배선

24-53

LM70EVAL-LLP 회로도는 원문 링크 문서의 4쪽에 있다. 평가 보드의 병렬 포트와 JP2 header 사이 배선은 다음과 같다.

LM70 LLP 병렬 포트 배선
Parallel PortPinDirectionLM70 LLP JP2
D02--
D13-->V+ 5
D24-->V+ 5
D35-->V+ 5
D46-->V+ 5
D57-->nCS 8
D68-->SCLK 3
D79-->SI/O 5
GND25-GND 7
Select13<--SI/O 1

포트 핀, 방향, JP2 신호를 원문 표대로 보존한다.

LM70은 3-wire SPI 변형을 사용하므로 SI/SO pin이 master output인 D7과 master input인 Select 양쪽에 연결된다. 병렬 포트나 LM70 어느 쪽이든 이 pin을 low로 끌어내릴 수 있는 배치다. 진정한 4-wire SPI 장치와는 공유할 수 없지만 다른 3-wire 장치는 같은 SI/SO pin을 공유할 수 있다.

3-wire SI/O 공유
Parport D7 master outShared LM70 SI/O
Shared LM70 SI/OParport Select pin 13 master in

하나의 양방향 신호를 master output과 input 경로에 동시에 연결한다.



Hardware Interfacing
--------------------
The schematic for this particular board (the LM70EVAL-LLP) is
available (on page 4) here:

  https://download.datasheets.com/pdfs/documentation/nat/kit&board/lm70llpevalmanual.pdf

The hardware interfacing on the LM70 LLP eval board is as follows:

   ======== == =========   ==========
   Parallel                 LM70 LLP
     Port   .  Direction   JP2 Header
   ======== == =========   ==========
      D0     2      -         -
      D1     3     -->      V+   5
      D2     4     -->      V+   5
      D3     5     -->      V+   5
      D4     6     -->      V+   5
      D5     7     -->      nCS  8
      D6     8     -->      SCLK 3
      D7     9     -->      SI/O 5
     GND    25      -       GND  7
    Select  13     <--      SI/O 1
   ======== == =========   ==========

Note that since the LM70 uses a "3-wire" variant of SPI, the SI/SO pin
is connected to both pin D7 (as Master Out) and Select (as Master In)
using an arrangement that lets either the parport or the LM70 pull the

bitbang 전송과 반전된 MISO

54-84

드라이버의 bitbanger routine `lm70_txrx`는 bind된 `hwmon/lm70` protocol driver가 sysfs hook에서 `spi_write_then_read()`를 호출할 때 callback된다. Mode 0(SPI/Microwire) bitbanging을 수행하고, LM70 driver가 결과 digital temperature 값을 해석해 sysfs로 내보낸다.

온도 읽기
sysfs readhwmon/lm70spi_write_then_readlm70_txrx Mode 0 bitbangLM70 digital valuesysfs temperature

sysfs 요청이 protocol driver와 bitbang controller를 거쳐 센서 값으로 돌아온다.

주의할 회로 특성이 있다. LM70 chip의 SI/O line은 transistor Q1의 base에 연결되고 pullup 및 D7로 향하는 zener diode에도 연결되며, collector는 VCC에 묶여 있다.

SI/O가 High이거나 tristate이고 host가 D7을 통해 ground로 내리지 않으면 transistor가 도통해 collector를 0으로 전환하며, 이 값이 DB25 pin 13에 반영된다. 반대로 SI/O가 LM70 또는 host에 의해 Low로 구동되면 transistor가 차단되고 collector의 전압이 pin 13에 High로 나타난다.

따라서 드라이버의 `getmiso` inline routine은 pin 13에서 읽은 값을 반전한다.

SI/O와 pin 13의 반전 관계
LM70 SI/OQ1DB25 pin 13getmiso 처리
High 또는 tristate도통Low반전해 High
Low차단High반전해 Low

Q1 회로 때문에 센서 신호와 병렬 포트 입력 논리가 반대가 된다.

문서는 SPI 쪽 드라이버 개발을 지도한 David Brownell, 초기 수동 bitbang driver를 만든 Dr. Craig Hollabaugh, 회로도 해석을 도운 Nadir Billimoria에게 감사를 전한다.

pin low.  This can't be shared with true SPI devices, but other 3-wire
devices might share the same SI/SO pin.

The bitbanger routine in this driver (lm70_txrx) is called back from
the bound "hwmon/lm70" protocol driver through its sysfs hook, using a
spi_write_then_read() call.  It performs Mode 0 (SPI/Microwire) bitbanging.
The lm70 driver then interprets the resulting digital temperature value
and exports it through sysfs.

A "gotcha": National Semiconductor's LM70 LLP eval board circuit schematic
shows that the SI/O line from the LM70 chip is connected to the base of a
transistor Q1 (and also a pullup, and a zener diode to D7); while the
collector is tied to VCC.

Interpreting this circuit, when the LM70 SI/O line is High (or tristate
and not grounded by the host via D7), the transistor conducts and switches
the collector to zero, which is reflected on pin 13 of the DB25 parport
connector.  When SI/O is Low (driven by the LM70 or the host) on the other
hand, the transistor is cut off and the voltage tied to its collector is
reflected on pin 13 as a High level.

So: the getmiso inline routine in this driver takes this fact into account,
inverting the value read at pin 13.


Thanks to
---------

- David Brownell for mentoring the SPI-side driver development.
- Dr.Craig Hollabaugh for the (early) "manual" bitbanging driver version.
- Nadir Billimoria for help interpreting the circuit schematic.