spi setup more stable now
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-05-14 11:34:25 +02:00
parent 1c9f411e75
commit 478975db26
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
14 changed files with 97 additions and 45 deletions

View File

@ -4,6 +4,8 @@
namespace q7s { namespace q7s {
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main"; static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main";
static constexpr uint32_t SPI_MAIN_BUS_LOCK_TIMEOUT = 50;
static constexpr char SPI_RW_DEV[] = "/dev/spi-rw"; static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive"; static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";

View File

@ -44,7 +44,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
GpioIF* gpioIF = comIf->getGpioInterface(); GpioIF* gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0; uint32_t timeoutMs = 0;
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs); MutexIF* mutex = comIf->getCsMutex();
cookie->getMutexParams(timeoutType, timeoutMs);
if (mutex == nullptr or gpioIF == nullptr) { if (mutex == nullptr or gpioIF == nullptr) {
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl; sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;

View File

@ -146,6 +146,12 @@ void initmission::initTasks() {
} }
#endif #endif
PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask(
"TCS_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = tcsPollingTask->addComponent(objects::SPI_RTD_COM_IF);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF);
}
PeriodicTaskIF* tcsTask = factory->createPeriodicTask( PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
"TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); "TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
std::array<object_id_t, EiveMax31855::NUM_RTDS> rtdIds = { std::array<object_id_t, EiveMax31855::NUM_RTDS> rtdIds = {
@ -273,6 +279,7 @@ void initmission::initTasks() {
acsTask->startTask(); acsTask->startTask();
sysTask->startTask(); sysTask->startTask();
tcsPollingTask->startTask();
tcsTask->startTask(); tcsTask->startTask();
#if OBSW_ADD_PLOC_SUPERVISOR == 1 #if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask(); supvHelperTask->startTask();

View File

@ -214,6 +214,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
SpiCookie* spiCookieRadSensor = SpiCookie* spiCookieRadSensor =
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, RAD_SENSOR::READ_SIZE, new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, RAD_SENSOR::READ_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
spiCookieRadSensor->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RAD_SENSOR_CS_TIMEOUT);
auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_MAIN_COM_IF, auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_MAIN_COM_IF,
spiCookieRadSensor, gpioComIF); spiCookieRadSensor, gpioComIF);
static_cast<void>(radSensor); static_cast<void>(radSensor);

View File

@ -31,6 +31,7 @@ static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000; static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000;
static constexpr spi::SpiModes SUS_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes SUS_MAX_1227_MODE = spi::SpiModes::MODE_3;
static constexpr dur_millis_t RAD_SENSOR_CS_TIMEOUT = 250;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
@ -42,6 +43,7 @@ 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 = 40;
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;

2
fsfw

@ -1 +1 @@
Subproject commit dba08fed7a00187ba204f46bc40424f7b87f3aea Subproject commit bcd19045cc9f19d9fd0b61f991cb334c6315832a

View File

@ -291,7 +291,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
bool useDirectHandler = false; bool useDirectHandler = false;
if (not useDirectHandler) { if (not useDirectHandler) {
// Create special low level reader communication interface // Create special low level reader communication interface
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF); new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
} }
auto directRtdsCreator = [&](uint8_t idx) { auto directRtdsCreator = [&](uint8_t idx) {
auto typedHandler = auto typedHandler =
@ -322,6 +322,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) { for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
rtdCookies[idx] = new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second, rtdCookies[idx] = new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second,
MAX31865::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); MAX31865::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
rtdCookies[idx]->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RTD_CS_TIMEOUT);
if (useDirectHandler) { if (useDirectHandler) {
directRtdsCreator(idx); directRtdsCreator(idx);
} else { } else {

View File

@ -1,9 +1,11 @@
#include "Max31865RtdLowlevelHandler.h" #include "Max31865RtdLowlevelHandler.h"
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <fsfw_hal/linux/spi/ManualCsLockGuard.h>
Max31865RtdReader::Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelComIF) Max31865RtdReader::Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelComIF, GpioIF* gpioIF)
: SystemObject(objectId), rtds(EiveMax31855::NUM_RTDS), comIF(lowLevelComIF) { : SystemObject(objectId), rtds(EiveMax31855::NUM_RTDS), comIF(lowLevelComIF), gpioIF(gpioIF) {
readerMutex = MutexFactory::instance()->createMutex(); readerMutex = MutexFactory::instance()->createMutex();
} }
@ -18,6 +20,7 @@ ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
void Max31865RtdReader::rtdMainLoop() { void Max31865RtdReader::rtdMainLoop() {
using namespace MAX31865; using namespace MAX31865;
// Stopwatch watch;
if (periodicInitHandling()) { if (periodicInitHandling()) {
// 10 ms delay for VBIAS startup // 10 ms delay for VBIAS startup
TaskFactory::delayTask(10); TaskFactory::delayTask(10);
@ -55,9 +58,15 @@ bool Max31865RtdReader::periodicInitHandling() {
} }
if ((rtd->on or rtd->active) and not rtd->configured) { if ((rtd->on or rtd->active) and not rtd->configured) {
if (rtd->cd.hasTimedOut()) { if (rtd->cd.hasTimedOut()) {
uint8_t cfg = (Bias::OFF << CfgBitPos::BIAS_SEL) | ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
(Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) | if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
(ConvMode::NORM_OFF << CfgBitPos::CONV_MODE); sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed"
<< std::endl;
break;
}
uint8_t cfg =
(Bias::OFF << CfgBitPos::BIAS_SEL) | (Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) |
(ConvMode::NORM_OFF << CfgBitPos::CONV_MODE) | (1 << CfgBitPos::FAULT_STATUS_CLEAR);
result = writeCfgReg(rtd->spiCookie, cfg); result = writeCfgReg(rtd->spiCookie, cfg);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
handleSpiError(rtd, result, "writeCfgReg"); handleSpiError(rtd, result, "writeCfgReg");
@ -97,6 +106,11 @@ bool Max31865RtdReader::periodicInitHandling() {
continue; continue;
} }
if (rtdIsActive(rtd->idx)) { if (rtdIsActive(rtd->idx)) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
break;
}
someRtdUsable = true; someRtdUsable = true;
result = writeBiasSel(Bias::ON, rtd->spiCookie); result = writeBiasSel(Bias::ON, rtd->spiCookie);
} }
@ -117,17 +131,24 @@ void Max31865RtdReader::periodicReadReqHandling() {
continue; continue;
} }
if (rtdIsActive(rtd->idx)) { if (rtdIsActive(rtd->idx)) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
break;
}
uint8_t currentCfg = 0; uint8_t currentCfg = 0;
auto result = readCfgReg(rtd->spiCookie, currentCfg); auto result = readCfgReg(rtd->spiCookie, currentCfg);
if (result != RETURN_OK) { if (result != RETURN_OK) {
handleSpiError(rtd, result, "readCfgReg"); handleSpiError(rtd, result, "readCfgReg");
continue; // Release mutex ASAP
break;
} }
currentCfg |= (1 << CfgBitPos::ONE_SHOT); currentCfg |= (1 << CfgBitPos::ONE_SHOT);
result = writeCfgReg(rtd->spiCookie, currentCfg); result = writeCfgReg(rtd->spiCookie, currentCfg);
if (result != RETURN_OK) { if (result != RETURN_OK) {
handleSpiError(rtd, result, "writeCfgReg"); handleSpiError(rtd, result, "writeCfgReg");
continue; // Release mutex ASAP
break;
} }
} }
} }
@ -147,6 +168,11 @@ void Max31865RtdReader::periodicReadHandling() {
continue; continue;
} }
if (rtdIsActive(rtd->idx)) { if (rtdIsActive(rtd->idx)) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
break;
}
uint16_t rtdVal = 0; uint16_t rtdVal = 0;
bool faultBitSet = false; bool faultBitSet = false;
result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet); result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet);
@ -167,6 +193,11 @@ void Max31865RtdReader::periodicReadHandling() {
// Even if a device was made inactive, turn off the bias here. If it was turned off, not // Even if a device was made inactive, turn off the bias here. If it was turned off, not
// necessary anymore.. // necessary anymore..
if (rtd->on) { if (rtd->on) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
break;
}
result = writeBiasSel(Bias::OFF, rtd->spiCookie); result = writeBiasSel(Bias::OFF, rtd->spiCookie);
} }
} }
@ -338,7 +369,7 @@ ReturnValue_t Max31865RtdReader::clearFaultStatus(SpiCookie* cookie) {
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
currentCfg |= (1 << CfgBitPos::FAULTY_STATUS_CLEAR); currentCfg |= (1 << CfgBitPos::FAULT_STATUS_CLEAR);
return writeCfgReg(cookie, currentCfg); return writeCfgReg(cookie, currentCfg);
} }
@ -446,3 +477,8 @@ ReturnValue_t Max31865RtdReader::handleSpiError(Max31865ReaderCookie* cookie, Re
<< std::endl; << std::endl;
return result; return result;
} }
ReturnValue_t Max31865RtdReader::initialize() {
csLock = comIF->getCsMutex();
return SystemObject::initialize();
}

