summaryrefslogtreecommitdiff
path: root/doc/protocols/ground-rxtx.txt
blob: 49d006b30ef89f5c66a5eeb35cf0cc6237bce0d1 (plain) (blame)
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
Features Needed:

* Download Images
* Download Piezo Sample Data
* Broadcast Messages (random or sequential)


Features Nice To Have:
* Download additional Telemetry
* Store and Forward Messaging
* Choose Best Image before Download


Additional Telemetry Information not included in TTX Beacon:
* RTC current time


Protocol Features Needed:
* scheduling broadcasts @time | @geolocation
* start download now



• VHF, 144-146MHz, Bmax = 18kHz
• UHF, 434.79-438MHz, Bmax = 30kHz
Due to the constraints imposed by the payload



Protokoll:

self made downlink protokoll:

* intelligenter Image Dump
* Audio Memory Dump
* Image Bewertungs Index Dump
* Telemetrie und Counter Dump
* random Text-Message Dump (wenn Power da ist)

encapsulated in:
* CCSDS Frames
  GMSK (braucht ~10kHz Bandbreite)
* BPSK 1000 (QPSK 500)
* Turbo-Codec (if licencse allowed)
  Reed-Solomon

alt:
* Nix, raw data via FSK31 (or hither)
* Turbo-Phi-Code
* FX.25
* AX.25
(depends on content and configuration Flags)


Frame:
Option 1:
GMSK(CCSDS(Data,Reed-Solomon))
Option 2:
GMSK(CCSDS(TurboCode(Data)))
Option 3:
BPSK500(CCSDS(TurboCode(Data)))
Option 4:
BPSK500(CCSDS(Data,Reed-Solomon))
...



Protokoll:
Downlink:

+--------------------+-----------------+-------+
| Data Frame Type ID | Frame Type Data | CRC32 |
+--------------------+-----------------+-------+


Downlink Frame Types (Frame Type Data):
* Memory Area Dump Start (new DumpID (inc) , from Address)
* Random Text Message Start (new DumpID)
* Image Data Start Frame (new DumpID, Image ID, from Offset)

* DataDump (current DumpID, Packet ID, Data Length, Data))

* Image Metadata Single Frame (Image ID, file size, Quality Factor, DCT-Coefficients Mean, DCT-Coefficients StdDev, simplified rgb image historgram [3 colours * 64 division * 8 Bytes])

DataDump (current DumpID, Packet ID, Data Length, Data))
Image Metadata Single Frame\\(Image ID, Quality Factor, DCT-Coefficients Mean, DCT-Coefficients StdDev, simplified historgram)

Note:
 new DumpId with every "Start"-type frame. Only HARD requirement: dumpid must be different from previous dumpId
 PacketID increments with every frame and resets to 0 with "Start"-type frame
 DumpId ensures that DataDump streams can be differentiated if in-between StartFrame goes missing


