Merge pull request 'meier/ImtqHandler' (#44) from meier/ImtqHandler into develop

Reviewed-on: #44
This commit is contained in:
Robin Müller 2021-06-21 17:47:21 +02:00 committed by Robin Müller
commit d8bd396645
21 changed files with 3556 additions and 466 deletions

View File

@ -31,6 +31,7 @@ ServiceInterfaceStream sif::error("ERROR", true, false, true);
ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
@ -84,6 +85,23 @@ void initmission::initTasks() {
initmission::printAddObjectError("UDP_POLLING", objects::UDP_POLLING_TASK);
}
/* UDP bridge */
PeriodicTaskIF* errorReporterTestTask = factory->createPeriodicTask(
"ERROR_REPORTER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::INTERNAL_ERROR_REPORTER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
#if TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
/* PUS Services */
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
@ -208,8 +226,14 @@ void initmission::initTasks() {
pusMedPrio->startTask();
pusLowPrio->startTask();
errorReporterTestTask->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif
#if TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
sif::info << "Tasks started.." << std::endl;
}

View File

@ -37,6 +37,7 @@
#include <mission/devices/devicedefinitions/RadSensorDefinitions.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/utility/TmFunnel.h>
#include <linux/obc/CCSDSIPCoreBridge.h>
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
@ -401,61 +402,60 @@ void ObjectFactory::produce(void* args){
#if Q7S_ADD_RTD_DEVICES == 1
GpioCookie* rtdGpioCookie = new GpioCookie;
gpioCallbacks::initTcsBoardDecoder(gpioComIF);
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC3, gpioRtdIc3);
GpioCallback* gpioRtdIc4 = new GpioCallback(std::string("Chip select RTD IC4"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC4, gpioRtdIc4);
GpioCallback* gpioRtdIc5 = new GpioCallback(std::string("Chip select RTD IC5"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC5, gpioRtdIc5);
GpioCallback* gpioRtdIc6 = new GpioCallback(std::string("Chip select RTD IC6"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC6, gpioRtdIc6);
GpioCallback* gpioRtdIc7 = new GpioCallback(std::string("Chip select RTD IC7"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC7, gpioRtdIc7);
GpioCallback* gpioRtdIc8 = new GpioCallback(std::string("Chip select RTD IC8"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC8, gpioRtdIc8);
GpioCallback* gpioRtdIc9 = new GpioCallback(std::string("Chip select RTD IC9"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC9, gpioRtdIc9);
GpioCallback* gpioRtdIc10 = new GpioCallback(std::string("Chip select RTD IC10"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC10, gpioRtdIc10);
GpioCallback* gpioRtdIc11 = new GpioCallback(std::string("Chip select RTD IC11"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC11, gpioRtdIc11);
GpioCallback* gpioRtdIc12 = new GpioCallback(std::string("Chip select RTD IC12"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC12, gpioRtdIc12);
GpioCallback* gpioRtdIc13 = new GpioCallback(std::string("Chip select RTD IC13"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC13, gpioRtdIc13);
GpioCallback* gpioRtdIc14 = new GpioCallback(std::string("Chip select RTD IC14"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC14, gpioRtdIc14);
GpioCallback* gpioRtdIc15 = new GpioCallback(std::string("Chip select RTD IC15"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC15, gpioRtdIc15);
GpioCallback* gpioRtdIc16 = new GpioCallback(std::string("Chip select RTD IC16"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC16, gpioRtdIc16);
GpioCallback* gpioRtdIc17 = new GpioCallback(std::string("Chip select RTD IC17"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC17, gpioRtdIc17);
GpioCallback* gpioRtdIc18 = new GpioCallback(std::string("Chip select RTD IC18"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC18, gpioRtdIc18);
gpioComIF->addGpios(rtdGpioCookie);
SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
spi::SpiModes::MODE_3, 2000000);
SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
@ -491,7 +491,7 @@ void ObjectFactory::produce(void* args){
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC15, gpioIds::RTD_IC15,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
spi::SpiModes::MODE_1, 3900000);
SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC16, gpioIds::RTD_IC16,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
@ -518,7 +518,7 @@ void ObjectFactory::produce(void* args){
Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16, objects::SPI_COM_IF, spiRtdIc16, 0);
Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17, objects::SPI_COM_IF, spiRtdIc17, 0);
Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0);
// rtdIc10->setStartUpImmediately();
rtdIc17->setStartUpImmediately();
// rtdIc4->setStartUpImmediately();
(void) rtdIc3;
@ -535,16 +535,14 @@ void ObjectFactory::produce(void* args){
(void) rtdIc14;
(void) rtdIc15;
(void) rtdIc16;
(void) rtdIc17;
// (void) rtdIc17;
(void) rtdIc18;
#endif /* Q7S_ADD_RTD_DEVICES == 1 */
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
std::string("/dev/i2c-0"));
IMTQHandler* imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
// imtqHandler->setStartUpImmediately();
(void) imtqHandler;
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
UartCookie* plocUartCookie = new UartCookie(objects::PLOC_HANDLER, std::string("/dev/ttyUL3"),
UartModes::NON_CANONICAL, 115200, PLOC::MAX_REPLY_SIZE);
@ -577,9 +575,22 @@ void ObjectFactory::produce(void* args){
SpiCookie* spiCookieSus = new SpiCookie(addresses::SUS_1, std::string("/dev/spidev1.0"),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
gpioIds::CS_SUS_1);
sus1->setStartUpImmediately();
#endif
#if TE0720 == 1 && TEST_CCSDS_BRIDGE == 1
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
GpiodRegular* papbBusyN = new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_N"));
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
GpiodRegular* papbEmpty = new GpiodRegular(std::string("gpiochip0"), 1,
std::string("Chip Select Sus Sensor"));
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
gpioComIF->addGpios(gpioCookieCcsdsIp);
new CCSDSIPCoreBridge(objects::CCSDS_IP_CORE_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE, gpioComIF, std::string("/dev/uio0"),
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
#endif
#if TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1

View File

@ -15,6 +15,7 @@ enum commonClassIds: uint8_t {
IMTQ_HANDLER, //IMTQ
PLOC_HANDLER, //PLOC
SUS_HANDLER, //SUSS
CCSDS_IP_CORE_BRIDGE, // IP Core interface
COMMON_CLASS_ID_END // [EXPORT] : [END]
};

View File

@ -12,6 +12,7 @@ enum: uint8_t {
HEATER_HANDLER = 109,
SA_DEPL_HANDLER = 110,
PLOC_HANDLER = 111,
IMTQ_HANDLER = 112,
COMMON_SUBSYSTEM_ID_END
};
}

@ -1 +1 @@
Subproject commit fe661fff85e2b8c6149c9603fd68aa3a811bf9bd
Subproject commit fce40ebf9a4a45bafedaee2fc87e5aa10e49fdcc

View File

@ -3,3 +3,4 @@ add_subdirectory(utility)
add_subdirectory(boardtest)
add_subdirectory(devices)
add_subdirectory(fsfwconfig)
add_subdirectory(obc)

View File

@ -22,9 +22,11 @@ debugging. */
#define OBSW_ADD_TEST_PST 1
#define TEST_LIBGPIOD 0
#define TEST_RADIATION_SENSOR_HANDLER 1
#define TEST_RADIATION_SENSOR_HANDLER 0
#define TEST_SUS_HANDLER 1
#define TEST_PLOC_HANDLER 0
#define TEST_CCSDS_BRIDGE 0
#define PERFORM_PTME_TEST 0
#define TE0720 0
#define TE0720_HEATER_TEST 0
@ -39,6 +41,8 @@ debugging. */
#define L3GD20_GYRO_DEBUG 0
#define DEBUG_RAD_SENSOR 1
#define DEBUG_SUS 1
#define DEBUG_RTD 1
#define IMTQ_DEBUG 1
// Leave at one as the BSP is linux. Used by the ADIS16507 device handler
#define OBSW_ADIS16507_LINUX_COM_IF 1

View File

@ -65,7 +65,10 @@ namespace gpioIds {
SPI_MUX_BIT_5,
SPI_MUX_BIT_6,
CS_RAD_SENSOR
CS_RAD_SENSOR,
PAPB_BUSY_N,
PAPB_EMPTY
};
}

View File

@ -12,6 +12,8 @@ namespace objects {
FW_ADDRESS_START = PUS_SERVICE_1_VERIFICATION,
FW_ADDRESS_END = TIME_STAMPER,
CCSDS_IP_CORE_BRIDGE = 0x50000500,
PUS_SERVICE_6 = 0x51000500,
TM_FUNNEL = 0x52000002,

View File

@ -145,11 +145,11 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
/* 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);
// 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);
if (length != 3000) {
sif::warning << "pollingSequenceInitDefault: Frequency changed. Make sure timing critical "
@ -166,251 +166,251 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
*/
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_3, length * 0.906, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_3, length * 0.906, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.906, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.906, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.906, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_3, length * 0.907, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_3, length * 0.907, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.907, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.907, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.907, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_3, length * 0.908, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_3, length * 0.908, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.908, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.908, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.908, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.914, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_5, length * 0.914, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;

View File

@ -2,7 +2,7 @@
#define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
#include <fsfw/returnvalues/FwClassIds.h>
#include "commonClassIds.h"
#include <common/config/commonClassIds.h>
/**
* Source IDs starts at 73 for now

View File

@ -0,0 +1,136 @@
#include <sys/mman.h>
#include <fcntl.h>
#include <linux/obc/CCSDSIPCoreBridge.h>
CCSDSIPCoreBridge::CCSDSIPCoreBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId, LinuxLibgpioIF* gpioComIF,
std::string uioPtme, gpioId_t papbBusyId, gpioId_t papbEmptyId) :
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId), gpioComIF(gpioComIF), uioPtme(
uioPtme), papbBusyId(papbBusyId), papbEmptyId(papbEmptyId) {
}
CCSDSIPCoreBridge::~CCSDSIPCoreBridge() {
}
ReturnValue_t CCSDSIPCoreBridge::initialize() {
ReturnValue_t result = TmTcBridge::initialize();
fd = open("/dev/uio0", O_RDWR);
if (fd < 1) {
sif::debug << "CCSDSIPCoreBridge::initialize: Invalid UIO device file" << std::endl;
return RETURN_FAILED;
}
/**
* Map uio device in virtual address space
* PROT_WRITE: Map uio device in writable only mode
*/
ptmeBaseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0));
if (ptmeBaseAddress == MAP_FAILED) {
sif::error << "CCSDSIPCoreBridge::initialize: Failed to map uio address" << std::endl;
return RETURN_FAILED;
}
return result;
}
ReturnValue_t CCSDSIPCoreBridge::handleTm() {
#if PERFORM_PTME_TEST == 1
return sendTestFrame();
#else
return TmTcBridge::handleTm();
#endif
}
ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t * data, size_t dataLen) {
if(pollPapbBusySignal() == RETURN_OK) {
startPacketTransfer();
}
for(size_t idx = 0; idx < dataLen; idx++) {
if(pollPapbBusySignal() == RETURN_OK) {
*(ptmeBaseAddress + PTME_DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
}
else {
sif::debug << "CCSDSIPCoreBridge::sendTm: Only written " << idx - 1 << " of " << dataLen
<< " data" << std::endl;
return RETURN_FAILED;
}
}
if(pollPapbBusySignal() == RETURN_OK) {
endPacketTransfer();
}
return RETURN_OK;
}
void CCSDSIPCoreBridge::startPacketTransfer() {
*ptmeBaseAddress = PTME_CONFIG_START;
}
void CCSDSIPCoreBridge::endPacketTransfer() {
*ptmeBaseAddress = PTME_CONFIG_END;
}
ReturnValue_t CCSDSIPCoreBridge::pollPapbBusySignal() {
int papbBusyState = 0;
ReturnValue_t result = RETURN_OK;
/** Check if PAPB interface is ready to receive data */
result = gpioComIF->readGpio(papbBusyId, &papbBusyState);
if (result != RETURN_OK) {
sif::debug << "CCSDSIPCoreBridge::pollPapbBusySignal: Failed to read papb busy signal"
<< std::endl;
return RETURN_FAILED;
}
if (!papbBusyState) {
sif::debug << "CCSDSIPCoreBridge::pollPapbBusySignal: PAPB busy" << std::endl;
return PAPB_BUSY;
}
return RETURN_OK;
}
void CCSDSIPCoreBridge::isPtmeBufferEmpty() {
ReturnValue_t result = RETURN_OK;
int papbEmptyState = 1;
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
if (result != RETURN_OK) {
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Failed to read papb empty signal"
<< std::endl;
return;
}
if (papbEmptyState == 1) {
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Buffer is empty" << std::endl;
}
else {
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Buffer is not empty" << std::endl;
}
return;
}
ReturnValue_t CCSDSIPCoreBridge::sendTestFrame() {
/** Size of one complete transfer frame data field amounts to 1105 bytes */
uint8_t testPacket[1105];
/** Fill one test packet */
for(int idx = 0; idx < 1105; idx++) {
testPacket[idx] = static_cast<uint8_t>(idx & 0xFF);
}
ReturnValue_t result = sendTm(testPacket, 1105);
if(result != RETURN_OK) {
return result;
}
return RETURN_OK;
}

View File

@ -0,0 +1,130 @@
#ifndef MISSION_OBC_CCSDSIPCOREBRIDGE_H_
#define MISSION_OBC_CCSDSIPCOREBRIDGE_H_
#include <fsfw/tmtcservices/TmTcBridge.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <string.h>
#include "OBSWConfig.h"
/**
* @brief This class handles the interfacing to the telemetry (PTME) and telecommand (PDEC) IP
* cores responsible for the CCSDS encoding and decoding. The IP cores are implemented
* on the programmable logic and are accessible through the linux UIO driver.
*/
class CCSDSIPCoreBridge: public TmTcBridge {
public:
/**
* @brief Constructor
*
* @param objectId
* @param tcDestination
* @param tmStoreId
* @param tcStoreId
* @param uioPtme Name of the uio device file which provides access to the PTME IP Core.
* @param papbBusyId The ID of the GPIO which is connected to the PAPBBusy_N signal of the
* PTME IP Core. A low logic level indicates the PTME is not ready to
* receive more data.
* @param papbEmptyId The ID of the GPIO which is connected to the PAPBEmpty signal of the
* PTME IP Core. The signal is high when there are no packets in the
* external buffer memory (BRAM).
*/
CCSDSIPCoreBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId, LinuxLibgpioIF* gpioComIF, std::string uioPtme,
gpioId_t papbBusyId, gpioId_t papbEmptyId);
virtual ~CCSDSIPCoreBridge();
ReturnValue_t initialize() override;
protected:
/**
* Overwriting this function to provide the capability of testing the PTME IP Core
* implementation.
*/
virtual ReturnValue_t handleTm() override;
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
private:
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_IP_CORE_BRIDGE;
static const ReturnValue_t PAPB_BUSY = MAKE_RETURN_CODE(0xA0);
/** Size of mapped address space. 4k (minimal size of pl device) */
// static const int MAP_SIZE = 0xFA0;
static const int MAP_SIZE = 0x1000;
/**
* Configuration bits:
* bit[1:0]: Size of data (1,2,3 or 4 bytes). 1 Byte <=> b00
* bit[2]: Set this bit to 1 to abort a transfered packet
* bit[3]: Signals to PTME the start of a new telemetry packet
*/
static const uint32_t PTME_CONFIG_START = 0x8;
/**
* Writing this word to the ptme base address signals to the PTME that a complete tm packet has
* been transferred.
*/
static const uint32_t PTME_CONFIG_END = 0x0;
/**
* Writing to this offset within the PTME memory space will insert data for encoding to the
* PTME IP core.
* The address offset is 0x400 (= 4 * 256)
*/
static const int PTME_DATA_REG_OFFSET = 256;
LinuxLibgpioIF* gpioComIF = nullptr;
/** The uio device file related to the PTME IP Core */
std::string uioPtme;
/** Pulled to low when PTME not ready to receive data */
gpioId_t papbBusyId = gpio::NO_GPIO;
/** High when externally buffer memory of PTME is empty */
gpioId_t papbEmptyId = gpio::NO_GPIO;
/** The file descriptor of the UIO driver */
int fd;
uint32_t* ptmeBaseAddress = nullptr;
/**
* @brief This function sends the config byte to the PTME IP Core to initiate a packet
* transfer.
*/
void startPacketTransfer();
/**
* @brief This function sends the config byte to the PTME IP Core to signal the end of a
* packet transfer.
*/
void endPacketTransfer();
/**
* @brief This function reads the papb busy signal indicating whether the PAPB interface is
* ready to receive more data or not. PAPB is ready when PAPB_Busy_N == '1'.
*
* @return RETURN_OK when ready to receive data else PAPB_BUSY.
*/
ReturnValue_t pollPapbBusySignal();
/**
* @brief This function can be used for debugging to check wheter there are packets in
* the packet buffer of the PTME or not.
*/
void isPtmeBufferEmpty();
/**
* @brief This function sends a complete telemetry transfer frame data field (1105 bytes)
* to the input of the PTME IP Core. Can be used to test the implementation.
*/
ReturnValue_t sendTestFrame();
};
#endif /* MISSION_OBC_CCSDSIPCOREBRIDGE_H_ */

5
linux/obc/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
target_sources(${TARGET_NAME} PUBLIC
CCSDSIPCoreBridge.cpp
)

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ protected:
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) override;
void setNormalDatapoolEntriesInvalid() override;
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
@ -49,16 +50,48 @@ private:
static const ReturnValue_t INTERNAL_PROCESSING_ERROR = MAKE_RETURN_CODE(0xA4);
static const ReturnValue_t REJECTED_WITHOUT_REASON = MAKE_RETURN_CODE(0xA5);
static const ReturnValue_t CMD_ERR_UNKNOWN = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] The status reply to a self test command was received but no self test command has been sent. This should normally never happen.
static const ReturnValue_t UNEXPECTED_SELF_TEST_REPLY = MAKE_RETURN_CODE(0xA7);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::IMTQ_HANDLER;
//! [EXPORT] : [COMMENT] Get self test result returns I2C failure
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_I2C_FAILURE = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] Get self test result returns SPI failure. This concerns the MTM connectivity.
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_SPI_FAILURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] Get self test result returns failure in measurement of current and temperature.
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_ADC_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Get self test result returns PWM failure which concerns the coil actuation.
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_PWM_FAILURE = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Get self test result returns TC failure (system failure)
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_TC_FAILURE = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Get self test result returns failure that MTM values were outside of the expected range.
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_MTM_RANGE_FAILURE = MAKE_EVENT(6, severity::LOW);
//! [EXPORT] : [COMMENT] Get self test result returns failure indicating that the coil current was outside of the expected range
//! P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA
static const Event SELF_TEST_COIL_CURRENT_FAILURE = MAKE_EVENT(7, severity::LOW);
//! [EXPORT] : [COMMENT] Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.
static const Event INVALID_ERROR_BYTE = MAKE_EVENT(8, severity::LOW);
IMTQ::EngHkDataset engHkDataset;
IMTQ::CalibratedMtmMeasurementSet calMtmMeasurementSet;
IMTQ::RawMtmMeasurementSet rawMtmMeasurementSet;
IMTQ::PosXSelfTestSet posXselfTestDataset;
IMTQ::NegXSelfTestSet negXselfTestDataset;
IMTQ::PosYSelfTestSet posYselfTestDataset;
IMTQ::NegYSelfTestSet negYselfTestDataset;
IMTQ::PosZSelfTestSet posZselfTestDataset;
IMTQ::NegZSelfTestSet negZselfTestDataset;
uint8_t commandBuffer[IMTQ::MAX_COMMAND_SIZE];
enum class CommunicationStep {
SELF_TEST,
GET_ENG_HK_DATA,
START_MTM_MEASUREMENT,
GET_CAL_MTM_MEASUREMENT,
@ -67,6 +100,22 @@ private:
CommunicationStep communicationStep = CommunicationStep::GET_ENG_HK_DATA;
enum class StartupStep {
NONE,
COMMAND_SELF_TEST,
GET_SELF_TEST_RESULT
};
StartupStep startupStep = StartupStep::COMMAND_SELF_TEST;
bool selfTestPerformed = false;
/**
* @brief In case of a status reply to a single axis self test command, this function
* searches for the actual pending command.
*/
ReturnValue_t getSelfTestCommandId(DeviceCommandId_t* id);
/**
* @brief Each reply contains a status byte giving information about a request. This function
* parses this byte and returns the associated failure message.
@ -114,6 +163,33 @@ private:
* command.
*/
void fillRawMtmDataset(const uint8_t* packet);
/**
* @brief This function handles all self test results. This comprises parsing the error byte
* and step byte and calling the function to fill the respective dataset.
*/
void handleSelfTestReply(const uint8_t* packet);
/**
* @brief The following functions fill the respective dataset of the single axis self tests.
* @param packet Pointer to the reply data holding the self test result.
*/
void handlePositiveXSelfTestReply(const uint8_t* packet);
void handleNegativeXSelfTestReply(const uint8_t* packet);
void handlePositiveYSelfTestReply(const uint8_t* packet);
void handleNegativeYSelfTestReply(const uint8_t* packet);
void handlePositiveZSelfTestReply(const uint8_t* packet);
void handleNegativeZSelfTestReply(const uint8_t* packet);
/**
* @brief This function checks the error byte of a self test measurement.
*
* @param errorByte The received error byte to check
* @param step The step of the error byte.
*/
void checkErrorByte(const uint8_t errorByte, const uint8_t step);
std::string makeStepString(const uint8_t step);
};
#endif /* MISSION_DEVICES_IMTQHANDLER_H_ */

View File

@ -8,7 +8,7 @@ Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId,
DeviceHandlerBase(objectId, comIF, comCookie), switchId(switchId),
sensorDataset(this), sensorDatasetSid(sensorDataset.getSid()) {
#if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(10);
debugDivider = new PeriodicOperationDivider(0);
#endif
}
@ -38,10 +38,38 @@ void Max31865PT1000Handler::doStartUp() {
if(internalState == InternalState::REQUEST_CONFIG) {
if (commandExecuted) {
commandExecuted = false;
internalState = InternalState::CONFIG_HIGH_THRESHOLD;
}
}
if(internalState == InternalState::CONFIG_HIGH_THRESHOLD) {
if(commandExecuted) {
internalState = InternalState::REQUEST_HIGH_THRESHOLD;
commandExecuted = false;
}
}
if(internalState == InternalState::REQUEST_HIGH_THRESHOLD) {
if(commandExecuted) {
internalState = InternalState::CONFIG_LOW_THRESHOLD;
commandExecuted = false;
}
}
if(internalState == InternalState::CONFIG_LOW_THRESHOLD) {
if(commandExecuted) {
internalState = InternalState::REQUEST_LOW_THRESHOLD;
commandExecuted = false;
}
}
if(internalState == InternalState::REQUEST_LOW_THRESHOLD) {
if(commandExecuted) {
setMode(MODE_ON);
setMode(MODE_NORMAL);
commandExecuted = false;
internalState = InternalState::RUNNING;
commandExecuted = false;
}
}
}
@ -82,6 +110,22 @@ ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand(
*id = Max31865Definitions::REQUEST_CONFIG;
return buildCommandFromCommand(*id, nullptr, 0);
}
case(InternalState::CONFIG_HIGH_THRESHOLD): {
*id = Max31865Definitions::WRITE_HIGH_THRESHOLD;
return buildCommandFromCommand(*id, nullptr, 0);
}
case(InternalState::REQUEST_HIGH_THRESHOLD): {
*id = Max31865Definitions::REQUEST_HIGH_THRESHOLD;
return buildCommandFromCommand(*id, nullptr, 0);
}
case(InternalState::CONFIG_LOW_THRESHOLD): {
*id = Max31865Definitions::WRITE_LOW_THRESHOLD;
return buildCommandFromCommand(*id, nullptr, 0);
}
case(InternalState::REQUEST_LOW_THRESHOLD): {
*id = Max31865Definitions::REQUEST_LOW_THRESHOLD;
return buildCommandFromCommand(*id, nullptr, 0);
}
default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -110,13 +154,49 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(
}
}
case(Max31865Definitions::REQUEST_CONFIG): {
commandBuffer[0] = 0x00; // dummy byte
commandBuffer[1] = static_cast<uint8_t>(
commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::REQUEST_CONFIG);
commandBuffer[1] = 0x00; // dummy byte
DeviceHandlerBase::rawPacketLen = 2;
DeviceHandlerBase::rawPacket = commandBuffer.data();
return HasReturnvaluesIF::RETURN_OK;
}
case(Max31865Definitions::WRITE_HIGH_THRESHOLD): {
commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::WRITE_HIGH_THRESHOLD);
commandBuffer[1] = static_cast<uint8_t>(HIGH_THRESHOLD >> 8);
commandBuffer[2] = static_cast<uint8_t>(HIGH_THRESHOLD & 0xFF);
DeviceHandlerBase::rawPacketLen = 3;
DeviceHandlerBase::rawPacket = commandBuffer.data();
return HasReturnvaluesIF::RETURN_OK;
}
case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): {
commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::REQUEST_HIGH_THRESHOLD);
commandBuffer[1] = 0x00; //dummy byte
commandBuffer[2] = 0x00; //dummy byte
DeviceHandlerBase::rawPacketLen = 3;
DeviceHandlerBase::rawPacket = commandBuffer.data();
return HasReturnvaluesIF::RETURN_OK;
}
case(Max31865Definitions::WRITE_LOW_THRESHOLD): {
commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::WRITE_LOW_THRESHOLD);
commandBuffer[1] = static_cast<uint8_t>(LOW_THRESHOLD >> 8);
commandBuffer[2] = static_cast<uint8_t>(LOW_THRESHOLD & 0xFF);
DeviceHandlerBase::rawPacketLen = 3;
DeviceHandlerBase::rawPacket = commandBuffer.data();
return HasReturnvaluesIF::RETURN_OK;
}
case(Max31865Definitions::REQUEST_LOW_THRESHOLD): {
commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::REQUEST_LOW_THRESHOLD);
commandBuffer[1] = 0x00; //dummy byte
commandBuffer[2] = 0x00; //dummy byte
DeviceHandlerBase::rawPacketLen = 3;
DeviceHandlerBase::rawPacket = commandBuffer.data();
return HasReturnvaluesIF::RETURN_OK;
}
case(Max31865Definitions::REQUEST_RTD): {
commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::REQUEST_RTD);
@ -144,6 +224,10 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(
void Max31865PT1000Handler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(Max31865Definitions::CONFIG_CMD, 3);
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_CONFIG, 3);
insertInCommandAndReplyMap(Max31865Definitions::WRITE_LOW_THRESHOLD, 3);
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_LOW_THRESHOLD, 3);
insertInCommandAndReplyMap(Max31865Definitions::WRITE_HIGH_THRESHOLD, 3);
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_HIGH_THRESHOLD, 3);
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3,
&sensorDataset);
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3);
@ -158,6 +242,39 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
internalState == InternalState::RUNNING) {
*foundId = Max31865Definitions::REQUEST_RTD;
*foundLen = rtdReplySize;
return RETURN_OK;
}
if(remainingSize == 3) {
switch(internalState) {
case(InternalState::CONFIG_HIGH_THRESHOLD): {
*foundLen = 3;
*foundId = Max31865Definitions::WRITE_HIGH_THRESHOLD;
commandExecuted = true;
return RETURN_OK;
}
case(InternalState::REQUEST_HIGH_THRESHOLD): {
*foundLen = 3;
*foundId = Max31865Definitions::REQUEST_HIGH_THRESHOLD;
return RETURN_OK;
}
case(InternalState::CONFIG_LOW_THRESHOLD): {
*foundLen = 3;
*foundId = Max31865Definitions::WRITE_LOW_THRESHOLD;
commandExecuted = true;
return RETURN_OK;
}
case(InternalState::REQUEST_LOW_THRESHOLD): {
*foundLen = 3;
*foundId = Max31865Definitions::REQUEST_LOW_THRESHOLD;
return RETURN_OK;
}
default: {
sif::debug << "Max31865PT1000Handler::scanForReply: Unknown internal state"
<< std::endl;
return RETURN_OK;
}
}
}
if(remainingSize == configReplySize) {
@ -203,15 +320,39 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
}
break;
}
case(Max31865Definitions::REQUEST_LOW_THRESHOLD): {
uint16_t readLowThreshold = packet[0] << 8 | packet[1];
if(readLowThreshold != LOW_THRESHOLD) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 && DEBUG_RTD == 1
sif::error
<< "Max31865PT1000Handler::interpretDeviceReply: Missmatch between written "
<< "and readback value of low threshold register"
<< std::endl;
#endif
}
commandExecuted = true;
break;
}
case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): {
uint16_t readHighThreshold = packet[0] << 8 | packet[1];
if(readHighThreshold != HIGH_THRESHOLD) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 && DEBUG_RTD == 1
sif::error
<< "Max31865PT1000Handler::interpretDeviceReply: Missmatch between written "
<< "and readback value of high threshold register"
<< std::endl;
#endif
}
commandExecuted = true;
break;
}
case(Max31865Definitions::REQUEST_RTD): {
// first bit of LSB reply byte is the fault bit
uint8_t faultBit = packet[2] & 0b0000'0001;
if(faultBit == 1) {
// Maybe we should attempt to restart it?
if(faultByte == 0) {
internalState = InternalState::REQUEST_FAULT_BYTE;
}
}
// RTD value consists of last seven bits of the LSB reply byte and
// the MSB reply byte
@ -329,7 +470,7 @@ void Max31865PT1000Handler::debugInterface(uint8_t positionTracker,
uint32_t Max31865PT1000Handler::getTransitionDelayMs(
Mode_t modeFrom, Mode_t modeTo) {
return 5000;
return 20000;
}
ReturnValue_t Max31865PT1000Handler::getSwitches(
@ -348,8 +489,8 @@ ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool
new PoolEntry<float>({0}, 1, true));
localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE,
new PoolEntry<uint8_t>({0}));
poolManager.subscribeForPeriodicPacket(sensorDatasetSid,
false, 4.0, false);
// poolManager.subscribeForPeriodicPacket(sensorDatasetSid,
// false, 4.0, false);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -37,16 +37,27 @@ public:
// Configuration in 8 digit code:
// 1. 1 for V_BIAS enabled, 0 for disabled
// 2. 1 for Auto-conversion, 0 for off
// 3. 1 for 1-shot enabled, 0 for disabled
// 3. 1 for 1-shot enabled, 0 for disabled (self-clearing bit)
// 4. 1 for 3-wire disabled, 0 for disabled
// 5./6. Fault detection: 00 for no action, 01 for automatic delay, 1
// 0 for run fault detection with manual delay,
// 11 for finish fault detection with manual delay
// 7. Fault status: 1 for auto-clear, 0 for auto-clear off
// 7. Fault status: Write 1 to reset fault status register (Bit is self cleared afterwards)
// 8. 1 for 50 Hz filter, 0 for 60 Hz filter (noise rejection filter)
static constexpr uint8_t DEFAULT_CONFIG = 0b11000001;
static constexpr float RTD_RREF_PT1000 = 4000.0; //!< Ohm
/**
* Expected temperature range is -100°C and 100°C.
* If there are temperatures beyond this range there must be a fault.
* The threshold variables cause the MAX1385 to signal an error in case the measured resistance
* indicates a temperature higher than 100°C or lower than -100°C.
* Default settings of MAX13865 are 0xFFFF for the high threshold register and 0x0 for the
* low threshold register.
*/
static constexpr uint16_t HIGH_THRESHOLD = 11298; // = 100°C
static constexpr uint16_t LOW_THRESHOLD = 4902; // = -100°C
static constexpr float RTD_RREF_PT1000 = 4020.0; //!< Ohm
static constexpr float RTD_RESISTANCE0_PT1000 = 1000.0; //!< Ohm
protected:
/* DeviceHandlerBase abstract function implementation */
@ -80,6 +91,10 @@ private:
NONE,
WARMUP,
CONFIGURE,
CONFIG_HIGH_THRESHOLD,
REQUEST_HIGH_THRESHOLD,
CONFIG_LOW_THRESHOLD,
REQUEST_LOW_THRESHOLD,
REQUEST_CONFIG,
RUNNING,
REQUEST_FAULT_BYTE

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,12 @@ enum PoolIds: lp_id_t {
};
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD;

2
tmtc

@ -1 +1 @@
Subproject commit 8fc67c26653df03f3352493bd0c744bc79928e1d
Subproject commit 20a44b4b67198d42e83a790191ad6740d0aabf7c