← Documents Documentation/ABI/testing/sysfs-bus-iio-timer-stm32 GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

STM32 IIO timer master and counter modes

STM32 timer의 TRGO/TRGO2 master mode, compare 신호 경로, counter preset·enable·trigger mode를 도식과 함께 설명합니다.

Source pathDocumentation/ABI/testing/sysfs-bus-iio-timer-stm32
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

TRGO and TRGO2 selection

sysfs-bus-iio-timer-stm32:1-92

Master mode는 reset·enable·update·compare pulse·OCxREF 중 하나를 TRGO로 선택합니다. TRGO2는 OC4REF..OC6REF 에지 조합까지 지원하며 현재 모드는 master_mode에서 읽고 씁니다.

Up/down event boundary

sysfs-bus-iio-timer-stm32:93-103

Up-counting은 0에서 preset까지, down-counting은 preset에서 0까지 진행한 뒤 이벤트를 발생시킵니다.

Always, gated, and triggered

sysfs-bus-iio-timer-stm32:104-129

Enable mode는 항상 실행, trigger high 동안 gated 실행, 상승 에지 뒤 지속 실행을 선택하며 내부 클록으로 count합니다.

Trigger-clocked counting

sysfs-bus-iio-timer-stm32:130-143

Trigger mode에서는 연결된 trigger의 상승 에지가 counter clock이 되고 방향은 count_direction 속성이 정합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 What: /sys/bus/iio/devices/triggerX/master_mode_available
2 KernelVersion: 4.11
4 Description:
5 Reading returns the list possible master modes which are:
6
7
8 - "reset"
9 The UG bit from the TIMx_EGR register is
10 used as trigger output (TRGO).
11 - "enable"
12 The Counter Enable signal CNT_EN is used
13 as trigger output.
14 - "update"
15 The update event is selected as trigger output.
16 For instance a master timer can then be used
17 as a prescaler for a slave timer.
18 - "compare_pulse"
19 The trigger output send a positive pulse
20 when the CC1IF flag is to be set.
21 - "OC1REF"
22 OC1REF signal is used as trigger output.
23 - "OC2REF"
24 OC2REF signal is used as trigger output.
25 - "OC3REF"
26 OC3REF signal is used as trigger output.
27 - "OC4REF"
28 OC4REF signal is used as trigger output.
29
30 Additional modes (on TRGO2 only):
31
32 - "OC5REF"
33 OC5REF signal is used as trigger output.
34 - "OC6REF"
35 OC6REF signal is used as trigger output.
36 - "compare_pulse_OC4REF":
37 OC4REF rising or falling edges generate pulses.
38 - "compare_pulse_OC6REF":
39 OC6REF rising or falling edges generate pulses.
40 - "compare_pulse_OC4REF_r_or_OC6REF_r":
41 OC4REF or OC6REF rising edges generate pulses.
42 - "compare_pulse_OC4REF_r_or_OC6REF_f":
43 OC4REF rising or OC6REF falling edges generate
44 pulses.
45 - "compare_pulse_OC5REF_r_or_OC6REF_r":
46 OC5REF or OC6REF rising edges generate pulses.
47 - "compare_pulse_OC5REF_r_or_OC6REF_f":
48 OC5REF rising or OC6REF falling edges generate
49 pulses.
50
51 ::
52
53 +-----------+ +-------------+ +---------+
54 | Prescaler +-> | Counter | +-> | Master | TRGO(2)
55 +-----------+ +--+--------+-+ |-> | Control +-->
56 | | || +---------+
57 +--v--------+-+ OCxREF || +---------+
58 | Chx compare +----------> | Output | ChX
59 +-----------+-+ | | Control +-->
60 . | | +---------+
61 . | | .
62 +-----------v-+ OC6REF | .
63 | Ch6 compare +---------+>
64 +-------------+
65
66 Example with: "compare_pulse_OC4REF_r_or_OC6REF_r"::
67
68 X
69 X X
70 X . . X
71 X . . X
72 X . . X
73 count X . . . . X
74 . . . .
75 . . . .
76 +---------------+
77 OC4REF | . . |
78 +-+ . . +-+
79 . +---+ .
80 OC6REF . | | .
81 +-------+ +-------+
82 +-+ +-+
83 TRGO2 | | | |
84 +-+ +---+ +---------+
85
86 What: /sys/bus/iio/devices/triggerX/master_mode
87 KernelVersion: 4.11
89 Description:
90 Reading returns the current master modes.
91 Writing set the master mode
92
93 What: /sys/bus/iio/devices/iio:deviceX/in_count0_preset
94 KernelVersion: 4.12
96 Description:
97 Reading returns the current preset value.
98 Writing sets the preset value.
99 When counting up the counter starts from 0 and fires an
100 event when reach preset value.
101 When counting down the counter start from preset value
102 and fire event when reach 0.
103
104 What: /sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
105 KernelVersion: 4.12
107 Description:
108 Reading returns the list possible enable modes.
109
110 What: /sys/bus/iio/devices/iio:deviceX/in_count0_enable_mode
111 KernelVersion: 4.12
113 Description:
114 Configure the device counter enable modes, in all case
115 counting direction is set by in_count0_count_direction
116 attribute and the counter is clocked by the internal clock.
117
118 always:
119 Counter is always ON.
120
121 gated:
122 Counting is enabled when connected trigger signal
123 level is high else counting is disabled.
124
125 triggered:
126 Counting is enabled on rising edge of the connected
127 trigger, and remains enabled for the duration of this
128 selected mode.
129
130 What: /sys/bus/iio/devices/iio:deviceX/in_count_trigger_mode_available
131 KernelVersion: 4.13
133 Description:
134 Reading returns the list possible trigger modes.
135
136 What: /sys/bus/iio/devices/iio:deviceX/in_count0_trigger_mode
137 KernelVersion: 4.13
139 Description:
140 Configure the device counter trigger mode
141 counting direction is set by in_count0_count_direction
142 attribute and the counter is clocked by the connected trigger
143 rising edges.
144

