MGM calibration fix #357

Merged
muellerr merged 13 commits from eggert/mgm-calibration-fix into develop 2023-02-08 13:02:41 +01:00
43 changed files with 628 additions and 110 deletions
Showing only changes of commit b8baca92e2 - Show all commits

View File

@ -17,6 +17,52 @@ change warranting a new major release:
# [unreleased]
## Fixed
- Bugfix in FSFW where the sequence flags of the PUS packets were set to continuation segment (0b00)
instead of unsegmented (0b11).
# [v1.23.0] 2023-02-01
TMTC version: v2.9.0
## Changed
- Bumped FSFW to include improvements and bugfix for Health Service. The health service now
supports the announce all health info command.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/725
## Fixed
- Bumped FSFW to include fixes in the time service.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/726
- The CCSDS handler starts the transmitter timer each time it is commanded to MODE_ON and times
out the timer when the handler is commanded to MODE_OFF
- If the timer is timed out the CCSDS handler will disable the TX clock which will cause the
syrlinks to got to standby mode
- PDEC handler now parses the FAR register also in interrupt mode
# [v1.22.1] 2023-01-30
## Changed
- Updated FSFW to include addition where the `SO_REUSEADDR` option is set
on the TCP server, which should improve its ergonomics.
# [v1.22.0] 2023-01-28
TMTC version: v2.6.1
## Added
- First COM subsystem implementation. It mirrors the Syrlinks mode/submodes but also takes
care of commanding the CCSDS handler. It expects the Syrlinks submodes as mode commands.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/358
- The CCSDS handler has has a new submode (3) to configure the default datarate.
- Default datarate parameter commanding moved to COM subsystem.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/358
# [v1.21.0] 2023-01-26
TMTC version: v2.5.0

View File

@ -10,7 +10,7 @@
cmake_minimum_required(VERSION 3.13)
set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 1)
set(OBSW_VERSION_MINOR_IF_GIT_FAILS 21)
set(OBSW_VERSION_MINOR_IF_GIT_FAILS 23)
set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
# set(CMAKE_VERBOSE TRUE)

View File

@ -44,12 +44,11 @@ ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);

View File

@ -48,6 +48,7 @@
#include "mission/system/objects/RwAssembly.h"
#include "mission/system/objects/TcsBoardAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/comModeTree.h"
#include "mission/system/tree/payloadModeTree.h"
#include "mission/system/tree/tcsModeTree.h"
#include "tmtc/pusIds.h"
@ -580,16 +581,17 @@ void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitc
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
auto* syrlinksUartCookie =
new SerialCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD,
new SerialCookie(objects::SYRLINKS_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD,
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
syrlinksUartCookie->setParityEven();
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER);
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HANDLER);
auto syrlinksHandler =
new SyrlinksHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
syrlinksHandler->setStartUpImmediately();
syrlinksHandler->connectModeTreeParent(satsystem::com::SUBSYSTEM);
#if OBSW_DEBUG_SYRLINKS == 1
syrlinksHandler->setDebugMode(true);
#endif
@ -800,6 +802,13 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF,
vc = new VirtualChannel(ccsds::VC3, config::VC3_QUEUE_SIZE, objects::CCSDS_HANDLER);
(*ipCoreHandler)->addVirtualChannel(ccsds::VC3, vc);
ReturnValue_t result = (*ipCoreHandler)->connectModeTreeParent(satsystem::com::SUBSYSTEM);
if (result != returnvalue::OK) {
sif::error
<< "ObjectFactory::createCcsdsComponents: Connecting COM subsystem to CCSDS handler failed"
<< std::endl;
}
GpioCookie* gpioCookiePdec = new GpioCookie;
consumer.str("");
consumer << "0x" << std::hex << objects::PDEC_HANDLER;

View File

