EIVE System #376

Merged
muellerr merged 13 commits from eive_system into develop 2023-02-13 09:38:54 +01:00
6 changed files with 18 additions and 10 deletions
Showing only changes of commit 6521e419eb - Show all commits

View File

@ -75,7 +75,6 @@ int obsw::obsw() {
scheduling::initMission(); scheduling::initMission();
// Command the EIVE system to safe mode // Command the EIVE system to safe mode
/*
auto sysQueueId = satsystem::EIVE_SYSTEM.getCommandQueue(); auto sysQueueId = satsystem::EIVE_SYSTEM.getCommandQueue();
CommandMessage msg; CommandMessage msg;
ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, 0); ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, 0);
@ -84,7 +83,6 @@ int obsw::obsw() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "Sending safe mode command to EIVE system failed" << std::endl; sif::error << "Sending safe mode command to EIVE system failed" << std::endl;
} }
*/
for (;;) { for (;;) {
/* Suspend main thread by sleeping it. */ /* Suspend main thread by sleeping it. */

View File

@ -47,11 +47,11 @@ static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t RW_SPEED = 300'000; static constexpr uint32_t RW_SPEED = 300'000;
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
static constexpr dur_millis_t RTD_CS_TIMEOUT = 50; static constexpr dur_millis_t RTD_CS_TIMEOUT = 100;
static constexpr uint32_t RTD_SPEED = 2'000'000; static constexpr uint32_t RTD_SPEED = 2'000'000;
static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3;
static constexpr dur_millis_t SUS_CS_TIMEOUT = 50; static constexpr dur_millis_t SUS_CS_TIMEOUT = 100;
} // namespace spi } // namespace spi

2
fsfw

@ -1 +1 @@
Subproject commit 7fae6cbd6db588d69fc00198e4b2a9d8a7c12f59 Subproject commit 8b4f73a97b15f27e314932538d468707c57f965a

View File

@ -73,11 +73,12 @@ bool Max31865RtdReader::periodicInitHandling() {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs); ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != returnvalue::OK or mg.gpioResult != returnvalue::OK) { if (mg.lockResult != returnvalue::OK or mg.gpioResult != returnvalue::OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl; sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
break; continue;
} }
result = writeCfgReg(rtd->spiCookie, BASE_CFG); result = writeCfgReg(rtd->spiCookie, BASE_CFG);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeCfgReg"); handleSpiError(rtd, result, "writeCfgReg");
continue;
} }
if (rtd->writeLowThreshold) { if (rtd->writeLowThreshold) {
result = writeLowThreshold(rtd->spiCookie, rtd->lowThreshold); result = writeLowThreshold(rtd->spiCookie, rtd->lowThreshold);
@ -152,16 +153,22 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
if (rtdIsActive(rtd->idx)) { if (rtdIsActive(rtd->idx)) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != returnvalue::OK or mg.gpioResult != returnvalue::OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
continue;
}
uint16_t rtdVal = 0; uint16_t rtdVal = 0;
bool faultBitSet = false; bool faultBitSet = false;
result = writeCfgReg(rtd->spiCookie, BASE_CFG); result = writeCfgReg(rtd->spiCookie, BASE_CFG);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeCfgReg"); handleSpiError(rtd, result, "writeCfgReg");
continue;
} }
result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet); result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
handleSpiError(rtd, result, "readRtdVal"); handleSpiError(rtd, result, "readRtdVal");
return returnvalue::FAILED; continue;
} }
if (faultBitSet) { if (faultBitSet) {
rtd->db.faultBitSet = faultBitSet; rtd->db.faultBitSet = faultBitSet;

View File

@ -3,9 +3,11 @@
#include <fsfw/ipc/MutexIF.h> #include <fsfw/ipc/MutexIF.h>
#include <fsfw/tasks/ExecutableObjectIF.h> #include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/timemanager/clockDefinitions.h>
#include <fsfw_hal/linux/spi/SpiComIF.h> #include <fsfw_hal/linux/spi/SpiComIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h> #include <fsfw_hal/linux/spi/SpiCookie.h>
#include "devConf.h"
#include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h" #include "mission/devices/devicedefinitions/Max31865Definitions.h"
@ -50,8 +52,8 @@ class Max31865RtdReader : public SystemObject,
SpiComIF* comIF; SpiComIF* comIF;
GpioIF* gpioIF; GpioIF* gpioIF;
MutexIF::TimeoutType csTimeoutType = MutexIF::TimeoutType::BLOCKING; MutexIF::TimeoutType csTimeoutType = MutexIF::TimeoutType::WAITING;
uint32_t csTimeoutMs = 0; uint32_t csTimeoutMs = spi::RTD_CS_TIMEOUT;
MutexIF* csLock = nullptr; MutexIF* csLock = nullptr;
bool periodicInitHandling(); bool periodicInitHandling();

View File

@ -118,7 +118,8 @@ Subsystem& satsystem::acs::init() {
// Build SUS board transition // Build SUS board transition
iht(objects::SUS_BOARD_ASS, NML, 0, SUS_BOARD_NML_TRANS.second); iht(objects::SUS_BOARD_ASS, NML, 0, SUS_BOARD_NML_TRANS.second);
check(ACS_SUBSYSTEM.addTable(TableEntry(SUS_BOARD_NML_TRANS.first, &SUS_BOARD_NML_TRANS.second)), ctxc); check(ACS_SUBSYSTEM.addTable(TableEntry(SUS_BOARD_NML_TRANS.first, &SUS_BOARD_NML_TRANS.second)),
ctxc);
buildOffSequence(ACS_SUBSYSTEM, entry); buildOffSequence(ACS_SUBSYSTEM, entry);
buildSafeSequence(ACS_SUBSYSTEM, entry); buildSafeSequence(ACS_SUBSYSTEM, entry);