This is an implementation of a CCSDS compliant Transferframe and SpacePacket library for transferring telecommands from ground to the satellite and telemetry form satellite to the ground.
Also included is a wrapper class which makes the protocol very easy to use. This class basically only needs the spacecraft IDs as well as the two callback functions which are called when a complete telecommand packet is received or when a finalized telemetry packet is ready to be send.
The library is able to handle transfer frames which are sent in AD or BD mode.
It also supports the parsing of CLTUs, but since CLTUs are usually unpacked by hardware on real satellites, this option must be enabled in the config file. Furthermore, the maximum size of the space packets can be configured, depending on the configuration (and capabilities) of the target.
Transferframes (Telemetry):
Transferframes (Telecommand):
Space Packets:
This is a simple example to receive one telecomand. For more, see the arduino examples (*.ino) within the package.
#include "tmtc_client.h"
/* This callback is called when a valid telecommand is extracted from the uplink data stream. */
void TelecommandReceiveCallback(void *p_SpContext, const uint8_t u8_PacketType,
const uint8_t u8_SequenceFlags, const uint16_t u16_APID,
const uint16_t u16_SequenceCount, const bool b_SecHeader,
const uint8_t *pu8_PacketData, const uint16_t u16_PacketDataLength)
{
...
}
/* This callback is called when a telemetry package is finalized and can be sent. */
void SendTelemetryCallback(void *p_Context, const uint8_t *pu8_Data, const uint16_t u16_DataSize)
{
...
}
/* We need an instance of the TMTC client class. This can be created as global.
We also need an array which holds the spacecraft IDs which are accepted for telecommand reception. */
const uint16_t gu16_SpacecraftIDs[2] = { 0x25B, 0x25C };
TmTcClient g_TmTcClient(gu16_SpacecraftIDs, 2, NULL, &SendTelemetryCallback, NULL, &TelecommandReceiveCallback);
/* For this example, we need test data: Command TIM_NOP for Spacecraft 0x25C, ApplicationID 0x060; */
uint8_t gau8_TfTc[] =
{
0x22, 0x5c, 0x00, 0x1d, 0x00, 0xc1, 0x18,
0x60, 0xc0, 0x02, 0x00, 0x0f, 0x11, 0x80,
0x80, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xca,
0xca, 0x00, 0x00, 0x00, 0x01, 0x72, 0xf3,
0x7b, 0xea
};
void main(void)
{
/* process simulated incoming data from ground station (in this case hardcoded in gau8_TfTc) */
g_TmTcClient.setSync();
g_TmTcClient.processTfTc((uint8_t*)gau8_TfTc, sizeof(gau8_TfTc));
}
Version: 5.2
© 1996-2024 by Stefan Trippler (stef2024@[REM0VE]trippler.de)
Impressum