@ -1,6 +1,7 @@
#include "scheduling.h"
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include <linux/scheduling.h>
#include <iostream>
@ -142,10 +143,14 @@ void scheduling::initTasks() {
#endif
#endif
#if OBSW_ADD_CCSDS_IP_CORES == 1
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
PeriodicTaskIF* comTask = factory->createPeriodicTask(
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
result = comTask->addComponent(objects::COM_SUBSYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("COM subsystem", objects::COM_SUBSYSTEM);
}
#if OBSW_ADD_CCSDS_IP_CORES == 1
result = comTask->addComponent(objects::CCSDS_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
@ -380,8 +385,8 @@ void scheduling::initTasks() {
#endif
#endif
comTask->startTask();
#if OBSW_ADD_CCSDS_IP_CORES == 1
ccsdsHandlerTask->startTask();
pdecHandlerTask->startTask();
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */

View File

@ -14,6 +14,7 @@
#include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "mission/core/GenericFactory.h"
#include "mission/system/tree/comModeTree.h"
void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics();
@ -108,4 +109,5 @@ void ObjectFactory::produce(void* args) {
pcdu::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
#endif
createAcsController(true);
satsystem::com::init();
}

View File

@ -117,7 +117,9 @@ enum commonObjects : uint32_t {
SUS_5_N_LOC_XFYMZB_PT_ZB = 0x44120037,
SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043,
SYRLINKS_HK_HANDLER = 0x445300A3,
SYRLINKS_HANDLER = 0x445300A3,
// might be obsolete, was not used in Q7S FM SW
// CCSDS_IP_CORE_BRIDGE = 0x73500000,
/* 0x49 ('I') for Communication Interfaces */
SPI_RTD_COM_IF = 0x49020006,
@ -142,6 +144,8 @@ enum commonObjects : uint32_t {
ACS_SUBSYSTEM = 0x73010001,
PL_SUBSYSTEM = 0x73010002,
TCS_SUBSYSTEM = 0x73010003,
COM_SUBSYSTEM = 0x73010004,
TM_FUNNEL = 0x73000100,
PUS_TM_FUNNEL = 0x73000101,
CFDP_TM_FUNNEL = 0x73000102,

View File

@ -41,7 +41,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER);
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addSyrlinksDummies) {
new SyrlinksDummy(objects::SYRLINKS_HK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new SyrlinksDummy(objects::SYRLINKS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
}
new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addPowerDummies) {

2
fsfw

@ -1 +1 @@
Subproject commit 049e3b431da51ac2069c2d48c5715bb12f3234bc
Subproject commit 01cc619e67b84cef514b045377771ff1e11caf80

View File

@ -76,7 +76,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
7903;0x1edf;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
7905;0x1ee1;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
8900;0x22c4;CLOCK_SET;INFO;;fsfw/src/fsfw/pus/Service9TimeManagement.h
8901;0x22c5;CLOCK_SET_FAILURE;LOW;;fsfw/src/fsfw/pus/Service9TimeManagement.h
8901;0x22c5;CLOCK_DUMP;INFO;;fsfw/src/fsfw/pus/Service9TimeManagement.h
8902;0x22c6;CLOCK_SET_FAILURE;LOW;;fsfw/src/fsfw/pus/Service9TimeManagement.h
9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
9700;0x25e4;TEST;INFO;;fsfw/src/fsfw/pus/Service17Test.h
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
76 7903 0x1edf BIT_LOCK_LOST INFO A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
77 7905 0x1ee1 FRAME_PROCESSING_FAILED LOW The CCSDS Board could not interpret a TC fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
78 8900 0x22c4 CLOCK_SET INFO fsfw/src/fsfw/pus/Service9TimeManagement.h
79 8901 0x22c5 CLOCK_DUMP INFO fsfw/src/fsfw/pus/Service9TimeManagement.h
80 8902 0x22c6 CLOCK_SET_FAILURE LOW fsfw/src/fsfw/pus/Service9TimeManagement.h
81 8902 9100 0x22c6 0x238c CLOCK_SET_FAILURE TC_DELETION_FAILED LOW MEDIUM Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID fsfw/src/fsfw/pus/Service9TimeManagement.h fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
82 9100 9700 0x238c 0x25e4 TC_DELETION_FAILED TEST MEDIUM INFO Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID fsfw/src/fsfw/pus/Service11TelecommandScheduling.h fsfw/src/fsfw/pus/Service17Test.h
83 9700 10600 0x25e4 0x2968 TEST CHANGE_OF_SETUP_PARAMETER INFO LOW fsfw/src/fsfw/pus/Service17Test.h fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h

View File

@ -72,7 +72,7 @@
0x44420029;RTD_13_IC16_PLPCDU_HEATSPREADER
0x44420030;RTD_14_IC17_TCS_BOARD
0x44420031;RTD_15_IC18_IMTQ
0x445300A3;SYRLINKS_HK_HANDLER
0x445300A3;SYRLINKS_HANDLER
0x49000000;ARDUINO_COM_IF
0x49010005;GPIO_IF
0x49010006;SCEX_UART_READER
@ -147,5 +147,6 @@
0x73010001;ACS_SUBSYSTEM
0x73010002;PL_SUBSYSTEM
0x73010003;TCS_SUBSYSTEM
0x73010004;COM_SUBSYSTEM
0x73500000;CCSDS_IP_CORE_BRIDGE
0xFFFFFFFF;NO_OBJECT

1 0x00005060 P60DOCK_TEST_TASK
72 0x44420029 RTD_13_IC16_PLPCDU_HEATSPREADER
73 0x44420030 RTD_14_IC17_TCS_BOARD
74 0x44420031 RTD_15_IC18_IMTQ
75 0x445300A3 SYRLINKS_HANDLER
76 0x49000000 ARDUINO_COM_IF
77 0x49010005 GPIO_IF
78 0x49010006 SCEX_UART_READER
147 0x73010001 ACS_SUBSYSTEM
148 0x73010002 PL_SUBSYSTEM
149 0x73010003 TCS_SUBSYSTEM
150 0x73010004 COM_SUBSYSTEM
151 0x73010004 0x73500000 COM_SUBSYSTEM CCSDS_IP_CORE_BRIDGE
152 0x73500000 0xFFFFFFFF CCSDS_IP_CORE_BRIDGE NO_OBJECT

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 243 translations.
* @brief Auto-generated event translation file. Contains 244 translations.
* @details
* Generated on: 2023-01-26 19:42:47
* Generated on: 2023-02-01 19:42:11
*/
#include "translateEvents.h"
@ -82,6 +82,7 @@ const char *BIT_LOCK_STRING = "BIT_LOCK";
const char *BIT_LOCK_LOST_STRING = "BIT_LOCK_LOST";
const char *FRAME_PROCESSING_FAILED_STRING = "FRAME_PROCESSING_FAILED";
const char *CLOCK_SET_STRING = "CLOCK_SET";
const char *CLOCK_DUMP_STRING = "CLOCK_DUMP";
const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE";
const char *TC_DELETION_FAILED_STRING = "TC_DELETION_FAILED";
const char *TEST_STRING = "TEST";
@ -401,6 +402,8 @@ const char *translateEvents(Event event) {
case (8900):
return CLOCK_SET_STRING;
case (8901):
return CLOCK_DUMP_STRING;
case (8902):
return CLOCK_SET_FAILURE_STRING;
case (9100):
return TC_DELETION_FAILED_STRING;

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 151 translations.
* Generated on: 2023-01-26 19:42:47
* Contains 152 translations.
* Generated on: 2023-02-01 19:42:11
*/
#include "translateObjects.h"
@ -80,7 +80,7 @@ const char *RTD_12_IC15_ACU_STRING = "RTD_12_IC15_ACU";
const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPREADER";
const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD";
const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ";
const char *SYRLINKS_HK_HANDLER_STRING = "SYRLINKS_HK_HANDLER";
const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *GPIO_IF_STRING = "GPIO_IF";
const char *SCEX_UART_READER_STRING = "SCEX_UART_READER";
@ -155,6 +155,7 @@ const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM";
const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM";
const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM";
const char *TCS_SUBSYSTEM_STRING = "TCS_SUBSYSTEM";
const char *COM_SUBSYSTEM_STRING = "COM_SUBSYSTEM";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -309,7 +310,7 @@ const char *translateObject(object_id_t object) {
case 0x44420031:
return RTD_15_IC18_IMTQ_STRING;
case 0x445300A3:
return SYRLINKS_HK_HANDLER_STRING;
return SYRLINKS_HANDLER_STRING;
case 0x49000000:
return ARDUINO_COM_IF_STRING;
case 0x49010005:
@ -458,6 +459,8 @@ const char *translateObject(object_id_t object) {
return PL_SUBSYSTEM_STRING;
case 0x73010003:
return TCS_SUBSYSTEM_STRING;
case 0x73010004:
return COM_SUBSYSTEM_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0xFFFFFFFF:

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 243 translations.
* @brief Auto-generated event translation file. Contains 244 translations.
* @details
* Generated on: 2023-01-26 19:42:47
* Generated on: 2023-02-01 19:42:11
*/
#include "translateEvents.h"
@ -82,6 +82,7 @@ const char *BIT_LOCK_STRING = "BIT_LOCK";
const char *BIT_LOCK_LOST_STRING = "BIT_LOCK_LOST";
const char *FRAME_PROCESSING_FAILED_STRING = "FRAME_PROCESSING_FAILED";
const char *CLOCK_SET_STRING = "CLOCK_SET";
const char *CLOCK_DUMP_STRING = "CLOCK_DUMP";
const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE";
const char *TC_DELETION_FAILED_STRING = "TC_DELETION_FAILED";
const char *TEST_STRING = "TEST";
@ -401,6 +402,8 @@ const char *translateEvents(Event event) {
case (8900):
return CLOCK_SET_STRING;
case (8901):
return CLOCK_DUMP_STRING;
case (8902):
return CLOCK_SET_FAILURE_STRING;
case (9100):
return TC_DELETION_FAILED_STRING;

View File

@ -39,8 +39,6 @@ enum sourceObjects : uint32_t {
FW_ADDRESS_END = TIME_STAMPER,
PUS_SERVICE_6 = 0x51000500,
CCSDS_IP_CORE_BRIDGE = 0x73500000,
/* 0x49 ('I') for Communication Interfaces **/
ARDUINO_COM_IF = 0x49000000,
CSP_COM_IF = 0x49050001,

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 151 translations.
* Generated on: 2023-01-26 19:42:47
* Contains 152 translations.
* Generated on: 2023-02-01 19:42:11
*/
#include "translateObjects.h"
@ -80,7 +80,7 @@ const char *RTD_12_IC15_ACU_STRING = "RTD_12_IC15_ACU";
const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPREADER";
const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD";
const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ";
const char *SYRLINKS_HK_HANDLER_STRING = "SYRLINKS_HK_HANDLER";
const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *GPIO_IF_STRING = "GPIO_IF";
const char *SCEX_UART_READER_STRING = "SCEX_UART_READER";
@ -155,6 +155,7 @@ const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM";
const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM";
const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM";
const char *TCS_SUBSYSTEM_STRING = "TCS_SUBSYSTEM";
const char *COM_SUBSYSTEM_STRING = "COM_SUBSYSTEM";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -309,7 +310,7 @@ const char *translateObject(object_id_t object) {
case 0x44420031:
return RTD_15_IC18_IMTQ_STRING;
case 0x445300A3:
return SYRLINKS_HK_HANDLER_STRING;
return SYRLINKS_HANDLER_STRING;
case 0x49000000:
return ARDUINO_COM_IF_STRING;
case 0x49010005:
@ -458,6 +459,8 @@ const char *translateObject(object_id_t object) {
return PL_SUBSYSTEM_STRING;
case 0x73010003:
return TCS_SUBSYSTEM_STRING;
case 0x73010004:
return COM_SUBSYSTEM_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0xFFFFFFFF:

View File

@ -487,12 +487,11 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
static_cast<void>(length);
#if OBSW_ADD_SYRLINKS == 1
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_STAR_TRACKER == 1

View File

@ -34,7 +34,7 @@ class PdecConfig {
static const uint8_t VIRTUAL_CHANNEL = 0;
static const uint8_t RESERVED_FIELD_A = 0;
static const uint16_t SPACECRAFT_ID = 0x274;
static const uint16_t SPACECRAFT_ID = 0x3DC;
static const uint16_t DUMMY_BITS = 0;
// Parameters to control the FARM for AD frames
// Set here for future use

View File

@ -188,6 +188,7 @@ ReturnValue_t PdecHandler::irqOperation() {
if ((pisr & NEW_FAR_MASK) == NEW_FAR_MASK) {
// Read FAR here
CURRENT_FAR = readFar();
checkFrameAna(CURRENT_FAR);
}
if (lockCheckCd.hasTimedOut()) {
checkLocks();

View File

@ -7,3 +7,4 @@ add_subdirectory(tmtc)
add_subdirectory(system)
add_subdirectory(csp)
add_subdirectory(cfdp)
add_subdirectory(config)

View File

@ -9,6 +9,23 @@ enum class Datarate : uint8_t {
NUM_DATARATES
};
}
enum Submode : uint8_t {
RX_ONLY,
RX_AND_TX_DEFAULT_DATARATE,
RX_AND_TX_LOW_DATARATE,
RX_AND_TX_HIGH_DATARATE,
RX_AND_TX_CW,
NUM_SUBMODES
};
enum class CcsdsSubmode : uint8_t {
UNSET = 0,
DATARATE_LOW = 1,
DATARATE_HIGH = 2,
DATARATE_DEFAULT = 3
};
enum class ParameterId : uint8_t { DATARATE = 0 };
} // namespace com
#endif /* MISSION_COMDEFS_H_ */

View File

@ -0,0 +1 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE comCfg.cpp torquer.cpp)

26
mission/config/comCfg.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "comCfg.h"
#include <fsfw/ipc/MutexFactory.h>
#include <fsfw/ipc/MutexGuard.h>
com::Datarate DATARATE_CFG_RAW = com::Datarate::LOW_RATE_MODULATION_BPSK;
MutexIF* DATARATE_LOCK = nullptr;
MutexIF* lazyLock();
com::Datarate com::getCurrentDatarate() {
MutexGuard mg(lazyLock());
return DATARATE_CFG_RAW;
}
void com::setCurrentDatarate(com::Datarate newRate) {
MutexGuard mg(lazyLock());
DATARATE_CFG_RAW = newRate;
}
MutexIF* lazyLock() {
if (DATARATE_LOCK == nullptr) {
return MutexFactory::instance()->createMutex();
}
return DATARATE_LOCK;
}

15
mission/config/comCfg.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef MISSION_COMCFG_H_
#define MISSION_COMCFG_H_
#include <fsfw/ipc/MutexIF.h>
#include "mission/comDefs.h"
namespace com {
com::Datarate getCurrentDatarate();
void setCurrentDatarate(com::Datarate newRate);
} // namespace com
#endif /* MISSION_COMCFG_H_ */

View File

@ -2,7 +2,7 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "mission/devices/torquer.h"
#include "mission/config/torquer.h"
AcsController::AcsController(object_id_t objectId)
: ExtendedControllerBase(objectId),

View File

@ -746,7 +746,7 @@ void ThermalController::copyDevices() {
{
lp_var_t<float> tempSyrlinksPowerAmplifier =
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER);
lp_var_t<float>(objects::SYRLINKS_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER);
PoolReadGuard pg(&tempSyrlinksPowerAmplifier, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature"
@ -761,7 +761,7 @@ void ThermalController::copyDevices() {
{
lp_var_t<float> tempSyrlinksBasebandBoard =
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
lp_var_t<float>(objects::SYRLINKS_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
PoolReadGuard pg(&tempSyrlinksBasebandBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature"

View File

@ -8,7 +8,7 @@
#include <fsfw/internalerror/InternalErrorReporter.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/pus/CService200ModeCommanding.h>
#include <fsfw/pus/CService201HealthCommanding.h>
#include <fsfw/pus/CServiceHealthCommanding.h>
#include <fsfw/pus/Service17Test.h>
#include <fsfw/pus/Service1TelecommandVerification.h>
#include <fsfw/pus/Service20ParameterManagement.h>
@ -108,7 +108,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
auto tcpBridge = new TcpTmTcBridge(objects::TCP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR);
auto tcpServer = new TcpTmTcServer(objects::TCP_TMTC_POLLING_TASK, objects::TCP_TMTC_SERVER);
TcpTmTcServer::TcpConfig cfg(true, true);
auto tcpServer = new TcpTmTcServer(objects::TCP_TMTC_POLLING_TASK, objects::TCP_TMTC_SERVER, cfg);
// TCP is stream based. Use packet ID as start marker when parsing for space packets
tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID, common::CFDP_PACKET_ID});
sif::info << "Created TCP server for TMTC commanding with listener port "
@ -161,8 +162,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
pus::PUS_SERVICE_20);
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, config::EIVE_PUS_APID,
pus::PUS_SERVICE_200, 8);
new CService201HealthCommanding(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID,
pus::PUS_SERVICE_201);
HealthServiceCfg healthCfg(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID, *healthTable, 20);
new CServiceHealthCommanding(healthCfg);
#if OBSW_ADD_CFDP_COMPONENTS == 1
using namespace cfdp;

View File

@ -20,7 +20,6 @@ target_sources(
SusHandler.cpp
PayloadPcduHandler.cpp
SolarArrayDeploymentHandler.cpp
ScexDeviceHandler.cpp
torquer.cpp)
ScexDeviceHandler.cpp)
add_subdirectory(devicedefinitions)

View File

@ -25,7 +25,7 @@
#include <cmath>
#include <fsfw/datapoollocal/LocalPoolVariable.tpp>
#include "mission/devices/torquer.h"
#include "mission/config/torquer.h"
static constexpr bool ACTUATION_WIRETAPPING = false;

View File

@ -3,6 +3,7 @@
#include <mission/devices/SyrlinksHandler.h>
#include "OBSWConfig.h"
#include "mission/config/comCfg.h"
SyrlinksHandler::SyrlinksHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch, FailureIsolationBase* customFdir)
@ -621,7 +622,7 @@ void SyrlinksHandler::parseAgcHighByte(const uint8_t* packet) {
void SyrlinksHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t SyrlinksHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1500; }
uint32_t SyrlinksHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 2500; }
ReturnValue_t SyrlinksHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
@ -685,7 +686,7 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
}
case (syrlinks::SET_TX_MODE_MODULATION):
case (syrlinks::SET_TX_MODE_CW): {
triggerEvent(syrlinks::TX_ON, getSubmode(), datarateCfgRaw);
triggerEvent(syrlinks::TX_ON, getSubmode(), static_cast<uint8_t>(com::getCurrentDatarate()));
break;
}
}
@ -694,7 +695,7 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
ReturnValue_t SyrlinksHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
if (mode == HasModesIF::MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) {
if (submode >= syrlinks::Submode::NUM_SUBMODES) {
if (submode >= com::Submode::NUM_SUBMODES) {
return HasModesIF::INVALID_SUBMODE;
}
return returnvalue::OK;
@ -706,18 +707,6 @@ ReturnValue_t SyrlinksHandler::getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues,
uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) {
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if (result != returnvalue::OK) {
return result;
}
if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(datarateCfgRaw);
return returnvalue::OK;
}
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
startAtIndex);
}
@ -772,36 +761,36 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
};
if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) {
switch (getSubmode()) {
case (syrlinks::Submode::RX_AND_TX_DEFAULT_DATARATE): {
if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK)) {
case (com::Submode::RX_AND_TX_DEFAULT_DATARATE): {
auto currentDatarate = com::getCurrentDatarate();
if (currentDatarate == com::Datarate::LOW_RATE_MODULATION_BPSK) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
} else if (datarateCfgRaw ==
static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) {
} else if (currentDatarate == com::Datarate::HIGH_RATE_MODULATION_0QPSK) {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}
}
break;
}
case (syrlinks::Submode::RX_AND_TX_LOW_DATARATE): {
case (com::Submode::RX_AND_TX_LOW_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
break;
}
case (syrlinks::Submode::RX_AND_TX_HIGH_DATARATE): {
case (com::Submode::RX_AND_TX_HIGH_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}
break;
}
case (syrlinks::Submode::RX_ONLY): {
case (com::Submode::RX_ONLY): {
txStandbyHandler();
return;
}
case (syrlinks::Submode::RX_AND_TX_CW): {
case (com::Submode::RX_AND_TX_CW): {
if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false;

View File

@ -104,9 +104,6 @@ class SyrlinksHandler : public DeviceHandlerBase {
syrlinks::TemperatureSet temperatureSet;
const power::Switch_t powerSwitch = power::NO_SWITCH;
// Use uint8_t for compatibility with parameter interface
uint8_t datarateCfgRaw = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
// com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
bool debugMode = false;
uint8_t agcValueHighByte = 0;

View File

@ -8,15 +8,6 @@ namespace syrlinks {
enum class ParameterId : uint8_t { DATARATE = 0 };
enum Submode {
RX_ONLY,
RX_AND_TX_DEFAULT_DATARATE,
RX_AND_TX_LOW_DATARATE,
RX_AND_TX_HIGH_DATARATE,
RX_AND_TX_CW,
NUM_SUBMODES
};
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);

View File

@ -1,5 +1,48 @@
#include "ComSubsystem.h"
#include <fsfw/ipc/MutexGuard.h>
#include "mission/config/comCfg.h"
ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
uint32_t maxNumberOfTables)
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {}
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables), paramHelper(this) {
com::setCurrentDatarate(com::Datarate::LOW_RATE_MODULATION_BPSK);
}
MessageQueueId_t ComSubsystem::getCommandQueue() const { return Subsystem::getCommandQueue(); }
ReturnValue_t ComSubsystem::getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::DATARATE))) {
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if (result != returnvalue::OK) {
return result;
}
if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(datarateCfg);
com::setCurrentDatarate(static_cast<com::Datarate>(newVal));
return returnvalue::OK;
}
return returnvalue::OK;
}
ReturnValue_t ComSubsystem::handleCommandMessage(CommandMessage *message) {
ReturnValue_t result = paramHelper.handleParameterMessage(message);
if (result == returnvalue::OK) {
return result;
}
return Subsystem::handleCommandMessage(message);
}
ReturnValue_t ComSubsystem::initialize() {
ReturnValue_t result = paramHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
return Subsystem::initialize();
}

View File

@ -1,13 +1,29 @@
#ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_
#define MISSION_SYSTEM_COMSUBSYSTEM_H_
#include <fsfw/parameters/HasParametersIF.h>
#include <fsfw/parameters/ParameterHelper.h>
#include <fsfw/subsystem/Subsystem.h>
class ComSubsystem : public Subsystem {
#include "mission/comDefs.h"
class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
public:
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables);
virtual ~ComSubsystem() = default;
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
uint16_t startAtIndex) override;
private:
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
ReturnValue_t initialize() override;
uint8_t datarateCfg = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
ParameterHelper paramHelper;
};
#endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */

View File

@ -1,2 +1,4 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE acsModeTree.cpp payloadModeTree.cpp
tcsModeTree.cpp system.cpp util.cpp)
target_sources(
${LIB_EIVE_MISSION}
PRIVATE acsModeTree.cpp payloadModeTree.cpp comModeTree.cpp tcsModeTree.cpp
system.cpp util.cpp)

View File

@ -0,0 +1,281 @@
#include "comModeTree.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/modes/HasModesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/subsystem/Subsystem.h>
#include "eive/objects.h"
#include "mission/comDefs.h"
#include "util.h"
const auto check = subsystem::checkInsert;
ComSubsystem satsystem::com::SUBSYSTEM = ComSubsystem(objects::COM_SUBSYSTEM, 12, 24);
static const auto OFF = HasModesIF::MODE_OFF;
static const auto ON = HasModesIF::MODE_ON;
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
auto COM_SEQUENCE_RX_ONLY =
std::make_pair(::com::Submode::RX_ONLY, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TGT =
std::make_pair((::com::Submode::RX_ONLY << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TRANS_0 =
std::make_pair((::com::Submode::RX_ONLY << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TRANS_1 =
std::make_pair((::com::Submode::RX_ONLY << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_SEQUENCE_RX_AND_TX_LOW_RATE =
std::make_pair(::com::Submode::RX_AND_TX_LOW_DATARATE, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT = std::make_pair(
(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 = std::make_pair(
(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_SEQUENCE_RX_AND_TX_HIGH_RATE =
std::make_pair(::com::Submode::RX_AND_TX_HIGH_DATARATE, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE =
std::make_pair(::com::Submode::RX_AND_TX_DEFAULT_DATARATE, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT = std::make_pair(
(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0 = std::make_pair(
(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
namespace {
void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxDefaultRateSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
void satsystem::com::init() {
ModeListEntry entry;
buildRxOnlySequence(SUBSYSTEM, entry);
buildTxAndRxLowRateSequence(SUBSYSTEM, entry);
buildTxAndRxHighRateSequence(SUBSYSTEM, entry);
buildTxAndRxDefaultRateSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(NML, ::com::Submode::RX_ONLY);
}
namespace {
void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildRxOnlySequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Build RX Only table. We could track the state of the CCSDS IP core handler
// as well but I do not think this is necessary because enabling that should
// not intefere with the Syrlinks Handler.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_ONLY, COM_TABLE_RX_ONLY_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_ONLY_TGT.first, &COM_TABLE_RX_ONLY_TGT.second)), ctxc);
// Build RX Only transition 0
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_ONLY, COM_TABLE_RX_ONLY_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_ONLY_TRANS_0.first, &COM_TABLE_RX_ONLY_TRANS_0.second)),
ctxc);
// Build RX Only transition 1
iht(objects::CCSDS_HANDLER, OFF, 0, COM_TABLE_RX_ONLY_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_ONLY_TRANS_1.first, &COM_TABLE_RX_ONLY_TRANS_1.second)),
ctxc);
// Build TX OFF sequence
ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_0.first, 0, false);
ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_ONLY.first, &COM_SEQUENCE_RX_ONLY.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc);
}
void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxAndRxLowRateSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Build RX and TX low datarate table.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_LOW_DATARATE,
COM_TABLE_RX_AND_TX_LOW_RATE_TGT.second);
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_LOW),
COM_TABLE_RX_AND_TX_LOW_RATE_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_LOW_RATE_TGT.first,
&COM_TABLE_RX_AND_TX_LOW_RATE_TGT.second)),
ctxc);
// Build TX and RX low datarate transition 0, switch CCSDS handler first
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_LOW),
COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.second)),
ctxc);
// Build TX and RX low transition 1
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_LOW_DATARATE,
COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.first,
&COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.second)),
ctxc);
// Build TX and RX low datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.first, 0, false);
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_LOW_RATE.first,
&COM_SEQUENCE_RX_AND_TX_LOW_RATE.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc);
}
void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxAndRxHighRateSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Build RX and TX high datarate table.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second);
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH),
COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second)),
ctxc);
// Build TX and RX high datarate transition 0, switch CCSDS handler first
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH),
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second)),
ctxc);
// Build TX and RX high transition 1
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second)),
ctxc);
// Build TX and RX low datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second, COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second, COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.first, 0,
false);
ihs(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second, COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.first, 0,
false);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.first,
&COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc);
}
void buildTxAndRxDefaultRateSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxAndRxDefaultRateSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Build RX and TX default datarate table.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_DEFAULT_DATARATE,
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.second);
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_DEFAULT),
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.first,
&COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.second)),
ctxc);
// Build TX and RX low datarate transition 0, switch CCSDS handler first
iht(objects::CCSDS_HANDLER, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_DEFAULT),
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.second)),
ctxc);
// Build TX and RX default transition 1
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_DEFAULT_DATARATE,
COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.first,
&COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.second)),
ctxc);
// Build TX and RX default datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second, COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT.first, 0,
true);
ihs(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second, COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0.first, 0,
false);
ihs(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second, COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1.first, 0,
false);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first,
&COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc);
}
} // namespace

