Merge pull request 'meier/coreHk' (#181) from meier/coreHk into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #181 Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
commit
e8ced3c4c4
@ -23,3 +23,4 @@ add_subdirectory(core)
|
|||||||
add_subdirectory(memory)
|
add_subdirectory(memory)
|
||||||
add_subdirectory(callbacks)
|
add_subdirectory(callbacks)
|
||||||
add_subdirectory(devices)
|
add_subdirectory(devices)
|
||||||
|
add_subdirectory(xadc)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <bsp_q7s/core/CoreController.h>
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
|
#include <bsp_q7s/xadc/Xadc.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <gps.h>
|
#include <gps.h>
|
||||||
#include <libgpsmm.h>
|
#include <libgpsmm.h>
|
||||||
@ -23,6 +24,7 @@ Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
|||||||
doTestSdCard = false;
|
doTestSdCard = false;
|
||||||
doTestScratchApi = false;
|
doTestScratchApi = false;
|
||||||
doTestGps = false;
|
doTestGps = false;
|
||||||
|
doTestXadc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Q7STestTask::performOneShotAction() {
|
ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||||
@ -44,6 +46,9 @@ ReturnValue_t Q7STestTask::performPeriodicAction() {
|
|||||||
if (doTestGps) {
|
if (doTestGps) {
|
||||||
testGpsDaemon();
|
testGpsDaemon();
|
||||||
}
|
}
|
||||||
|
if (doTestXadc) {
|
||||||
|
xadcTest();
|
||||||
|
}
|
||||||
return TestTask::performPeriodicAction();
|
return TestTask::performPeriodicAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,3 +400,53 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::xadcTest() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
float temperature = 0;
|
||||||
|
float vccPint = 0;
|
||||||
|
float vccPaux = 0;
|
||||||
|
float vccInt = 0;
|
||||||
|
float vccAux = 0;
|
||||||
|
float vccBram = 0;
|
||||||
|
float vccOddr = 0;
|
||||||
|
float vrefp = 0;
|
||||||
|
float vrefn = 0;
|
||||||
|
Xadc xadc;
|
||||||
|
result = xadc.getTemperature(temperature);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccPint(vccPint);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccPaux(vccPaux);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccInt(vccInt);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccAux(vccAux);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccBram(vccBram);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccOddr(vccOddr);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVrefp(vrefp);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVrefn(vrefn);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ class Q7STestTask : public TestTask {
|
|||||||
bool doTestSdCard = false;
|
bool doTestSdCard = false;
|
||||||
bool doTestScratchApi = false;
|
bool doTestScratchApi = false;
|
||||||
bool doTestGps = false;
|
bool doTestGps = false;
|
||||||
|
bool doTestXadc = false;
|
||||||
|
|
||||||
CoreController* coreController = nullptr;
|
CoreController* coreController = nullptr;
|
||||||
ReturnValue_t performOneShotAction() override;
|
ReturnValue_t performOneShotAction() override;
|
||||||
@ -24,6 +25,7 @@ class Q7STestTask : public TestTask {
|
|||||||
|
|
||||||
void testSdCard();
|
void testSdCard();
|
||||||
void fileTests();
|
void fileTests();
|
||||||
|
void xadcTest();
|
||||||
|
|
||||||
void testScratchApi();
|
void testScratchApi();
|
||||||
void testJsonLibDirect();
|
void testJsonLibDirect();
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#else
|
#else
|
||||||
#include "fsfw/osal/common/TcpTmTcServer.h"
|
#include "fsfw/osal/common/TcpTmTcServer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -21,12 +20,13 @@
|
|||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
|
#include "bsp_q7s/xadc/Xadc.h"
|
||||||
|
|
||||||
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
|
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
|
||||||
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
|
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
|
||||||
|
|
||||||
CoreController::CoreController(object_id_t objectId)
|
CoreController::CoreController(object_id_t objectId)
|
||||||
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5) {
|
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5), hkSet(this) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
try {
|
try {
|
||||||
result = initWatchdogFifo();
|
result = initWatchdogFifo();
|
||||||
@ -60,14 +60,23 @@ void CoreController::performControlOperation() {
|
|||||||
performWatchdogControlOperation();
|
performWatchdogControlOperation();
|
||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
performMountedSdCardOperations();
|
performMountedSdCardOperations();
|
||||||
|
readHkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
|
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
|
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
|
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) { return nullptr; }
|
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
|
||||||
|
if (sid.ownerSetId == core::HK_SET_ID) {
|
||||||
|
return &hkSet;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initialize() {
|
ReturnValue_t CoreController::initialize() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -104,6 +113,7 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
|||||||
setenv("PATH", updatedEnvPath.c_str(), true);
|
setenv("PATH", updatedEnvPath.c_str(), true);
|
||||||
updateProtInfo();
|
updateProtInfo();
|
||||||
initPrint();
|
initPrint();
|
||||||
|
ExtendedControllerBase::initializeAfterTaskCreation();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1645,3 +1655,37 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C
|
|||||||
}
|
}
|
||||||
rewriteRebootFile(rebootFile);
|
rewriteRebootFile(rebootFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CoreController::readHkData() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
result = hkSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Xadc xadc;
|
||||||
|
result = xadc.getTemperature(hkSet.temperature.value);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
hkSet.temperature.setValid(false);
|
||||||
|
} else {
|
||||||
|
hkSet.temperature.setValid(true);
|
||||||
|
}
|
||||||
|
result = xadc.getVccPint(hkSet.psVoltage.value);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
hkSet.psVoltage.setValid(false);
|
||||||
|
} else {
|
||||||
|
hkSet.psVoltage.setValid(true);
|
||||||
|
}
|
||||||
|
result = xadc.getVccInt(hkSet.plVoltage.value);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
hkSet.plVoltage.setValid(false);
|
||||||
|
} else {
|
||||||
|
hkSet.plVoltage.setValid(true);
|
||||||
|
}
|
||||||
|
#if OBSW_PRINT_CORE_HK == 1
|
||||||
|
hkSet.printSet();
|
||||||
|
#endif /* OBSW_PRINT_CORE_HK == 1 */
|
||||||
|
result = hkSet.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||||
|
#include "CoreDefinitions.h"
|
||||||
|
|
||||||
class Timer;
|
class Timer;
|
||||||
class SdCardManager;
|
class SdCardManager;
|
||||||
@ -120,6 +121,8 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
bool sdInitFinished() const;
|
bool sdInitFinished() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
||||||
|
static constexpr uint32_t MUTEX_TIMEOUT = 20;
|
||||||
// Designated value for rechecking FIFO open
|
// Designated value for rechecking FIFO open
|
||||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||||
int watchdogFifoFd = 0;
|
int watchdogFifoFd = 0;
|
||||||
@ -181,6 +184,8 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
std::array<bool, 4> protArray;
|
std::array<bool, 4> protArray;
|
||||||
PeriodicOperationDivider opDivider;
|
PeriodicOperationDivider opDivider;
|
||||||
|
|
||||||
|
core::HkSet hkSet;
|
||||||
|
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
@ -220,6 +225,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||||
bool parseRebootFile(std::string path, RebootFile& file);
|
bool parseRebootFile(std::string path, RebootFile& file);
|
||||||
void rewriteRebootFile(RebootFile file);
|
void rewriteRebootFile(RebootFile file);
|
||||||
|
void readHkData();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||||
|
44
bsp_q7s/core/CoreDefinitions.h
Normal file
44
bsp_q7s/core/CoreDefinitions.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
|
||||||
|
#define BSP_Q7S_CORE_COREDEFINITIONS_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||||
|
|
||||||
|
namespace core {
|
||||||
|
|
||||||
|
static const uint8_t HK_SET_ENTRIES = 3;
|
||||||
|
static const uint32_t HK_SET_ID = 5;
|
||||||
|
|
||||||
|
enum PoolIds {
|
||||||
|
TEMPERATURE,
|
||||||
|
PS_VOLTAGE,
|
||||||
|
PL_VOLTAGE
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set storing OBC internal housekeeping data
|
||||||
|
*/
|
||||||
|
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
|
||||||
|
|
||||||
|
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
|
||||||
|
|
||||||
|
// On-chip temperature
|
||||||
|
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId, PoolIds::TEMPERATURE, this);
|
||||||
|
// Processing system VCC
|
||||||
|
lp_var_t<float> psVoltage = lp_var_t<float>(sid.objectId, PoolIds::PS_VOLTAGE, this);
|
||||||
|
// Programmable logic VCC
|
||||||
|
lp_var_t<float> plVoltage = lp_var_t<float>(sid.objectId, PoolIds::PL_VOLTAGE, this);
|
||||||
|
|
||||||
|
void printSet() {
|
||||||
|
sif::info << "HkSet::printSet: On-chip temperature: " << this->temperature
|
||||||
|
<< " °C" << std::endl;
|
||||||
|
sif::info << "HkSet::printSet: PS voltage: " << this->psVoltage << " mV" << std::endl;
|
||||||
|
sif::info << "HkSet::printSet: PL voltage: " << this->plVoltage << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */
|
3
bsp_q7s/xadc/CMakeLists.txt
Normal file
3
bsp_q7s/xadc/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
Xadc.cpp
|
||||||
|
)
|
144
bsp_q7s/xadc/Xadc.cpp
Normal file
144
bsp_q7s/xadc/Xadc.cpp
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
#include "Xadc.h"
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
|
Xadc::Xadc() {}
|
||||||
|
|
||||||
|
Xadc::~Xadc() {}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getTemperature(float& temperature) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
int raw = 0;
|
||||||
|
int offset = 0;
|
||||||
|
float scale = 0;
|
||||||
|
result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
temperature = (raw + offset) * scale / 1000;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVccPint(float& vccPint) {
|
||||||
|
ReturnValue_t result =
|
||||||
|
readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVccPaux(float& vccPaux) {
|
||||||
|
ReturnValue_t result =
|
||||||
|
readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVccInt(float& vccInt) {
|
||||||
|
ReturnValue_t result =
|
||||||
|
readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVccAux(float& vccAux) {
|
||||||
|
ReturnValue_t result =
|
||||||
|
readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVccBram(float& vccBram) {
|
||||||
|
ReturnValue_t result =
|
||||||
|
readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVccOddr(float& vccOddr) {
|
||||||
|
ReturnValue_t result =
|
||||||
|
readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVrefp(float& vrefp) {
|
||||||
|
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::getVrefn(float& vrefn) {
|
||||||
|
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile,
|
||||||
|
float& voltage) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
float raw = 0;
|
||||||
|
float scale = 0;
|
||||||
|
result = readValFromFile(rawFile.c_str(), raw);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = readValFromFile(scaleFile.c_str(), scale);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
voltage = calculateVoltage(raw, scale);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Xadc::calculateVoltage(int raw, float scale) { return static_cast<float>(raw * scale); }
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
||||||
|
FILE* fp;
|
||||||
|
fp = fopen(filename, "r");
|
||||||
|
if (fp == nullptr) {
|
||||||
|
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
char valstring[MAX_STR_LENGTH] = "";
|
||||||
|
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
|
||||||
|
if (returnVal == nullptr) {
|
||||||
|
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
|
||||||
|
<< std::endl;
|
||||||
|
fclose(fp);
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
std::istringstream valSstream(valstring);
|
||||||
|
valSstream >> val;
|
||||||
|
fclose(fp);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
107
bsp_q7s/xadc/Xadc.h
Normal file
107
bsp_q7s/xadc/Xadc.h
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
#ifndef BSP_Q7S_XADC_XADC_H_
|
||||||
|
#define BSP_Q7S_XADC_XADC_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
|
namespace xadc {
|
||||||
|
using namespace std;
|
||||||
|
static const string iioPath = "/sys/bus/iio/devices/iio:device1";
|
||||||
|
namespace file {
|
||||||
|
static const string tempOffset = iioPath + "/in_temp0_offset";
|
||||||
|
static const string tempRaw = iioPath + "/in_temp0_raw";
|
||||||
|
static const string tempScale = iioPath + "/in_temp0_scale";
|
||||||
|
static const string vccintRaw = iioPath + "/in_voltage0_vccint_raw";
|
||||||
|
static const string vccintScale = iioPath + "/in_voltage0_vccint_scale";
|
||||||
|
static const string vccauxRaw = iioPath + "/in_voltage1_vccaux_raw";
|
||||||
|
static const string vccauxScale = iioPath + "/in_voltage1_vccaux_scale";
|
||||||
|
static const string vccbramRaw = iioPath + "/in_voltage2_vccbram_raw";
|
||||||
|
static const string vccbramScale = iioPath + "/in_voltage2_vccbram_scale";
|
||||||
|
static const string vccpintRaw = iioPath + "/in_voltage3_vccpint_raw";
|
||||||
|
static const string vccpintScale = iioPath + "/in_voltage3_vccpint_scale";
|
||||||
|
static const string vccpauxRaw = iioPath + "/in_voltage4_vccpaux_raw";
|
||||||
|
static const string vccpauxScale = iioPath + "/in_voltage4_vccpaux_scale";
|
||||||
|
static const string vccoddrRaw = iioPath + "/in_voltage5_vccoddr_raw";
|
||||||
|
static const string vccoddrScale = iioPath + "/in_voltage5_vccoddr_scale";
|
||||||
|
static const string vrefpRaw = iioPath + "/in_voltage6_vrefp_raw";
|
||||||
|
static const string vrefpScale = iioPath + "/in_voltage6_vrefp_scale";
|
||||||
|
static const string vrefnRaw = iioPath + "/in_voltage7_vrefn_raw";
|
||||||
|
static const string vrefnScale = iioPath + "/in_voltage7_vrefn_scale";
|
||||||
|
} // namespace file
|
||||||
|
} // namespace xadc
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Class providing access to the data generated by the analog mixed signal module (XADC).
|
||||||
|
*
|
||||||
|
* @details Details about the XADC peripheral of the Zynq-7020 can be found in the UG480 "7-Series
|
||||||
|
* FPGAs and Zynq-7000 SoC XADC Dual 12-Bit 1 MSPS Analog-to-Digital Converter" user guide
|
||||||
|
* from Xilinx.
|
||||||
|
*
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class Xadc {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*/
|
||||||
|
Xadc();
|
||||||
|
virtual ~Xadc();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns on-chip temperature degree celcius
|
||||||
|
*/
|
||||||
|
ReturnValue_t getTemperature(float& temperature);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns PS internal logic supply voltage in millivolts
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVccPint(float& vccPint);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns PS auxiliary supply voltage in millivolts
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVccPaux(float& vccPaux);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns PL internal supply voltage in millivolts
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVccInt(float& vccInt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns PL auxiliary supply voltage in millivolts
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVccAux(float& vccAux);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns PL block RAM supply voltage in millivolts
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVccBram(float& vccBram);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the PS DDR I/O supply voltage
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVccOddr(float& vcOddr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns XADC reference input voltage relative to GND in millivolts
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVrefp(float& vrefp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns negative reference input voltage. Should normally be 0 V.
|
||||||
|
*/
|
||||||
|
ReturnValue_t getVrefn(float& vrefn);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Maximum length of the string representation of a value in a xadc sysfs file
|
||||||
|
static const uint8_t MAX_STR_LENGTH = 15;
|
||||||
|
|
||||||
|
ReturnValue_t readVoltageFromSysfs(std::string rawFile, std::string scaleFile, float& voltage);
|
||||||
|
|
||||||
|
float calculateVoltage(int raw, float scale);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
ReturnValue_t readValFromFile(const char* filename, T& val);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_XADC_XADC_H_ */
|
@ -34,11 +34,13 @@ debugging. */
|
|||||||
//! All of this should be enabled for mission code!
|
//! All of this should be enabled for mission code!
|
||||||
#if defined XIPHOS_Q7S
|
#if defined XIPHOS_Q7S
|
||||||
|
|
||||||
|
#define Q7S_EM 0
|
||||||
|
|
||||||
#define OBSW_USE_CCSDS_IP_CORE 1
|
#define OBSW_USE_CCSDS_IP_CORE 1
|
||||||
// Set to 1 if all telemetry should be sent to the PTME IP Core
|
// Set to 1 if all telemetry should be sent to the PTME IP Core
|
||||||
#define OBSW_TM_TO_PTME 0
|
#define OBSW_TM_TO_PTME 1
|
||||||
// Set to 1 if telecommands are received via the PDEC IP Core
|
// Set to 1 if telecommands are received via the PDEC IP Core
|
||||||
#define OBSW_TC_FROM_PDEC 0
|
#define OBSW_TC_FROM_PDEC 1
|
||||||
|
|
||||||
#define OBSW_ENABLE_TIMERS 1
|
#define OBSW_ENABLE_TIMERS 1
|
||||||
#define OBSW_ADD_MGT 1
|
#define OBSW_ADD_MGT 1
|
||||||
@ -59,6 +61,7 @@ debugging. */
|
|||||||
#define OBSW_SYRLINKS_SIMULATED 1
|
#define OBSW_SYRLINKS_SIMULATED 1
|
||||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||||
#define OBSW_ENABLE_PERIODIC_HK 0
|
#define OBSW_ENABLE_PERIODIC_HK 0
|
||||||
|
#define OBSW_PRINT_CORE_HK 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
|
|
||||||
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
|
||||||
uint32_t length = thisSequence->getPeriodMs();
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
|
#if Q7S_EM != 1
|
||||||
// PCDU handlers receives two messages and both must be handled
|
// PCDU handlers receives two messages and both must be handled
|
||||||
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
@ -553,11 +553,12 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "GomSpace PST initialization failed" << std::endl;
|
sif::error << "GomSpace PST initialization failed" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
#endif /* Q7S_EM == 0 */
|
||||||
|
static_cast<void>(length);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ echo "-L 1534:192.168.155.55:1534 for connection to the TCF agent on the FM"
|
|||||||
echo "-L 1535:192.168.155.55:22 for file transfers to the FM"
|
echo "-L 1535:192.168.155.55:22 for file transfers to the FM"
|
||||||
echo "-L 1536:192.168.155.55:7301 for TMTC commanding using the TCP/IP IF on the FM"
|
echo "-L 1536:192.168.155.55:7301 for TMTC commanding using the TCP/IP IF on the FM"
|
||||||
echo "-L 1537:127.0.0.1:7100 for TMTC commanding using the CCSDS IF"
|
echo "-L 1537:127.0.0.1:7100 for TMTC commanding using the CCSDS IF"
|
||||||
echo "-L 1538:192.168.133.10:1543 for connection to the TCF agent on the EM"
|
echo "-L 1538:192.168.133.10:1534 for connection to the TCF agent on the EM"
|
||||||
echo "-L 1539:192.168.133.10:22 for file transfers to the EM"
|
echo "-L 1539:192.168.133.10:22 for file transfers to the EM"
|
||||||
echo "-L 1540:192.168.133.10:7301 for TMTC commanding using the TCP/IP IF on the EM"
|
echo "-L 1540:192.168.133.10:7301 for TMTC commanding using the TCP/IP IF on the EM"
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ ssh -L 1534:192.168.155.55:1534 \
|
|||||||
-L 1535:192.168.155.55:22 \
|
-L 1535:192.168.155.55:22 \
|
||||||
-L 1536:192.168.155.55:7301 \
|
-L 1536:192.168.155.55:7301 \
|
||||||
-L 1537:127.0.0.1:7100 \
|
-L 1537:127.0.0.1:7100 \
|
||||||
-L 1538:192.168.133.10:1543 \
|
-L 1538:192.168.133.10:1534 \
|
||||||
-L 1539:192.168.133.10:22 \
|
-L 1539:192.168.133.10:22 \
|
||||||
-L 1540:192.168.133.10:7301 \
|
-L 1540:192.168.133.10:7301 \
|
||||||
eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 \
|
eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 \
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit abe9c8bc000e834b99a2c367ed10f927eeb666b0
|
Subproject commit 826528b7158f71ee9ef6242b515fe3438c8d5f26
|
Loading…
Reference in New Issue
Block a user