View File

@ -38,9 +38,10 @@ class Max31865RtdReader : public SystemObject,
public ExecutableObjectIF, public ExecutableObjectIF,
public DeviceCommunicationIF { public DeviceCommunicationIF {
public: public:
Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelComIF); Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelComIF, GpioIF* gpioIF);
[[noreturn]] ReturnValue_t performOperation(uint8_t operationCode) override; [[noreturn]] ReturnValue_t performOperation(uint8_t operationCode) override;
ReturnValue_t initialize() override;
private: private:
std::vector<Max31865ReaderCookie*> rtds; std::vector<Max31865ReaderCookie*> rtds;
@ -48,6 +49,12 @@ class Max31865RtdReader : public SystemObject,
size_t dbLen = 0; size_t dbLen = 0;
MutexIF* readerMutex; MutexIF* readerMutex;
SpiComIF* comIF;
GpioIF* gpioIF;
MutexIF::TimeoutType csTimeoutType = MutexIF::TimeoutType::BLOCKING;
uint32_t csTimeoutMs = 0;
MutexIF* csLock = nullptr;
void rtdMainLoop(); void rtdMainLoop();
bool periodicInitHandling(); bool periodicInitHandling();
void periodicReadReqHandling(); void periodicReadReqHandling();
@ -75,8 +82,6 @@ class Max31865RtdReader : public SystemObject,
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override; ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
ReturnValue_t handleSpiError(Max31865ReaderCookie* cookie, ReturnValue_t result, const char* ctx); ReturnValue_t handleSpiError(Max31865ReaderCookie* cookie, ReturnValue_t result, const char* ctx);
SpiComIF* comIF;
}; };
#endif /* LINUX_DEVICES_MAX31865RTDREADER_H_ */ #endif /* LINUX_DEVICES_MAX31865RTDREADER_H_ */

