From 63965e2f6836cb54bbe14baa3f74671fb5100f59 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 21 Nov 2021 13:59:18 +0100 Subject: [PATCH] enabled rx lines of syrlinks rs485 transceiver chips --- bsp_q7s/boardconfig/busConf.h | 3 +++ bsp_q7s/core/ObjectFactory.cpp | 23 ++++++++++++++++++++++- linux/fsfwconfig/devices/gpioIds.h | 6 +++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index e68a1f19..af89d346 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -66,7 +66,10 @@ namespace gpioNames { static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3"; 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"; + static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872"; static constexpr char PDEC_RESET[] = "pdec_reset"; + static constexpr char BIT_RATE_SEL[] = "bit_rate_sel"; } } diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a64a1493..c7738679 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -79,6 +79,8 @@ #include #include #include +#include +#include ResetArgs resetArgsGnss0; ResetArgs resetArgsGnss1; @@ -937,8 +939,19 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { ptme->addVcInterface(ccsds::VC2, vc2); ptme->addVcInterface(ccsds::VC3, vc3); + GpioCookie* gpioCookieRateSetter = new GpioCookie; + consumer.str(""); + consumer << "ptme rate setter"; + // Init to low -> default bit rate is low bit rate (200 kbps in downlink with syrlinks) + gpio = new GpiodRegularByLineName(q7s::gpioNames::BIT_RATE_SEL, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookieRateSetter->addGpio(gpioIds::BIT_RATE_SEL, gpio); + gpioComIF->addGpios(gpioCookieRateSetter); + + TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(gpioIds::BIT_RATE_SEL, gpioComIF); + CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME, - objects::CCSDS_PACKET_DISTRIBUTOR); + objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF); VirtualChannel* vc = nullptr; vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE); @@ -973,6 +986,14 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { gpio::Direction::OUT, gpio::HIGH); gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio); + // Default configuration enables RX channels (RXEN = LOW) + gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver", + gpio::Direction::OUT, gpio::LOW); + gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_CLOCK, gpio); + gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver", + gpio::Direction::OUT, gpio::LOW); + gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio); + gpioComIF->addGpios(gpioRS485Chip); #endif /* BOARD_TE0720 == 0 */ } diff --git a/linux/fsfwconfig/devices/gpioIds.h b/linux/fsfwconfig/devices/gpioIds.h index 2fe715ea..8d3f94ca 100644 --- a/linux/fsfwconfig/devices/gpioIds.h +++ b/linux/fsfwconfig/devices/gpioIds.h @@ -104,7 +104,11 @@ enum gpioId_t { RS485_EN_TX_DATA, - RS485_EN_TX_CLOCK + RS485_EN_TX_CLOCK, + RS485_EN_RX_DATA, + RS485_EN_RX_CLOCK, + + BIT_RATE_SEL }; }