3. 한국어 전문 번역

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

사용 가능한 timer master mode

1-85
항목한국어 전문 번역
What/sys/bus/iio/devices/triggerX/master_mode_available
KernelVersion4.11
Contact[email protected]
Description읽으면 사용할 수 있는 master mode 목록을 반환합니다.
기본 모드TRGO 동작
resetTIMx_EGR 레지스터의 UG bit를 trigger output(TRGO)으로 사용합니다.
enableCounter Enable 신호 CNT_EN을 trigger output으로 사용합니다.
updateupdate event를 trigger output으로 선택합니다. 예를 들어 master timer를 slave timer의 prescaler로 사용할 수 있습니다.
compare_pulseCC1IF flag가 설정될 때 trigger output이 양의 pulse를 보냅니다.
OC1REFOC1REF 신호를 trigger output으로 사용합니다.
OC2REFOC2REF 신호를 trigger output으로 사용합니다.
OC3REFOC3REF 신호를 trigger output으로 사용합니다.
OC4REFOC4REF 신호를 trigger output으로 사용합니다.
TRGO2 전용 추가 모드동작
OC5REFOC5REF 신호를 trigger output으로 사용합니다.
OC6REFOC6REF 신호를 trigger output으로 사용합니다.
compare_pulse_OC4REFOC4REF의 상승 또는 하강 에지가 pulse를 생성합니다.
compare_pulse_OC6REFOC6REF의 상승 또는 하강 에지가 pulse를 생성합니다.
compare_pulse_OC4REF_r_or_OC6REF_rOC4REF 또는 OC6REF의 상승 에지가 pulse를 생성합니다.
compare_pulse_OC4REF_r_or_OC6REF_fOC4REF 상승 에지 또는 OC6REF 하강 에지가 pulse를 생성합니다.
compare_pulse_OC5REF_r_or_OC6REF_rOC5REF 또는 OC6REF의 상승 에지가 pulse를 생성합니다.
compare_pulse_OC5REF_r_or_OC6REF_fOC5REF 상승 에지 또는 OC6REF 하강 에지가 pulse를 생성합니다.
STM32 timer trigger and channel output paths
PrescalerCounterChx compareOCxREFMaster ControlTRGO(2)
CounterChx compareOutput ControlChX
CounterCh6 compareOC6REFMaster Control