View File

@ -64,13 +64,12 @@ ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length); static_cast<void>(length);
thisSequence->addSlot(objects::SPI_RTD_COM_IF, length * 0.0, 0);
#if OBSW_ADD_PL_PCDU == 1 #if OBSW_ADD_PL_PCDU == 1
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_ADD_TMP_DEVICES == 1 #if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
@ -83,27 +82,18 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#endif #endif
#if OBSW_ADD_TMP_DEVICES == 1 #if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::GET_WRITE);
#endif #endif
#if OBSW_ADD_TMP_DEVICES == 1 #if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_READ);
#endif #endif
#if OBSW_ADD_TMP_DEVICES == 1 #if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_RAD_SENSORS == 1
/* Radiation sensor */
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_ADD_SUN_SENSORS == 1 #if OBSW_ADD_SUN_SENSORS == 1
@ -371,6 +361,15 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
} }
#endif /* OBSW_ADD_SUN_SENSORS == 1 */ #endif /* OBSW_ADD_SUN_SENSORS == 1 */
#if OBSW_ADD_RAD_SENSORS == 1
/* Radiation sensor */
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 #if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1
bool enableAside = true; bool enableAside = true;
bool enableBside = true; bool enableBside = true;

View File

@ -424,7 +424,8 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
GpioIF *gpioIF = comIf->getGpioInterface(); GpioIF *gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0; uint32_t timeoutMs = 0;
MutexIF *mutex = comIf->getMutex(&timeoutType, &timeoutMs); MutexIF *mutex = comIf->getCsMutex();
cookie->getMutexParams(timeoutType, timeoutMs);
if (mutex == nullptr or gpioIF == nullptr) { if (mutex == nullptr or gpioIF == nullptr) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::spiSendCallback: " sif::warning << "GyroADIS16507Handler::spiSendCallback: "

View File

@ -9,6 +9,7 @@ Max31865EiveHandler::Max31865EiveHandler(object_id_t objectId, object_id_t comIF
} }
void Max31865EiveHandler::doStartUp() { void Max31865EiveHandler::doStartUp() {
updatePeriodicReply(true, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
if (state == InternalState::NONE or state == InternalState::INACTIVE) { if (state == InternalState::NONE or state == InternalState::INACTIVE) {
if (instantNormal) { if (instantNormal) {
state = InternalState::ACTIVE; state = InternalState::ACTIVE;
@ -27,6 +28,7 @@ void Max31865EiveHandler::doStartUp() {
} }
void Max31865EiveHandler::doShutDown() { void Max31865EiveHandler::doShutDown() {
updatePeriodicReply(false, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
if (state == InternalState::NONE or state == InternalState::ACTIVE or if (state == InternalState::NONE or state == InternalState::ACTIVE or
state == InternalState::ON) { state == InternalState::ON) {
state = InternalState::INACTIVE; state = InternalState::INACTIVE;
@ -107,7 +109,7 @@ void Max31865EiveHandler::fillCommandAndReplyMap() {
insertInCommandMap(EiveMax31855::RtdCommands::ON); insertInCommandMap(EiveMax31855::RtdCommands::ON);
insertInCommandMap(EiveMax31855::RtdCommands::ACTIVE); insertInCommandMap(EiveMax31855::RtdCommands::ACTIVE);
insertInCommandMap(EiveMax31855::RtdCommands::OFF); insertInCommandMap(EiveMax31855::RtdCommands::OFF);
insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 2, &sensorDataset, 0, true); insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 200, &sensorDataset, 0, true);
} }
ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t remainingSize,
@ -168,10 +170,4 @@ void Max31865EiveHandler::setDeviceInfo(uint8_t idx_, std::string location_) {
locString = std::move(location_); locString = std::move(location_);
} }
ReturnValue_t Max31865EiveHandler::initialize() { ReturnValue_t Max31865EiveHandler::initialize() { return DeviceHandlerBase::initialize(); }
auto result = DeviceHandlerBase::initialize();
if (result != RETURN_OK) {
return result;
}
return updatePeriodicReply(true, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
}

View File

@ -716,7 +716,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
GpioIF* gpioIF = comIf->getGpioInterface(); GpioIF* gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0; uint32_t timeoutMs = 0;
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs); MutexIF* mutex = comIf->getCsMutex();
if (mutex == nullptr or gpioIF == nullptr) { if (mutex == nullptr or gpioIF == nullptr) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::spiSendCallback: " sif::warning << "GyroADIS16507Handler::spiSendCallback: "
@ -727,6 +727,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
} }
if (gpioId != gpio::NO_GPIO) { if (gpioId != gpio::NO_GPIO) {
cookie->getMutexParams(timeoutType, timeoutMs);
result = mutex->lockMutex(timeoutType, timeoutMs); result = mutex->lockMutex(timeoutType, timeoutMs);
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -20,7 +20,7 @@ enum FilterSel : unsigned int { FIFTY_HERTZ = 1, SIXTY_HERTZ = 0 };
enum CfgBitPos { enum CfgBitPos {
FILTER_SEL = 0, FILTER_SEL = 0,
FAULTY_STATUS_CLEAR = 1, FAULT_STATUS_CLEAR = 1,
FDCC = 2, FDCC = 2,
WIRE_SEL = 4, WIRE_SEL = 4,
ONE_SHOT = 5, ONE_SHOT = 5,