1NOTES ON RADIOTRACK CARD CONTROL
2by Stephen M. Benoit (benoits@servicepro.com)  Dec 14, 1996
3----------------------------------------------------------------------------
4
5Document version 1.0
6
7ACKNOWLEDGMENTS
8----------------
9This document was made based on 'C' code for Linux from Gideon le Grange
10(legrang@active.co.za or legrang@cs.sun.ac.za) in 1994, and elaborations from
11Frans Brinkman (brinkman@esd.nl) in 1996.  The results reported here are from
12experiments that the author performed on his own setup, so your mileage may
13vary... I make no guarantees, claims or warranties to the suitability or
14validity of this information.  No other documentation on the AIMS
15Lab (http://www.aimslab.com/) RadioTrack card was made available to the
16author.  This document is offered in the hopes that it might help users who
17want to use the RadioTrack card in an environment other than MS Windows.
18
19WHY THIS DOCUMENT?
20------------------
21I have a RadioTrack card from back when I ran an MS-Windows platform.  After
22converting to Linux, I found Gideon le Grange's command-line software for
23running the card, and found that it was good!  Frans Brinkman made a
24comfortable X-windows interface, and added a scanning feature.  For hack
25value, I wanted to see if the tuner could be tuned beyond the usual FM radio
26broadcast band, so I could pick up the audio carriers from North American
27broadcast TV channels, situated just below and above the 87.0-109.0 MHz range.
28I did not get much success, but I learned about programming ioports under
29Linux and gained some insights about the hardware design used for the card.
30
31So, without further delay, here are the details.
32
33
34PHYSICAL DESCRIPTION
35--------------------
36The RadioTrack card is an ISA 8-bit FM radio card.  The radio frequency (RF)
37input is simply an antenna lead, and the output is a power audio signal
38available through a miniature phone plug.  Its RF frequencies of operation are
39more or less limited from 87.0 to 109.0 MHz (the commercial FM broadcast
40band).  Although the registers can be programmed to request frequencies beyond
41these limits, experiments did not give promising results.  The variable
42frequency oscillator (VFO) that demodulates the intermediate frequency (IF)
43signal probably has a small range of useful frequencies, and wraps around or
44gets clipped beyond the limits mentioned above.
45
46
47CONTROLLING THE CARD WITH IOPORT
48--------------------------------
49The RadioTrack (base) ioport is configurable for 0x30c or 0x20c.  Only one
50ioport seems to be involved.  The ioport decoding circuitry must be pretty
51simple, as individual ioport bits are directly matched to specific functions
52(or blocks) of the radio card.  This way, many functions can be changed in
53parallel with one write to the ioport.  The only feedback available through
54the ioports appears to be the "Stereo Detect" bit.
55
56The bits of the ioport are arranged as follows:
57
58  MSb                                                         LSb
59+------+------+------+--------+--------+-------+---------+--------+
60| VolA | VolB | ???? | Stereo | Radio  | TuneA | TuneB   | Tune   |
61|  (+) |  (-) |      | Detect | Audio  | (bit) | (latch) | Update |
62|      |      |      | Enable | Enable |       |         | Enable |
63+------+------+------+--------+--------+-------+---------+--------+
64
65
66VolA . VolB  [AB......]
67-----------
680 0 : audio mute
690 1 : volume +    (some delay required)
701 0 : volume -    (some delay required)
711 1 : stay at present volume
72
73Stereo Detect Enable [...S....]
74--------------------
750 : No Detect
761 : Detect
77
78  Results available by reading ioport >60 msec after last port write.
79  0xff ==> no stereo detected,  0xfd ==> stereo detected.
80
81Radio to Audio (path) Enable [....R...]
82----------------------------
830 : Disable path (silence)
841 : Enable path  (audio produced)
85
86TuneA . TuneB [.....AB.]
87-------------
880 0 : "zero" bit phase 1
890 1 : "zero" bit phase 2
90
911 0 : "one" bit phase 1
921 1 : "one" bit phase 2
93
94  24-bit code, where bits = (freq*40) + 10486188.
95  The Most Significant 11 bits must be 1010 xxxx 0x0 to be valid.
96  The bits are shifted in LSb first.
97
98Tune Update Enable [.......T]
99------------------
1000 : Tuner held constant
1011 : Tuner updating in progress
102
103
104PROGRAMMING EXAMPLES
105--------------------
106Default:        BASE <-- 0xc8  (current volume, no stereo detect,
107				radio enable, tuner adjust disable)
108
109Card Off:	BASE <-- 0x00  (audio mute, no stereo detect,
110				radio disable, tuner adjust disable)
111
112Card On:	BASE <-- 0x00  (see "Card Off", clears any unfinished business)
113		BASE <-- 0xc8  (see "Default")
114
115Volume Down:    BASE <-- 0x48  (volume down, no stereo detect,
116				radio enable, tuner adjust disable)
117		* wait 10 msec *
118		BASE <-- 0xc8  (see "Default")
119
120Volume Up:      BASE <-- 0x88  (volume up, no stereo detect,
121				radio enable, tuner adjust disable)
122		* wait 10 msec *
123		BASE <-- 0xc8  (see "Default")
124
125Check Stereo:   BASE <-- 0xd8  (current volume, stereo detect,
126				radio enable, tuner adjust disable)
127		* wait 100 msec *
128		x <-- BASE     (read ioport)
129		BASE <-- 0xc8  (see "Default")
130
131		x=0xff ==> "not stereo", x=0xfd ==> "stereo detected"
132
133Set Frequency:  code = (freq*40) + 10486188
134		foreach of the 24 bits in code,
135		(from Least to Most Significant):
136		  to write a "zero" bit,
137		    BASE <-- 0x01  (audio mute, no stereo detect, radio
138				    disable, "zero" bit phase 1, tuner adjust)
139		    BASE <-- 0x03  (audio mute, no stereo detect, radio
140				    disable, "zero" bit phase 2, tuner adjust)
141		  to write a "one" bit,
142		    BASE <-- 0x05  (audio mute, no stereo detect, radio
143				    disable, "one" bit phase 1, tuner adjust)
144		    BASE <-- 0x07  (audio mute, no stereo detect, radio
145				    disable, "one" bit phase 2, tuner adjust)
146
147----------------------------------------------------------------------------
148