Prescaler가 Counter를 구동하고 각 compare 채널이 OCxREF를 만듭니다. OCxREF는 Master Control을 거쳐 TRGO/TRGO2가 되거나 Output Control을 거쳐 채널 출력 ChX가 됩니다.

TRGO2 pulses from OC4REF and OC6REF rising edges
count
riserisepeakfallfalllowlowlow
counter가 상승 후 하강합니다.
OC4REF
highhighhighhighhighhigh
첫 번째 상승 에지가 TRGO2 pulse를 생성합니다.
OC6REF
highhigh
두 번째 상승 에지가 TRGO2 pulse를 생성합니다.
TRGO2
pulsepulse
OC4REF 또는 OC6REF 상승 에지마다 짧은 pulse가 발생합니다.
time
compare_pulse_OC4REF_r_or_OC6REF_r

예제 모드에서는 OC4REF와 OC6REF 각각의 상승 에지가 TRGO2에 양의 pulse를 하나씩 생성합니다.

현재 timer master mode

86-92
항목한국어 전문 번역
What/sys/bus/iio/devices/triggerX/master_mode
KernelVersion4.11
Contact[email protected]
Description읽으면 현재 master mode를 반환합니다. 쓰면 master mode를 설정합니다.

Counter preset과 이벤트 시점

93-103
항목한국어 전문 번역
What/sys/bus/iio/devices/iio:deviceX/in_count0_preset
KernelVersion4.12
Contact[email protected]
Description읽으면 현재 preset 값을 반환하고 쓰면 preset 값을 설정합니다. Up-counting에서는 counter가 0에서 시작해 preset 값에 도달할 때 이벤트를 발생시킵니다. Down-counting에서는 preset 값에서 시작해 0에 도달할 때 이벤트를 발생시킵니다.

사용 가능한 counter enable mode

104-109
항목한국어 전문 번역
What/sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
KernelVersion4.12
Contact[email protected]
Description읽으면 사용할 수 있는 enable mode 목록을 반환합니다.

Counter enable mode 설정

110-129
항목한국어 전문 번역
What/sys/bus/iio/devices/iio:deviceX/in_count0_enable_mode
KernelVersion4.12
Contact[email protected]
Description장치 counter의 enable mode를 구성합니다. 모든 경우 counting 방향은 in_count0_count_direction 속성으로 설정하며 counter는 내부 클록으로 구동됩니다.
모드동작
alwaysCounter가 항상 ON입니다.
gated연결한 trigger 신호 레벨이 high일 때 counting을 활성화하고, 그 외에는 비활성화합니다.
triggered연결한 trigger의 상승 에지에서 counting을 활성화하고 이 모드를 선택한 동안 계속 활성 상태를 유지합니다.

사용 가능한 counter trigger mode

130-135
항목한국어 전문 번역
What/sys/bus/iio/devices/iio:deviceX/in_count_trigger_mode_available
KernelVersion4.13
Contact[email protected]
Description읽으면 사용할 수 있는 trigger mode 목록을 반환합니다.

Counter trigger mode 설정

136-143
항목한국어 전문 번역
What/sys/bus/iio/devices/iio:deviceX/in_count0_trigger_mode
KernelVersion4.13
Contact[email protected]
Description장치 counter의 trigger mode를 구성합니다. Counting 방향은 in_count0_count_direction 속성으로 설정하며, counter는 연결된 trigger의 상승 에지로 클록됩니다.