Merge branch 'mueller/plpcdu-sus-updates' into mueller/master
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2022-02-25 11:25:07 +01:00
commit 8a0757dcef
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 65 additions and 21 deletions

View File

@ -1,9 +1,10 @@
#include "ObjectFactory.h"
#include <linux/boardtest/I2cTestClass.h>
#include <linux/boardtest/UartTestClass.h>
#include <sstream>
#include <linux/obc/AxiPtmeConfig.h>
#include <linux/obc/PapbVcInterface.h>
#include <linux/obc/PdecHandler.h>
#include <linux/obc/Ptme.h>
#include <linux/obc/PtmeConfig.h>
#include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h"
@ -25,6 +26,20 @@
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "devices/powerSwitcherList.h"
#include "linux/boardtest/I2cTestClass.h"
#include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h"
#include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h"
#include "linux/devices/GPSHyperionLinuxController.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
#endif
#include <sstream>
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h"
@ -43,7 +58,6 @@
#include "linux/boardtest/SpiTestClass.h"
#include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h"
#include "linux/devices/GPSHyperionLinuxController.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/ACUHandler.h"
#include "mission/devices/BpxBatteryHandler.h"
@ -74,18 +88,6 @@
#include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/VirtualChannel.h"
#include "mission/utility/TmFunnel.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
#endif
#include <linux/obc/AxiPtmeConfig.h>
#include <linux/obc/PapbVcInterface.h>
#include <linux/obc/PdecHandler.h>
#include <linux/obc/Ptme.h>
#include <linux/obc/PtmeConfig.h>
ResetArgs resetArgsGnss0;
ResetArgs resetArgsGnss1;

View File

@ -1,3 +0,0 @@
target_sources(${OBSW_NAME} PRIVATE
gpioCallbacks.cpp
)

View File

@ -19,6 +19,7 @@ enum: uint8_t {
PLOC_MEMORY_DUMPER = 118,
PDEC_HANDLER = 119,
STR_HELPER = 120,
PL_PCDU_HANDLER = 121,
COMMON_SUBSYSTEM_ID_END
};
}

View File

@ -1,4 +1,5 @@
target_sources(${OBSW_NAME} PRIVATE
GPSHyperionLinuxController.cpp
)
if(EIVE_BUILD_GPSD_GPS_HANDLER)

View File

@ -214,6 +214,23 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
opDivider.setDivider(divider);
}
void PayloadPcduHandler::transitionBackToOff() {
States currentState = state;
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
state = States::PCDU_OFF;
adcState = AdcStates::OFF;
setMode(MODE_OFF);
// Notify FDIR
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
}
void PayloadPcduHandler::stateMachineToNormal() {
if (adcState == AdcStates::BOOT_DELAY) {
if (adcCountdown.hasTimedOut()) {

View File

@ -5,6 +5,7 @@
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include <fsfw/timemanager/Countdown.h>
#include "events/subsystemIdRanges.h"
#include "fsfw/FSFW.h"
#include "fsfw_hal/common/gpio/GpioIF.h"
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
@ -30,6 +31,10 @@ class SpiCookie;
*/
class PayloadPcduHandler : public DeviceHandlerBase {
public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PL_PCDU_HANDLER;
static constexpr Event TRANSITION_BACK_TO_OFF =
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF,
bool periodicPrintout);
@ -45,7 +50,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
#endif
private:
enum class States {
enum class States : uint8_t {
PCDU_OFF,
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
// the ADC
@ -93,6 +98,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
void doStartUp() override;
void doShutDown() override;
// Main FDIR function which goes from any PL PCDU state back to all off
void transitionBackToOff();
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
void fillCommandAndReplyMap() override;

View File

@ -12,6 +12,25 @@ namespace plpcdu {
using namespace max1227;
enum PlPcduAdcChannels : uint8_t {
U_BAT_DIV_6 = 0,
// According to schematic, will be 2.2158V for Vneg = +0V and 0.2446V for Vneg = -6V
// Full Forumula: V_neg = V_post - (R1 + R2) / R1 * (V_pos - V_out) with R1 being 27.4k
// and R2 being 49.9k
U_NEG_V_FB = 1,
I_HPA = 2,
U_HPA_DIV_6 = 3,
I_MPA = 4,
U_MPA_DIV_6 = 5,
I_TX = 6,
U_TX_DIV_6 = 7,
I_X8 = 8,
U_X8_DIV_6 = 9,
I_DRO = 10,
U_DRO_DIV_6 = 11,
NUM_CHANNELS = 12
};
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, TEMP = 1 };
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;