Software » History » Version 2

PRIETO, Matías, 03/22/2015 03:17 AM

1 1 PRIETO, Matías
h1. Software Design
2 1 PRIETO, Matías
3 2 PRIETO, Matías
{{>toc}}
4 2 PRIETO, Matías
5 1 PRIETO, Matías
System behavior is controlled by the MCU integrated in the motherboard, which communicates with other subsystems through the Cubesat Kit Bus. The MCU is programmed in C language based on the RTOS Salvos. Therefore, the stack implementation is programmed under these constraints. 
6 1 PRIETO, Matías
7 1 PRIETO, Matías
Figure below presents the final implemented communication stack of the system as part of the communication chain design.
8 1 PRIETO, Matías
9 1 PRIETO, Matías
p=. !{width:40%}cubesat_stack.png!
10 1 PRIETO, Matías
_Communication stack._
11 1 PRIETO, Matías
12 1 PRIETO, Matías
13 1 PRIETO, Matías
14 1 PRIETO, Matías
h2. Concepts
15 1 PRIETO, Matías
16 1 PRIETO, Matías
h3. NMEA sentences
17 1 PRIETO, Matías
18 1 PRIETO, Matías
h3. Manchester encoding
19 1 PRIETO, Matías
20 1 PRIETO, Matías
21 1 PRIETO, Matías
h2. Overall program description
22 1 PRIETO, Matías
23 1 PRIETO, Matías
The Salvo OS is a multitask operative system, based on the definition of multiple tasks. Each task is implemented inside an infinite loop.
24 1 PRIETO, Matías
25 1 PRIETO, Matías
The system main program is composed by two tasks. One in charge of L2+L1, controlling the physical layer and the other one in charge of acquiring plus filtering data from the GPS module, and formatting it (L4). In addition, a specific function is in charge of mapping the native ASCII messages coming from L4, into Baudot alphabet (L3) to be sent to L2+L1.
26 1 PRIETO, Matías
27 1 PRIETO, Matías
h3. Tasks, functions and main data structures description
28 1 PRIETO, Matías
29 1 PRIETO, Matías
Task and functions definition:
30 1 PRIETO, Matías
* _task_gps_update()_
31 1 PRIETO, Matías
* _task_rtty_phy()_
32 1 PRIETO, Matías
* _baud_coding()_
33 1 PRIETO, Matías
* _baudTranslate()_
34 1 PRIETO, Matías
* _inc_pointer()_
35 1 PRIETO, Matías
36 1 PRIETO, Matías
Data buffers definition:
37 1 PRIETO, Matías
* _asciiCharBuf[RTTY_BUFFER_SIZE]_
38 1 PRIETO, Matías
* _rtty_buffer[2*RTTY_BUFFER_SIZE]_
39 1 PRIETO, Matías
40 1 PRIETO, Matías
Main system flags:
41 1 PRIETO, Matías
* _rts_flag_
42 1 PRIETO, Matías
* _cod_flag_
43 1 PRIETO, Matías
44 1 PRIETO, Matías
45 1 PRIETO, Matías
h3. Program workflow
46 1 PRIETO, Matías
47 1 PRIETO, Matías
Data coming from GPS is retrieved from the USART CSK_0 register. Since data is continuously sent character by character at a rate of 1 NMEA sentence per second, the _task_gps_update()_ have to filter the incoming characters waiting the right sequence which represents the start of a valid NMEA sentence. Then, characters must be stored in a buffer up to receive the end of sentence indicator character. The string stored in the ASCII buffer (_asciiCharBuf_) is the message that has be then sent to lower layers, representing the information held by the beacon. Optionally, an additional fixed messaged can be added to this buffer.
48 1 PRIETO, Matías
49 1 PRIETO, Matías
Once beacon message is defined, the task call the function _baud_coding()_, which maps the stored chars in the ASCII buffer to the Baudot alphabet. Finally, the output (the message in Baudot format) is stored in another buffer (_rtty_buffer_). This function, is supported by the function _baudTranslate()_, which is called for each character to perform a search and translation of symbols using a look-up table.
50 1 PRIETO, Matías
Once data in the Baudot buffer is ready, a ready to send flag (_rts_flag_) is set to indicate the task which manage L2-L1 that there is data available ready to be sent.
51 1 PRIETO, Matías
52 1 PRIETO, Matías
_task_rtty_phy()_ is in charge of controlling lower layers and generate the output signal (at _IO.0_) which controls the 2-FSK transmitter. This task runs continuously and has the highest priority.
53 1 PRIETO, Matías
54 1 PRIETO, Matías
Since a clock is required to generate the output signal, the task uses the OS timer. This timer is set to one tick per millisecond, this is 1000 ticks per second. Since baudrate is 125, the bit period $T_b$ is 8 msec and the task uses 8 OS ticks per bit.
55 1 PRIETO, Matías
56 1 PRIETO, Matías
Each bit period $T_b$, the task performs an iteration and retrieves the bit to be sent at L3. Then it implements Manchester by setting the output signal (at _IO.0_) at 0 (or 1) during $T_b/2$ and then switching to 1 (or 0) during other $T_b/2$.