Software » History » Version 1

Version 1/44 - Next » - Current version
PRIETO, Matías, 03/22/2015 03:13 AM


Software Design

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.

Figure below presents the final implemented communication stack of the system as part of the communication chain design.

Communication stack
Communication stack.

Concepts

NMEA sentences

Manchester encoding

Overall program description

The Salvo OS is a multitask operative system, based on the definition of multiple tasks. Each task is implemented inside an infinite loop.

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.

Tasks, functions and main data structures description

Task and functions definition:
  • task_gps_update()
  • task_rtty_phy()
  • baud_coding()
  • baudTranslate()
  • inc_pointer()
Data buffers definition:
  • asciiCharBuf[RTTY_BUFFER_SIZE]
  • rtty_buffer[2*RTTY_BUFFER_SIZE]
Main system flags:
  • rts_flag
  • cod_flag

Program workflow

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.

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.
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.

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.

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.

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$.