View File

@ -0,0 +1,16 @@
#ifndef MISSION_SYSTEM_TREE_COMMODETREE_H_
#define MISSION_SYSTEM_TREE_COMMODETREE_H_
#include <mission/system/objects/ComSubsystem.h>
namespace satsystem {
namespace com {
extern ComSubsystem SUBSYSTEM;
void init();
} // namespace com
} // namespace satsystem
#endif /* MISSION_SYSTEM_TREE_COMMODETREE_H_ */

View File

@ -1,6 +1,7 @@
#include "system.h"
#include "acsModeTree.h"
#include "comModeTree.h"
#include "payloadModeTree.h"
#include "tcsModeTree.h"
@ -8,4 +9,5 @@ void satsystem::init() {
acs::init();
pl::init();
tcs::init();
com::init();
}

View File

@ -1,7 +1,9 @@
#include "CcsdsIpCoreHandler.h"
#include <fsfw/subsystem/helper.h>
#include <linux/ipcore/PdecHandler.h>
#include <linux/ipcore/PtmeConfig.h>
#include <mission/config/comCfg.h>
#include "eive/definitions.h"
#include "fsfw/events/EventManagerIF.h"
@ -133,10 +135,12 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
transmitterCountdown.setTimeout(transmitterTimeout);
transmitterCountdown.timeOut();
#if OBSW_SYRLINKS_SIMULATED == 1
// Update data on rising edge
ptmeConfig->invertTxClock(false);
transmitterCountdown.setTimeout(transmitterTimeout);
linkState = UP;
forwardLinkstate();
#endif /* OBSW_SYRLINKS_SIMULATED == 1*/
@ -228,12 +232,12 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
ReturnValue_t result = returnvalue::OK;
switch (actionId) {
case SET_LOW_RATE: {
submode = static_cast<Submode_t>(Submode::DATARATE_LOW);
submode = static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW);
result = ptmeConfig->setRate(RATE_100KBPS);
break;
}
case SET_HIGH_RATE: {
submode = static_cast<Submode_t>(Submode::DATARATE_HIGH);
submode = static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH);
result = ptmeConfig->setRate(RATE_500KBPS);
break;
}
@ -346,6 +350,9 @@ void CcsdsIpCoreHandler::enableTransmit() {
gpioIF->pullHigh(enTxClock);
gpioIF->pullHigh(enTxData);
#endif
linkState = UP;
forwardLinkstate();
transmitterCountdown.resetTimer();
}
void CcsdsIpCoreHandler::checkTxTimer() {
@ -354,6 +361,7 @@ void CcsdsIpCoreHandler::checkTxTimer() {
}
if (transmitterCountdown.hasTimedOut()) {
disableTransmit();
//TODO: set mode to off (move timer to subsystem)
}
}
@ -365,8 +373,9 @@ void CcsdsIpCoreHandler::getMode(Mode_t* mode, Submode_t* submode) {
ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {
if (mode == HasModesIF::MODE_ON) {
if (submode != static_cast<Submode_t>(Submode::DATARATE_HIGH) and
submode != static_cast<Submode_t>(Submode::DATARATE_LOW)) {
if (submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH) and
submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW) and
submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_DEFAULT)) {
return HasModesIF::INVALID_SUBMODE;
}
} else if (mode != HasModesIF::MODE_OFF) {
@ -377,24 +386,40 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod
}
void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
auto rateHigh = [&]() {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) {
this->mode = HasModesIF::MODE_ON;
}
};
auto rateLow = [&]() {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) {
this->mode = HasModesIF::MODE_ON;
}
};
if (mode == HasModesIF::MODE_ON) {
enableTransmit();
if (submode == static_cast<Submode_t>(Submode::DATARATE_HIGH)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
}
} else if (submode == static_cast<Submode_t>(Submode::DATARATE_LOW)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_DEFAULT)) {
com::Datarate currentDatarate = com::getCurrentDatarate();
if (currentDatarate == com::Datarate::LOW_RATE_MODULATION_BPSK) {
rateLow();
} else if (currentDatarate == com::Datarate::HIGH_RATE_MODULATION_0QPSK) {
rateHigh();
}
} else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH)) {
rateHigh();
} else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) {
rateLow();
}
} else if (mode == HasModesIF::MODE_OFF) {
disableTransmit();
mode = HasModesIF::MODE_OFF;
this->mode = HasModesIF::MODE_OFF;
}
this->submode = submode;
modeHelper.modeChanged(mode, submode);
announceMode(false);
}
void CcsdsIpCoreHandler::announceMode(bool recursive) { triggerEvent(MODE_INFO, mode, submode); }
@ -406,7 +431,19 @@ void CcsdsIpCoreHandler::disableTransmit() {
#endif
linkState = DOWN;
forwardLinkstate();
transmitterCountdown.setTimeout(0);
transmitterCountdown.timeOut();
}
const char* CcsdsIpCoreHandler::getName() const { return "CCSDS Handler"; }
const HasHealthIF* CcsdsIpCoreHandler::getOptHealthIF() const { return nullptr; }
const HasModesIF& CcsdsIpCoreHandler::getModeIF() const { return *this; }
ReturnValue_t CcsdsIpCoreHandler::connectModeTreeParent(HasModeTreeChildrenIF& parent) {
return modetree::connectModeTreeParent(parent, *this, nullptr, modeHelper);
}
ModeTreeChildIF& CcsdsIpCoreHandler::getModeTreeChildIF() { return *this; }
object_id_t CcsdsIpCoreHandler::getObjectId() const { return SystemObject::getObjectId(); }

