7 Many Altus Metrum products come with an eight pin Micro MaTch
8 connector, called the Companion Port. This is often used to
9 program devices using a programming cable. However, it can
10 also be used to connect TeleMetrum to external companion
11 boards (hence the name).
13 The Companion Port provides two different functions:
15 * Power. Both battery-level and 3.3V regulated power are
16 available. Note that the amount of regulated power is not
17 huge; TeleMetrum contains a 150mA regulator and uses, at
18 peak, about 120mA or so. For applications needing more than
19 a few dozen mA, placing a separate regulator on them and
20 using the battery for power is probably a good idea.
23 * SPI. The flight computer operates as a SPI master, using
24 a protocol defined in this document. Companion boards
25 provide a matching SPI slave implementation which supplies
26 telemetry information for the radio downlink during flight
28 == Companion SPI Protocol
30 The flight computer implements a SPI master communications
31 channel over the companion port, and uses this to get
32 information about a connected companion board and then to get
33 telemetry data for transmission during flight.
35 At startup time, the flight computer sends a setup request
36 packet, and the companion board returns a board identifier,
37 the desired telemetry update period and the number of data
38 channels provided. The flight computer doesn't interpret the
39 telemetry data at all, simply packing it up and sending it
40 over the link. Telemetry packets are 32 bytes long, and
41 companion packets use 8 bytes as a header leaving room for a
42 maximum of 12 16-bit data values.
44 Because of the limits of the AVR processors used in the first
45 two companion boards, the SPI data rate is set to 187.5kbaud.
47 == SPI Message Formats
49 This section first defines the command message format sent from
50 the flight computer to the companion board, and then the various
51 reply message formats for each type of command message.
53 .Companion Command Message
54 [options="border",cols="1,3,3,9"]
69 |Current flight computer state
74 |Flight computer clock (100 ticks/second)
79 |Flight computer serial number
93 .Companion Command Identifiers
94 [options="border",cols="1,3,9"]
102 |Supply the flight computer with companion
107 |Return telemetry information
111 |Tell companion board when flight state changes
114 The flight computer will send a SETUP message shortly after
115 power-up and will then send FETCH messages no more often than
116 the rate specified in the SETUP reply. NOTIFY messages will be
117 sent whenever the flight state changes.
119 'flight_state' records the current state of the flight,
120 whether on the pad, under power, coasting to apogee or
121 descending on the drogue or main chute.
123 'tick' provides the current flight computer clock, which
124 be used to synchronize data recorded on the flight computer
125 with that recorded on the companion board in post-flight analysis.
127 'serial' is the product serial number of the flight computer,
128 'flight' is the flight sequence number. Together, these two
129 uniquely identify the flight and can be recorded with any
130 companion board data logging to associate the companion data
131 with the proper flight.
133 NOTIFY commands require no reply at all, they are used solely
134 to inform the companion board when the state of the flight, as
135 computed by the flight computer, changes. Companion boards can
136 use this to change data collection parameters, disabling data
137 logging until the flight starts and terminating it when the
140 === SETUP reply message
142 .SETUP reply contents
143 [options="border",cols="1,3,3,9"]
158 |~board_id—used to tell if a board is present
163 |Minimum time (in 100Hz ticks) between FETCH commands
168 |Number of data channels to retrieve in FETCH command
176 The SETUP reply contains enough information to uniquely
177 identify the companion board to the end user as well as for
178 the flight computer to know how many data values to expect in
179 reply to a FETCH command, and how often to fetch that data.
181 To detect the presence of a companion board, the flight
182 computer checks to make sure that board_id_inverse is the
183 bit-wise inverse of board_id. Current companion boards use
184 USB product ID as the board_id, but the flight computer does
185 not interpret this data and so it can be any value.
187 === FETCH reply message
189 .FETCH reply contents
190 [options="border",cols="1,3,3,9"]
213 The FETCH reply contains arbitrary data to be reported
214 over the flight computer telemetry link. The number of
215 16-bit data items must match the 'channels' value
216 provided in the SETUP reply message.
218 == History and Motivation
220 To allow cross-programming, the original TeleMetrum and
221 TeleDongle designs needed to include some kind of
222 connector. With that in place, adding the ability to connect
223 external cards to TeleMetrum was fairly simple. We set the
224 software piece of this puzzle aside until we had a companion
227 The first companion board was TeleScience. Designed to collect
228 temperature data from the nose and fin of the airframe, the main
229 requirement for the companion port was that it be able to report
230 telemetry data during flight as a back-up in case the
231 TeleScience on-board data was lost.
233 The second companion board, TelePyro, provides 8 additional
234 channels for deployment, staging or other activities. To avoid
235 re-programming the TeleMetrum to use TelePyro, we decided to
236 provide enough information over the companion link for it to
237 independently control those channels.
239 Providing a standard, constant interface between the flight
240 computer and companion boards allows for the base flight
241 computer firmware to include support for companion boards.