most errors should be corrected by FEC
if Recieve Error of Frame still happens:
* rerequest memory area with offset
* rerequest ImageID (w/offset)
* rerequest whole Dump by explicitly repeating command (can't request dumpid since they are not meant to be uniqe)


Uplink Todo ??
 ?? ability to resend commands in queue before execute -> QueueSlots and "Insert Command into QueueSlot#" instead of "Append Command"
      contra argument: fading signal will propably wane slower than it takes to fill command queue. so sending full command queue multiple times is
      more likely to succeed than sending single commands multiple times.

Uplink Commands:
* Clear Command Queue
* Append Command WriteConfigArea (Data, CRC32)
* Append Command DumpMemoryArea (StartAddress, Length)
* Append Command WriteMemoryArea (StartAddress, Length, Data, CRC32)
* Append Command AppendNewTextMessage (Length, Data, CRC32)
* Append Command GetImageMetaData (from ImageID, NumImages)
* Append Command GetImage (ImageID, fromOffset, max Data to transmit or 0 for all data)
* Append Command Send Random Text Message
* Append Command WaitDuration and switch off transciever (Seconds)
* Append Command WaitUntil and switch of Transc (TimeOfDay)
* Execute Command Queue (Num Commands, ExecSeqNum, MAC(Full CmdQueue Contents incl Data . Num Commands . ExecSeqNum))


Note:
 Password should be random and 160 bit long
 MAC(x) = sha1(password . sha1(x . password))
 Satellite keeps track of highest last used ExecSeqNum and rejects lower
 Stored ExecSeqNum get's reset to 0 on CRX Reset-Settings

 single commands usually don't carry CRC checks, because they are only ever executed as a whole cmd queue.
 so it's enough to have integrity check in the last cmd. This also saves bandwidth.
 As a side effect, the amound of uplink data to be integrity checked becomes dynamic (i.e. on bad link, just send less commands at once)

To Consider:
 maybe CRC32 SHOULD be added to every Clear/Append command, and every append command should be ack in TTX,
 so it can be resend on transmission error and execute command has then higher chance of succeeding ?
 downside: uplink would be much much slower if (optional) we wait for TTX Acks
 upside: execute command has higher chance of executing

Never: substitute sha1 of individual crc32 with sha1 of whole contents in execute command


Attacks:

 Substitution Attack:
  should not be possible since MAC is calculated over full CmdQueue contents

 Repeat Attack:
  should be hard, because Nonces are not reusable, unlesss attacker also manages to reset cpu via dtmf

 Man-In-The-Middle Attack:
  no two way handshake, so no better than other attacks

 Brute Force:
  can capture uplink stream and brute fore password at home
  thus password should utilize full bit range and be sufficiently long e.g. 32 byte random number

 Denial Of Service:
  If password cracked, nonces can be used up
  Uplink Channel can be actively jammed
  Append Command can be inserted after our ClearCmdQueue, making sure ExecuteCmd won't suceed


To Consider:
 Does Arm Cortex M3 have enough speed/power for RSA | DSA | ECC-DSA ?








Msg Store/Forward Feature Wishes:
* Store Msg: Group(byte), Msg(bytes[])
* Get Msg: Group(byte), last_x_msgs(word)   (i.e. 9999 for all) 
* AutoBroadcast von Group 0 ???
* Schedule Random Broadcast of Msgs in Group: Group(byte), Time(TS)
-> AFU Store Forward Protokolle ???



= Layers =

=== Physical Layer ===
GMSK NRZ-I 
=== Data Link Layer ===
HDLC / AX.25
=== Network Layer ===
(AX.25)
=== Transport Layer ===
(AX.25)
=== Session Layer ===
BC2P
=== Presentation Layer ===
BC2P
=== Application Layer ===
BC2P





= Optional HDLC + Custom or AX.25 = 

Both options are encapsulated within a synchronous HDLC Frame.

Data-Stream-Start-Flag: 01111110 
Data-Stream-End-Flag  : 01111110
Frame-Separator-Flag  : 01111110

If the Start/End-Flag sequence should occur withing the data-stream, bit-stuffing is applied.
I.e. On the sender side, after 5 consecutive 1s of data one 0 is appended.
     On the reciever's side, 5 consecutive 1s followed by one 0 is transformed to 5 consecutive 1s aka the 0 is removed.

e.g.
1010 1010 0100 1111 1111 1100
might be transformed into the following 2 frames
01111110 1010 1010 0100 01111110 1111 1011 1110 00 01111110


=== Option1: HDLC based custom framing (less overhead) ===

Content Types Bit Field:
3 orthogonal bit pattern values:
110  Data encoded with FEC scheme
011  Data only
101  separate FEC data



=== Option2: AX.25 Framing (more compatibility) ===


    .------------------------------------------------------------------------.
    . StartFlag | Address      | ControlInfo |  Data    | CRC     | StopFlag .
    .------------------------------------------------------------------------.
    . 01111110  | 112/224 bits | 8/16 bits   | n*8 bits | 16 bits | 01111110 .
    '------------------------------------------------------------------------'


= BC2P =

BC2P is the Bernhard Christian Patrick Protocol


Frame Types:
* [Dn] Data Frame
* [RS] Reed Solomon FEC Frame, carrying FEC Data for previous N (configurable via DFpRS) data frames

variable DFpRS ratio: If too many frame errors are encountered, the ration can be increased up to 1:1,
                      respectively if no errors are encountered it can be set to 1:inf (i.e. switch of FEC Frames)
                      Note that in AX.25 Mode, where a TNC may just discard frames with bad CRC without forwarding it to the PC,
                      this may not a very helpful FEC mode and should thus be switched off.
                      Thankfully, GENSO operates it's TNCs in FlexNet Mode and thus get's the raw AX.25 frames which it stores as recieved.

variable FrameLength:   should be configured depending on encountered fading.
                        i.e. should be very small in the beginning and can be increased for more throughput,
                        once it is clear that satellite rotation (source of rapid fading) is slow enough.

Possible Frame Sequence with DFpRS 1:3 (meaning 1 in 3 errornous frames can be corrected):

...[D1][D2][D3][RS][D4][D5][D6][RS]...




"document this" TODO:
* frame bits !!
* maximum Frame length ????
* think it through..
* describe it properly
* bandbreite basisbandsignal gmsk
* bandbreite fertiges signal
* Layers ?
* ...