View File

@ -15,6 +15,7 @@
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/parameters/ParameterHelper.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/subsystem/ModeTreeConnectionIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/timemanager/Countdown.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
@ -22,8 +23,7 @@
#include "fsfw_hal/common/gpio/GpioIF.h"
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
#include "linux/ipcore/PtmeConfig.h"
enum class Submode : uint8_t { UNSET = 0, DATARATE_LOW = 1, DATARATE_HIGH = 2 };
#include "mission/comDefs.h"
/**
* @brief This class handles the data exchange with the CCSDS IP cores implemented in the
@ -36,6 +36,8 @@ enum class Submode : uint8_t { UNSET = 0, DATARATE_LOW = 1, DATARATE_HIGH = 2 };
*/
class CcsdsIpCoreHandler : public SystemObject,
public ExecutableObjectIF,
public ModeTreeChildIF,
public ModeTreeConnectionIF,
public HasModesIF,
public AcceptsTelemetryIF,
public AcceptsTelecommandsIF,
@ -92,6 +94,11 @@ class CcsdsIpCoreHandler : public SystemObject,
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size);
const HasHealthIF* getOptHealthIF() const override;
const HasModesIF& getModeIF() const override;
object_id_t getObjectId() const override;
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
ModeTreeChildIF& getModeTreeChildIF() override;
private:
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER;
@ -139,7 +146,7 @@ class CcsdsIpCoreHandler : public SystemObject,
ActionHelper actionHelper;
Mode_t mode = HasModesIF::MODE_OFF;
Submode_t submode = static_cast<Submode_t>(Submode::UNSET);
Submode_t submode = static_cast<Submode_t>(com::CcsdsSubmode::UNSET);
ModeHelper modeHelper;
MessageQueueId_t tcDistributorQueueId = MessageQueueIF::NO_QUEUE;

2
tmtc

@ -1 +1 @@
Subproject commit 8b6039e15d6e1653fd9128b7d2c7991e5bee9588
Subproject commit c633893df43030bb26b8422604b569bf8419d454