that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-18 14:34:09 +01:00
parent 1fd5d065b6
commit 99e6ea6000
No known key found for this signature in database
GPG Key ID: FC76078F520434A5
7 changed files with 100 additions and 27 deletions

View File

@ -90,6 +90,8 @@ static constexpr char PAPB_BUSY_SIGNAL_VC2[] = "papb_busy_signal_vc2";
static constexpr char PAPB_EMPTY_SIGNAL_VC2[] = "papb_empty_signal_vc2";
static constexpr char PAPB_BUSY_SIGNAL_VC3[] = "papb_busy_signal_vc3";
static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3";
static constexpr char PTME_RESETN[] = "ptme_resetn";
static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872";
static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";

View File

@ -747,6 +747,9 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(CcsdsComponentArgs& args) {
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_BUSY, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, "PAPB VC3");
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::PTME_RESETN, "PTME RESETN",
gpio::Direction::OUT, gpio::Levels::HIGH);
gpioCookiePtmeIp->addGpio(gpioIds::PTME_RESETN, gpio);
gpioChecker(args.gpioComIF.addGpios(gpioCookiePtmeIp), "PTME PAPB VCs");
// Creating virtual channel interfaces
VirtualChannelIF* vc0 =
@ -771,9 +774,14 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(CcsdsComponentArgs& args) {
new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG);
PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig);
*args.ipCoreHandler = new CcsdsIpCoreHandler(
objects::CCSDS_HANDLER, objects::CCSDS_PACKET_DISTRIBUTOR, *ptmeConfig, LINK_STATE,
&args.gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA);
PtmeGpios gpios;
gpios.enableTxClock = gpioIds::RS485_EN_TX_CLOCK;
gpios.enableTxData = gpioIds::RS485_EN_TX_CLOCK;
gpios.ptmeResetn = gpioIds::PTME_RESETN;
*args.ipCoreHandler =
new CcsdsIpCoreHandler(objects::CCSDS_HANDLER, objects::CCSDS_PACKET_DISTRIBUTOR, *ptmeConfig,
LINK_STATE, &args.gpioComIF, gpios);
// This VC will receive all live TM
auto* vcWithQueue =
new VirtualChannelWithQueue(objects::PTME_VC0_LIVE_TM, ccsds::VC0, "PTME VC0 LIVE TM", *ptme,

View File

@ -102,6 +102,7 @@ enum gpioId_t {
VC2_PAPB_BUSY,
VC3_PAPB_EMPTY,
VC3_PAPB_BUSY,
PTME_RESETN,
PDEC_RESET,

View File

@ -1,6 +1,8 @@
#ifndef LINUX_OBC_PTMECONFIG_H_
#define LINUX_OBC_PTMECONFIG_H_
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include "AxiPtmeConfig.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/returnvalues/returnvalue.h"

View File

@ -14,7 +14,7 @@
CcsdsIpCoreHandler::CcsdsIpCoreHandler(object_id_t objectId, object_id_t tcDestination,
PtmeConfig& ptmeConfig, std::atomic_bool& linkState,
GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData)
GpioIF* gpioIF, PtmeGpios gpioIds)
: SystemObject(objectId),
linkState(linkState),
tcDestination(tcDestination),
@ -22,9 +22,8 @@ CcsdsIpCoreHandler::CcsdsIpCoreHandler(object_id_t objectId, object_id_t tcDesti
actionHelper(this, nullptr),
modeHelper(this),
ptmeConfig(ptmeConfig),
gpioIF(gpioIF),
enTxClock(enTxClock),
enTxData(enTxData) {
ptmeGpios(gpioIds),
gpioIF(gpioIF) {
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
eventQueue =
@ -71,6 +70,12 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
if (batPriorityParam == 0) {
disablePrioritySelectMode();
} else {
enablePrioritySelectMode();
}
#if OBSW_SYRLINKS_SIMULATED == 1
// Update data on rising edge
ptmeConfig.invertTxClock(false);
@ -111,7 +116,24 @@ ReturnValue_t CcsdsIpCoreHandler::getParameter(uint8_t domainId, uint8_t uniqueI
ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues,
uint16_t startAtIndex) {
return returnvalue::OK;
if ((domainId == 0) and (uniqueIdentifier == ParamId::BAT_PRIORITY)) {
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if (result != returnvalue::OK) {
return result;
}
if (newVal > 1) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(batPriorityParam);
if (mode == MODE_ON) {
updateBatPriorityOnTxOff = true;
} else if (mode == MODE_OFF) {
updateBatPriorityFromParam();
}
return returnvalue::OK;
}
return HasParametersIF::INVALID_IDENTIFIER_ID;
}
uint32_t CcsdsIpCoreHandler::getIdentifier() const { return 0; }
@ -184,8 +206,8 @@ void CcsdsIpCoreHandler::updateLinkState() { linkState = LINK_UP; }
void CcsdsIpCoreHandler::enableTransmit() {
#ifndef TE0720_1CFA
gpioIF->pullHigh(enTxClock);
gpioIF->pullHigh(enTxData);
gpioIF->pullHigh(ptmeGpios.enableTxClock);
gpioIF->pullHigh(ptmeGpios.enableTxData);
#endif
linkState = LINK_UP;
}
@ -212,9 +234,6 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod
void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
auto rateSet = [&](uint32_t rate) {
if (setBatPriorityBitOnTxEnable) {
ptmeConfig.enableBatPriorityBit(true);
}
ReturnValue_t result = ptmeConfig.setRate(rate);
if (result == returnvalue::OK) {
this->mode = HasModesIF::MODE_ON;
@ -249,10 +268,14 @@ void CcsdsIpCoreHandler::announceMode(bool recursive) { triggerEvent(MODE_INFO,
void CcsdsIpCoreHandler::disableTransmit() {
ptmeConfig.enableBatPriorityBit(false);
#ifndef TE0720_1CFA
gpioIF->pullLow(enTxClock);
gpioIF->pullLow(enTxData);
gpioIF->pullLow(ptmeGpios.enableTxClock);
gpioIF->pullLow(ptmeGpios.enableTxData);
#endif
linkState = LINK_DOWN;
if (updateBatPriorityOnTxOff) {
updateBatPriorityFromParam();
updateBatPriorityOnTxOff = false;
}
}
const char* CcsdsIpCoreHandler::getName() const { return "CCSDS Handler"; }
@ -268,3 +291,25 @@ ReturnValue_t CcsdsIpCoreHandler::connectModeTreeParent(HasModeTreeChildrenIF& p
ModeTreeChildIF& CcsdsIpCoreHandler::getModeTreeChildIF() { return *this; }
object_id_t CcsdsIpCoreHandler::getObjectId() const { return SystemObject::getObjectId(); }
void CcsdsIpCoreHandler::enablePrioritySelectMode() {
ptmeConfig.enableBatPriorityBit(true);
// Reset the PTME
gpioIF->pullLow(ptmeGpios.ptmeResetn);
gpioIF->pullHigh(ptmeGpios.ptmeResetn);
}
void CcsdsIpCoreHandler::disablePrioritySelectMode() {
ptmeConfig.enableBatPriorityBit(false);
// Reset the PTME
gpioIF->pullLow(ptmeGpios.ptmeResetn);
gpioIF->pullHigh(ptmeGpios.ptmeResetn);
}
void CcsdsIpCoreHandler::updateBatPriorityFromParam() {
if (batPriorityParam == 0) {
disablePrioritySelectMode();
} else {
enablePrioritySelectMode();
}
}

View File

@ -25,12 +25,25 @@
#include "linux/ipcore/PtmeConfig.h"
#include "mission/comDefs.h"
struct PtmeGpios {
gpioId_t enableTxClock = gpio::NO_GPIO;
gpioId_t enableTxData = gpio::NO_GPIO;
gpioId_t ptmeResetn = gpio::NO_GPIO;
};
/**
* @brief This class handles the data exchange with the CCSDS IP cores implemented in the
* programmable logic of the Q7S.
*
* @details After reboot default CADU bitrate is always set to 100 kbps (results in downlink rate
* of 200 kbps due to convolutional code added by syrlinks transceiver)
* @details
* After reboot default CADU bitrate is always set to 100 kbps (results in downlink rate
* of 200 kbps due to convolutional code added by syrlinks transceiver). The IP core handler exposes
* a parameter to enable the priority selection mode for the PTME core.
*
* If the transmitter is on, the selection mode will be enabled when the transmitter goes off.
* If the transmitter is off, the update of the PTME will be done immediately on a parameter update.
* This is done because changing this parameter requires a reset of the PTME core to avoid bugs
* while the transmitter is enabled.
*
* @author J. Meier
*/
@ -39,11 +52,12 @@ class CcsdsIpCoreHandler : public SystemObject,
public ModeTreeChildIF,
public ModeTreeConnectionIF,
public HasModesIF,
// public AcceptsTelemetryIF,
public AcceptsTelecommandsIF,
public ReceivesParameterMessagesIF,
public HasActionsIF {
public:
enum ParamId : uint8_t { BAT_PRIORITY = 0 };
static const bool LINK_UP = true;
static const bool LINK_DOWN = false;
using VcId_t = uint8_t;
@ -61,8 +75,7 @@ class CcsdsIpCoreHandler : public SystemObject,
* @param enTxData GPIO ID of RS485 tx data enable
*/
CcsdsIpCoreHandler(object_id_t objectId, object_id_t tcDestination, PtmeConfig& ptmeConfig,
std::atomic_bool& linkState, GpioIF* gpioIF, gpioId_t enTxClock,
gpioId_t enTxData);
std::atomic_bool& linkState, GpioIF* gpioIF, PtmeGpios gpioIds);
~CcsdsIpCoreHandler();
@ -138,16 +151,14 @@ class CcsdsIpCoreHandler : public SystemObject,
MessageQueueId_t tcDistributorQueueId = MessageQueueIF::NO_QUEUE;
PtmeConfig& ptmeConfig;
bool setBatPriorityBitOnTxEnable = true;
PtmeGpios ptmeGpios;
// BAT priority bit on by default to enable priority selection mode for the PTME.
uint8_t batPriorityParam = 1;
bool updateBatPriorityOnTxOff = false;
GpioIF* gpioIF = nullptr;
// GPIO to enable RS485 transceiver for TX clock
gpioId_t enTxClock = gpio::NO_GPIO;
// GPIO to enable RS485 transceiver for TX data signal
gpioId_t enTxData = gpio::NO_GPIO;
void readCommandQueue(void);
void handleTelemetry();
/**
* @brief Forward link state to virtual channels.
@ -164,6 +175,10 @@ class CcsdsIpCoreHandler : public SystemObject,
* RS485 transceiver chips to high.
*/
void disableTransmit();
void enablePrioritySelectMode();
void disablePrioritySelectMode();
void updateBatPriorityFromParam();
};
#endif /* CCSDSHANDLER_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 350e5d77b8113cc9e21eb72242fc37536368f541
Subproject commit e5a09e148b45d0380dc6d9a1a88002bab4b0376c