summaryrefslogtreecommitdiff
path: root/ir/ir.tex
blob: da4ad8417e5d847e99d93fc8f9c39244971b1876 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
\documentclass[11pt]{article}
\usepackage{a4}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{footnote}
%\usepackage[hidelinks,bookmarks=true]{hyperref}
\usepackage[hidelinks,bookmarksnumbered=true]{hyperref}

\title{Neo900 Infrared Subsystem}
\author{J\"org Reisenweber%
\footnote{Concept and design requirements.}
%~\url{<joerg@openmoko.org>} \\
,
Werner Almesberger%
\footnote{Specification details and illustrations.}
%~\url{<werner@almesberger.net>}
}
\date{February xx, 2015}

\def\TODO{{\bf TO DO}}
\def\todo#1{\begin{center}{\bf TO DO:} #1\hfill~\end{center}}

\def\degree{\,^{\circ}}
\newenvironment{tab}{\vskip4mm\qquad\begin{minipage}{430pt}}%
{\end{minipage}\vskip4mm\noindent}

\begin{document}
\maketitle

\noindent
This document describes the infrared (IR) system of Neo900.
It is intended to be used both as tentative specification and as
documentation of actual functionality, and may be revised as
focus shifts over time from requirements to implementation.

% -----------------------------------------------------------------------------

\section{System overview}

