Giter VIP home page Giter VIP logo

skylink's Introduction

Skylink

Skylink protocol is a point-to-point communication protocol designed for small satellite applications operating over radio amateur band. The protocol has been designed to facilitate an efficient and reliable packet transmission between a satellite and ground station over a narrowband half-duplex channel and can be used for example operating a small satellite.

The protocol implements for example features such as:

  • Four logical virtual channels for mission specific purposes
  • Windowed Time Division Duplexing (TDD)
  • Reliable data transfer using automatic retransmission (ARQ)
  • Uplink and downlink data authentication

More detailed protocol specification can found /docs/Skylink_protocol_Specification_v1.pdf.

This repository contains the protocol implementation, PC host application and various test scripts. The implementation (found from /src) is written in pure C and has been designed to run on memory limited microcontrollers in space.

The source code is available under LGPL license, see LICENSE for the license text.

Main authors: Petri Niemelä, Markus Hiltunen

Special thanks: Tatu Peltola, Baris Dinc

Building for PC

Skylink implementation itself doesn't depend on any external libraries. However, to run the implementation on a PC a hosting application is required to handle the communication between protocol and modem/radio and between protocol and user application. For this purpose, the PC build includes gs (ground station) application which interfaces with Suo Modem library and other user applications via ZMQ sockets.

Before starting the compiling process, the ZeroMQ library shall be installed on the system. For example from apt on Debian based distros.

$ sudo apt install libzmq3-dev

Also, download and install Suo Modem library according to its instructions. If the So library is installed to the system directories, the build system should be capable of locating it automatically. Otherwise, the location of the Suo git repository needs to be hinted to the Cmake by giving SUO_GIT define as shown in following instructions.

$ git clone https://github.com/aaltosatellite/skylink
$ mkdir build
$ cd build
$ cmake .. -DSUO_GIT='~/[yoursuopath]/suo'
$ make

This compiles the libskylink.so, gs application and various unit tests.

In the PC configuration, the software stack including Skylink can look for example like this: Skylink implemented in PC application

After this the compiled gs host application located in build/gs/gs and the suo modem application can be launched. The interfacing with Skylink's virtual channels over ZMQ sockets can be done for example using interface library scripts/vc_connector.py.

Including Skylink into an embedded application

Because no well standardized method for cross compiling libraries for embedded applications doesn't exist, the easiest method to include the Skylink implementation into a project is by symbolically linking the src folder under your project or by copying the whole src folder under the project. The Skylink project expects to find its includes located inside the src, so you need to add the Skylink implementation directory to the compiler's include directory listing.

In an embedded applications, the software architecture could look for example like this:

Skylink implemented in an embedded application

TODO: Example implementation.

Python parser

The python folder includes an (almost) independent parser for handling Skylink frames. The implementation can be used to parse and construct individual Skylink radio frames but it doesn't include the required logic to drive the protocol implementation in real-time for two-way communication.

skylink's People

Contributors

petrinm avatar viissataa avatar klauskivirikko avatar cheremk1 avatar barisdinc avatar felipetj avatar topiraty avatar aaltogroundstation avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar Tatu Peltola avatar Kirill Eliutin avatar Matti Manninen avatar  avatar

skylink's Issues

When filling a frame with a payload that is for some reason too large, the payload will be stuck in the ring as the tx_head.

When filling a frame with sky_vc_fill_frame() with arq on, it is checked if a payload fits in the remaining space of the frame. If the payload is too large for some reason or another error code is returned when the function stack reaches sky_element_buffer_store, the payload will be stuck in the ring as the first untransmitted package since tx_head and tx_sequence are not incremented. Incrementing these will also create problems for the reciever since there will be a sequence number that is missing since nothing is actually sent. If only tx_head is incremented, the placement of sequence numbers in the ring will be out of sync breaking functions like sendRing_can_recall.

In sky_vc_fill_frame:

skylink/src/reliable_vc.c

Lines 399 to 403 in 59d3e8d

} else {
/* If the payload for some reason is too large, remove is nonetheless. */
uint8_t tmp_tgt[300];
sendRing_read_to_tx(vchannel->sendRing, vchannel->elementBuffer, tmp_tgt, &sequence, 1);
}

Function where tx_head/sequence is updated:

skylink/src/sequence_ring.c

Lines 317 to 332 in 59d3e8d

static int sendRing_read_new_packet_to_tx_(SkySendRing* sendRing, SkyElementBuffer* elementBuffer, void* tgt, int* sequence) { //NEXT PACKET
*sequence = -1;
if (sendRing_count_packets_to_send(sendRing, 0) == 0) {
return SKY_RET_RING_EMPTY;
}
RingItem* item = &sendRing->buff[sendRing->tx_head];
int read = sky_element_buffer_read(elementBuffer, tgt, item->idx, SKY_MAX_PAYLOAD_LEN + 100);
if (read < 0) {
SKY_ASSERT(read > 0)
return read;
}
*sequence = sendRing->tx_sequence;
sendRing->tx_head = ring_wrap(sendRing->tx_head+1, sendRing->length);
sendRing->tx_sequence = wrap_sequence(sendRing->tx_sequence + 1);
return read;
}

Error returned:
int sky_element_buffer_read(SkyElementBuffer* buffer, uint8_t* target, idx_t idx, int32_t max_len){
BufferElement el = element_i(buffer, idx);
if(!element_is_first(buffer, el)){
return SKY_RET_EBUFFER_INVALID_INDEX;
}
//check if target buffer is long enough.
int32_t leng = *(pl_len_t*)(el.data);
if(leng > max_len){
return SKY_RET_EBUFFER_TOO_LONG_PAYLOAD;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.