The IR subsystem consists of a high-powered transmitter and a receiver.
It connects to UART3 of the DM3730 CPU, where hardware-assisted
IrDA\footnote{\url{http://en.wikipedia.org/wiki/Infrared_Data_Association}}
(SIR) and
CIR\footnote{\url{http://en.wikipedia.org/wiki/Consumer_IR}}
(``Consumer CIR'')
functions are available.

The IR subsystem also connects to the ``Hackerbus'' which can use the
signals to communicate with the CPU, be it as UART or as GPIOs, or to
access the IR system. For advanced
signal processing, the analog output of the IR sensor connects to an
unused input of the audio codec. The following drawing shows the various
components:

\begin{center}
\includegraphics[scale=0.9]{sys.pdf}
\end{center}
%
The signal named bq.GPIO determines the configuration after CPU reset but
may also be used in other system states. It is described in section
\ref{reset}.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{IR modes}
\label{modes}

The IR subsystem supports both CIR and
IrDA operation. In CIR mode, it can receive incoming
IR signals and thus act as a ``learning'' remote control.
Furthermore, the IR transceiver can be configured to send and receive
unmodulated data from the UART. We call this ``IR-UART'' mode

% CIR trumps IrDA
%
% Jul 07 23:03:38 <DocScrutinizer05> wpwrak: I'd be willing to sacrifice full
% IrDA compatibility by simply using a photo transistor plus "discrete" filter
% gear for RX, and only the CIR wavelength IR LED for TX

These characteristics mean that some design conflicts are unavoidable, e.g.,
because CIR and IrDA operate at different wavelengths. Where a conflict
arises, highest priority is given to CIR transmission, followed by CIR
reception, and finally IrDA.

Likewise, since the IR data path is shared between CPU and Hackerbus,
conflicting configurations are possible. Their resolution is described
in sections \ref{conflict} and \ref{undriven}.

Note that we don't consider IR-UART reception and IrDA to be very important
features. If their implementation should prove to be overly troublesome,
they could therefore be omitted.

% -----------------------------------------------------------------------------

\section{Physical layer}

The following sections describe the main characteristics of the physical
layers of CIR, IrDA, and IR-UART, and then define a set of hardware
characteristics that achieve compatibility with all these modes of operation.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{CIR}

While there is no common standard for CIR, the characteristics of most IR
remote controls typically lie in the following ranges%
\footnote{Based on the following Wikipedia article:
\url{http://en.wikipedia.org/w/index.php?title=Consumer_IR&oldid=615137350\#Technical_information}}%
,
with amplitude-shift keying (ASK) being the most common form of modulation,
although other types of modulation are possible:

\begin{tab}
\begin{tabular}{l|cll}
Parameter  & Value & Unit & \\
\hline
Wavelength	& 870, 930--950	& nm \\
Data rate	& 4--120	& bps \\
Carrier		& 33-60		& kHz \\
Beam angle	& $\ge 50$	& $\hbox to 0pt{}\degree$
			& (estimate for IR remote) \\
\end{tabular}
\end{tab}%

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{IrDA}

IrDA (SIR) uses a pulse modulation with UART-like framing and has the
following characteristics:\footnote{Based on the following Wikipedia
article:
\url{http://en.wikipedia.org/w/index.php?title=Infrared_Data_Association&oldid=615436526\#IrPHY}}

\begin{tab}
\begin{tabular}{l|cll}
Parameter  & Value & Unit \\
\hline
Wavelength	& 850--900	& nm \\

Data rate	& 9.6-115.2	& kbps \\
Duty cycle	& 3/16		& & ``0`` bit \\
		& 0/16		& & ``1`` bit \\
Pulse width	& 1.6--19.5	& $\mu$s \\
Beam angle	& $\ge 15$	& $\hbox to 0pt{}\degree$ \\
\end{tabular}
\end{tab}

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{IR-UART}

Last but not least, IR-UART mode uses on-off keying (OOK), and we can define
the following characteristics:

\begin{savenotes}
\begin{tab}
\begin{tabular}{l|cll}
Parameter  & Value & Unit \\
\hline
Data rate	& 9.6--115.2	& kbps (typical) \\
Duty cycle	& 9.1--91 	& \% &%
\footnote{The duty cycle range of 9.1--91\% (1/11 to 10/11) is for 8 bits with
even parity, as used by the DM3730 ROM boot loader.
The duty cycle range would be 10--90\% for the more common 8 bits
without parity format.} \\
\end{tabular}
\end{tab}%
\end{savenotes}%

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{Combined characteristics}

Combining the specifications from the preceding sections, we obtain the
following common characteristics for transmitter and receiver:

% Minimum beam angle
%
% Jul 08 00:07:39 <DocScrutinizer05> I think 50° are absolute minmum

% Wavelength selection
%
% Jul 07 23:28:15 <DocScrutinizer05> I'd prefer CIR wavelength rather than
% IrDA wavelength

\begin{tab}
\begin{tabular}{l|cll}
Parameter  & Value & Unit \\
\hline
Wavelength	& 940		& nm	& transmit \\
		& 850--950	& nm	& receive \\
Frequency	& 0.9--312	& kHz \\
Beam angle	& $\ge 50$	& $\hbox to 0pt{}\degree$ \\
\end{tabular}
\end{tab}

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{Transmit power}

While we do not know the radiant flux density required at the IR receivers
of consumer devices and therefore cannot specify the minimum
radiant intensity of the transmitter, we expect performance of the
IR transmitter to be on par with the average TV remote control.
For comparison, the N900 has a range of only approximately 2 m, which
we would consider too short.

% Expected range
%
% Jul 07 23:12:51 <DocScrutinizer05> I'd expect it to be on par with the
% average TV remote
%
% Jul 07 23:14:14 <DocScrutinizer05> N900 has a range of hardly 2m, that's
% inacceptable

% High-current operation
%
% Jul 07 23:29:55 <DocScrutinizer05> 300mA pulsed sounds good

In order to improve its range, the transmitter should be driven with as
high a current as reasonably possible. In CIR and IrDA mode, this current
would be well above the permissible continuous forward current. Note
that incorrect use could cause the IR LED to overheat and the energy of
a pulse therefore has to be limited. We discuss this in section \ref{overload}.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{Received signal processing}

% High-pass RX filter
%
% Jul 07 23:57:01 <DocScrutinizer05> for the RX we want a phototransistor
% with filter gear to implement a highpass with cutoff @ ~20kHz

% RX connections
%
% Jul 09 16:43:40 <DocScrutinizer05> the detector should get connected to UART3
% RX, via proper signal shaping/filtering.
% and possibly also to audio-in

On the receiving side, the signal should in CIR or IrDA mode go through a
high-pass filter with
a cutoff frequency of about 20 kHz and then be shaped into a digital
signal for the RX line. The unfiltered analog signal should also be sent to
an unused input of the audio codec. We have no further specification for the
analog signal from the IR sensor at this time.

\begin{center}
\includegraphics[scale=0.9]{filter.pdf}
\end{center}
%
Given that IR-UART can have very long high or low pulses, a high-pass
filter with a much lower cut-off frequency has to be used when IR-UART mode
is selected. A cut-off frequency of about 1--100 Hz should be sufficient
for DC blocking. The figure above illustrates the concept.

% Analog IR RX TBD
%
% Jul 17 03:43:57 <DocScrutinizer05> IR RX: I have nothing specific in mind,
% and I don't think we need to specify it right now. Will care about it later

% 
% Jul 23 15:48:26 <DocScrutinizer05> "ToDo HPF" we don't use HighPass
% filtering for UART mode, at least not with 20kHz, rather a DC-offset
% (aka background light) blocking filter at maybe 1Hz..100Hz (TBD)
%
% Jul 23 15:48:51 <DocScrutinizer05> This applies to UART mode only. SIR
% needs a 20kHz HPF
% Jul 23 15:49:21 <DocScrutinizer05> err, CIR needs that. SIR I'm currently
% clueless
%


% -----------------------------------------------------------------------------

\section{Configurations}

The IR subsystem can be configured for several different modes of operation.
The following sections detail the various configurations.

In each case the configuration of both the transmitter and the receiver
is shown. In many real-life situations, only one direction will be
used at a time while the other is deactivated. A deactivated transmitter
or receiver should behave as described in section \ref{off}.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{CPU powered down}

If the CPU is powered down, the IR subsystem shall be deactivated as
described in section \ref{off}.

%
% Jul 23 15:51:50 <DocScrutinizer05>
% "ToDo CPU power down" we want IR to be disabled then, right?
%

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{Reset}
\label{reset}

When the control signals from the CPU are in their reset state, the
configuration of the IR system is determined by the state of the
GPIO pin of the bq27200 battery fuel gauge.
We call this pin ``bq.GPIO'' in the rest of the document.
The fuel gauge chip is directly connected to the battery and retains its
state during normal system reset.

Note that the bq27200 does not preserve the entire state of bq.GPIO
across power-on reset: while the direction of the pin is determined
by EEPROM content and is therefore retained across power-cycling,
the open-collector output is always set to ``1'', i.e., it is high-Z.

If bq.GPIO is high-Z and the CPU's control signals are in their reset
state, 
both transmitter and receiver shall be active and operate in IR-UART mode.
The purpose of this mode is to allow the CPU's ROM boot loader to try to boot
from UART3 via infrared.

If bq.GPIO is ``0'' and the CPU's control signals are in their reset state,
the IR subsystem shall be deactivated as described in section
\ref{off}.

When the CPU has left its reset state and can actively control the IR
subsystem, it is also able to change the state of bq.GPIO. bq.GPIO can
therefore be used (or ignored) as the implementation sees fit.

The following table summarizes the IR configuration in power-down and
after CPU reset:

\begin{tab}
\begin{tabular}{ll|l}
CPU.controls	& bq.GPIO		& IR configuration \\
\hline
CPU off		& any			& off (minimum power) \\
reset state	& ``1'' (High-Z)	& IR-UART TX/RX \\
		& ``0''			& off (minimum power) \\
active		& to be defined		& defined by controls \\
\end{tabular}
\end{tab}%
%
Use of the data signals in IR-UART mode is further explained in
section \ref{cfg:iruart}.
Note that Hackerbus can override the receiver and the CPU can therefore
boot from (wired) UART even if the IR-UART configuration is selected.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{IR deactivated}
\label{off}

The CPU can deactivate the transmitter and receiver, either both together
or one at a time, through the control signals to the IR subsystem.

When deactivated, the IR subsystem must draw as little current as possible.
The transmitter must ignore its data inputs, e.g., TX and CTS, and under no
circumstance activate the IR LED. The receiver must not drive the RX line
and use as little power as possible for any filters and/or amplifiers.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{CIR mode}

In CIR mode the CPU uses CTS as an active-high output%
\footnote{Note that CTS is an input at the CPU when UART3 is used as
regular UART.}
for transmit data.
The CIR module in the CPU could also use RTS for configuration purposes,
but we seem to have no use for this and the IR circuit must ignore its
state.
The use of RX in CIR mode is not clearly specified and it seems safe to
use it
similar to IrDA mode.
TX is not used and can be assigned to other tasks. The IR circuit must
therefore ignore the state of TX when in CIR mode.

CIR mode configuration is illustrated in the following drawing:
\begin{center}
\includegraphics[scale=0.9]{cir.pdf}
\end{center}

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{IrDA mode}

In IrDA (SIR) mode, the CPU uses TX as active-high output and RX as
either\footnote{Depending on the setting of MDR2\_REG.RRXINVERT.}
active-low or active-high input.
RTS could again be used for configuration but is not
relevant in our application. CTS is not used in IrDA mode.
The IR circuit must therefore ignore the state of RTS and CTS when in
IrDA mode.

IrDA mode configuration is illustrated in the following drawing:
\begin{center}
\includegraphics[scale=0.9]{irda.pdf}
\end{center}

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{IR-UART mode}
\label{cfg:iruart}

In IR-UART mode, TX and RX both are active-low. RTS and CTS are not used.

The IR LED driver may be configured
to operate at a current that does not exceed
the LED's maximum continuous forward current.
In any case, power dissipation must be controlled as described in section
\ref{overload}.

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{UART mode}

The IR subsystem is inactive in UART mode and must behave as described
in section \ref{off}.
While we call it ``UART mode'', this configuration
applies to any setup where the UART signals are used for some form of
communication with the Hackerbus that does not involve IR.

UART mode configuration is illustrated in the following drawing:
\begin{center}
\includegraphics[scale=0.9]{uart.pdf}
\end{center}

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

\subsection{Mode summary}

\def\unspec{---}
\def\outpos{$\stackrel{\strut\sqcap}{\longrightarrow}$}
\def\outneg{$\stackrel{\strut\sqcup}{\longrightarrow}$}
\def\inppos{$\stackrel{\strut\sqcap}{\longleftarrow}$}
\def\inpneg{$\stackrel{\strut\sqcup}{\longleftarrow}$}
\def\inpeit{$\stackrel{\strut\sqcup/\sqcap}{\longleftarrow}$}
\def\outany{$\longrightarrow$}
\def\inpany{$\longleftarrow$}
\def\posact{$\sqcap$}
\def\negact{$\sqcup$}
\def\eitact{$\sqcup/\sqcap$}

The following table summarizes the configuration of the I/O pins at
the CPU in the various IR modes:

\begin{tab}
\begin{tabular}{l|ccccc}
Signal & \multicolumn{5}{c}{IR subsystem mode} \\
        & Off     & CIR     & IrDA    & IR-UART & UART \\
\hline
TX	& \unspec & \unspec & \outpos & \outneg & \outneg \\
CTS	& \unspec & \outpos & \unspec & \unspec & \inpneg \\
RTS	& \unspec & \unspec & \unspec & \unspec & \outneg \\
RX	& \unspec & \inpeit & \inpeit & \inpneg & \inpneg \\
\end{tabular}
\end{tab}
%
{\outany} indicates an output from
the CPU, {\inpany} an input. An active-high signal (i.e., light is emitted
or received on the signal being ``1'') is marked with
{\posact} while an active-low (light on ''0'') signal is marked with
{\negact}.
A signal where the CPU can be configured for either polarity is marked
with {\eitact}. An unused signal is marked with {\unspec}.

% -----------------------------------------------------------------------------

\section{Possible component selection}

% Agreement on VSMB2948SL LED
%
% Jul 08 04:20:17 <DocScrutinizer05> I think
% http://www.vishay.com/docs/83498/vsmb2948sl.pdf
% is a better match for our purposes

Taking into account the requirements specified in section \ref{modes},
available space (see section \ref{placement}), and general component
availability, we consider the Vishay VSMB2948SL%
\footnote{\url{http://www.vishay.com/docs/83498/vsmb2948sl.pdf}}
IR LED and the Vishay VEMD10940F%
\footnote{\url{http://www.vishay.com/docs/83493/vemd2023slx01.pdf}}
photodiode suitable for our purpose.

\begin{tab}
\begin{tabular}{l|cl|cc}
Parameter	& Requirement	& Unit	& Transmitter	& Receiver \\
		& 		& 	& VSMB2948SL	& VEMD10940F \\
\hline
Wavelength	& 850--950	& nm	& 940		& 780--1050 \\
Beam angle	& $\ge$ 50 & $\hbox to 0pt{}\degree$ & 50 & 150 \\
Peak frequency 	& $\ge$ 0.3	& MHz	& 23		&  $\approx 2$ \\
\end{tabular}
\end{tab}%
%
Note that the peak frequency of 2 MHz for the receiver is an estimate
based on the specified rise and fall times of 100 ns each, which are
specified for a reverse voltage of 10 V whereas we would expect to
operate at a lower voltage.

% Daylight filter
%
% Jul 08 00:54:44 <DocScrutinizer05> don't worry about "color2 filtering,
% we already ahve a apparently completely black window

The characteristics of the daylight filter integrated in the IR
window of the N900 case are unknown,
our design will add multiple internal light sources
that may affect the photodiode, and there is also the possibility of
outside light reaching the diode through the spacer frame. We therefore
consider it desirable for the photodiode to contain its own filter and
not have to rely on external filtering and shielding.

% Photo-transistor, speed:
%
% Jul 08 03:27:28 <DocScrutinizer05> wpwrak:
% http://www.everlight.com/datasheets/PT26-51B-TR8_datasheet.pdf
% says "rise/fall-time 15us" - seems it's a tad slow for carrier frequencies
% >30kHz

% Photo-transistor, access to base:
%
% Jul 09 16:40:41 <DocScrutinizer05> re phototransistor: we prolly should
% use a photodiode then, they are faster than a phototransistor without
% proper discharge resistor on base

We considered the use of a phototransistor, but found that the readily
available SMT parts all had rise and fall times in the order of 15 $\mu$s,
which would limit the maximum signal frequency to only about 30 kHz.
They do not allow improving response time by biasing the transistor.

% -----------------------------------------------------------------------------

\section{Component placement}
\label{placement}

The N900 case has a window with an integrated IR filter of unknown
characteristics. The window is approximately 5.6 mm $\times$ 5.3 mm. 

The window is designed for a single IR LED but we will have a LED
and a photodiode. Since IR components are generally large, it won't
be possible to place both ``nicely'' side by side. However, as the
following drawing illustrates, both components can ``see'' the window
if placed behind each other:

% 10 point font, nominal is 10*0.9
% 12/10*.9 = 1.08
\begin{center}
\includegraphics[scale=1.08]{window.pdf}
\end{center}
%
The transmitter should be closer to the window since its performance
is more important than that of the receiver.

The following drawing shows a bottom view of the chamber that contains
the IR diodes. The indicated placement maintains a clearance of at
least 5 mm between components and between components and walls.

% 16 point font, nominal is 12*0.9
% 12/16*.9 = 0.675
\begin{center}
\includegraphics[scale=0.675]{chamber.pdf}
\end{center}

% -----------------------------------------------------------------------------

\section{Conflict resolution}
\label{conflict}

%
% Conflict resolution rules:
%
% Jul 15 21:49:18 <DocScrutinizer05> wpwrak: both, and collision is a
% non-defined case, but we will make sure that the UART TX has a series R
% so it can get overridden by HB, given HB driver has lower ESR. Same for
% RX from photodiode which HB can override before it raches UART

When a line is driven as output from multiple sources, the following
conflict resolution strategy shall be applied:

\begin{tab}
\begin{tabular}{l|ll|l}
Line	& Dominant	& Subordinate	& Applicable IR system states \\
\hline
TX	& Hackerbus	& CPU		& IrDA, IR-UART \\
CTS	& Hackerbus	& CPU		& CIR \\
RX	& Hackerbus or CPU & IR sensor	& CIR, IrDA, IR-UART \\
\end{tabular}
\end{tab}%
%
Conflicts between CPU and Hackerbus on RTS or RX result in undefined
behaviour and should be avoided. Conflict increases overall power
consumption and should be avoided during normal system operation.

Precedence is established by series resistors next to the CPU for TX and
CTS, and a series resistor on the digital output of the IR receiver,
before entering the RX line.

% -----------------------------------------------------------------------------

\section{Undriven signals}
\label{undriven}

The IR circuit must be tolerant to a UART signal being driven by neither
CPU, Hackerbus, or the IR receiver. Whether this tolerance is achieved by
pulling the signal to a safe state or by applying a more general
protection against incorrect inputs is left as an implementation choice.

Control signals that float after CPU reset and that are not ignored by the
IR subsystem must be pulled to a safe state.

% -----------------------------------------------------------------------------



\section{Overload protection}
\label{overload}

% Pulse width limiting
%
% Jul 07 23:54:20 <DocScrutinizer05>
% make sure the pulsewidth at 500mA gets limited by hw to 100us

To improve its range, the IR LED can be driven with a peak current
significantly above its permitted continuous forward current. If the
diode is driven at such a high current for too long, it could overheat
and suffer permanent damage.

While some of the IR protocols operate with low duty cycles that allow the
transmitter to cool down between bursts or pulses,  the circuit should not
rely on software always
setting up things correctly. Also, the IR-UART protocol can have duty cycles
of up to 91\% and would require special handling.\footnote{One possible use
of IR-UART is to output kernel diagnostics. This sort of text would have a
duty cycle of about 50--60\% if sent as 8 bit characters with a start and a
stop bit each and the LED lit during every ``0'' bit.}

We considered simply limiting pulse length to the peak duration of 100
$\mu$s commonly specified for IR LEDs, but this would still leave
many dangerous patterns and would conflict with correct use of IR-UART
where the maximum nominal pulse at 19.2 kbps is already 469 $\mu$s.

We therefore suggest a simple analog circuit that limits long-term
average current to the diode's continuous forward current but that stores
energy for short bursts in a capacitor. Use with low duty cycle would give
the capacitor time to recharge between pulses while high duty cycle would
empty the capacitor in a brief initial flash and then proceed at the
``safe'' continuous current.

This reflects the thermal processes inside the diode, where the
continuous current corresponds to heat dissipation and the
peak energy transferred from the capacitor corresponds to the diode's
thermal energy.

\begin{center}
\includegraphics[scale=0.82, trim=35 0 240 0, clip]{ir-ilim-z.pdf}
\end{center}

\noindent
Example current-limiting circuit: continuous current through the
IR LED D1 is limited by R1 and R3. Short pulses in the 100 $\mu$s range
can draw extra current from C1. The peak current is then limited by the
constant current transistor circuit. This example uses a Darlington
configuration to obtain a current gain $\beta \gg 100$.

The simulation illustrates the operation of the circuit with an infinite
pulse starting at 100 $\mu$s. Note that the model is only a rough approximation
and should be confirmed by lab measurements. The source of the Qucs simulation
can be found here:

\noindent
\url{http://neo900.org/git/?p=misc;a=blob;f=ir/ilim-z.sch;hb=HEAD}

\end{document}
% Jul 09 16:47:10 <DocScrutinizer05> re any multiplexing: I expect the whole IR section to get powered down by asserting a GPIO pin to a non-POR-default state, so the IR is active by default after power on reset. By connecting the whole IR via some series resistors to the UART, I expect anything on hackerbus to be able to override what comes from IR, particularly when IR is powered down