From 77f6ac57e959698dfcf77ffbad643b93ee0a2c89 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Nov 2021 16:45:33 +0100 Subject: [PATCH 1/8] some reaction wheel fixes --- bsp_q7s/callbacks/rwSpiCallback.cpp | 15 +++++++++++++-- bsp_q7s/callbacks/rwSpiCallback.h | 3 +++ bsp_q7s/core/InitMission.cpp | 2 +- mission/devices/RwHandler.h | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 620f63f7..ad99d505 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -133,8 +133,15 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen closeSpi(gpioId, gpioIF, mutex); return RwHandler::SPI_READ_FAILURE; } + if(idx == 0) { + if(byteRead != FLAG_BYTE) { + sif::error << "Invalid data, expected start marker" << std::endl; + closeSpi(gpioId, gpioIF, mutex); + return RwHandler::NO_START_MARKER; + } + } - if (byteRead != 0x7E) { + if (byteRead != FLAG_BYTE) { break; } @@ -145,6 +152,10 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen } } +#if FSFW_HAL_SPI_WIRETAPPING == 1 + sif::info << "RW start marker detected" << std::endl; +#endif + size_t decodedFrameLen = 0; while(decodedFrameLen < replyBufferSize) { @@ -158,7 +169,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen } } - if (byteRead == 0x7E) { + if (byteRead == FLAG_BYTE) { /** Reached end of frame */ break; } diff --git a/bsp_q7s/callbacks/rwSpiCallback.h b/bsp_q7s/callbacks/rwSpiCallback.h index cc7c6cbe..8952f873 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.h +++ b/bsp_q7s/callbacks/rwSpiCallback.h @@ -8,6 +8,9 @@ namespace rwSpiCallback { +//! This is the end and start marker of the frame datalinklayer +static constexpr uint8_t FLAG_BYTE = 0x7E; + /** * @brief This is the callback function to send commands to the nano avionics reaction wheels and * receive the replies. diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 7923a2cd..81d972b1 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -22,7 +22,7 @@ ServiceInterfaceStream sif::debug("DEBUG"); ServiceInterfaceStream sif::info("INFO"); ServiceInterfaceStream sif::warning("WARNING"); -ServiceInterfaceStream sif::error("ERROR", false, false, true); +ServiceInterfaceStream sif::error("ERROR"); #else ServiceInterfaceStream sif::debug("DEBUG", true); ServiceInterfaceStream sif::info("INFO", true); diff --git a/mission/devices/RwHandler.h b/mission/devices/RwHandler.h index cd753be0..57895ca6 100644 --- a/mission/devices/RwHandler.h +++ b/mission/devices/RwHandler.h @@ -46,6 +46,8 @@ public: static const ReturnValue_t MISSING_END_SIGN = MAKE_RETURN_CODE(0xB4); //! [EXPORT] : [COMMENT] Reaction wheel only responds with empty frames. static const ReturnValue_t NO_REPLY = MAKE_RETURN_CODE(0xB5); + //! [EXPORT] : [COMMENT] Expected a start marker as first byte + static const ReturnValue_t NO_START_MARKER = MAKE_RETURN_CODE(0xB6); protected: void doStartUp() override; From 11704ea908a13d2feaa524f303667a5bcd2e1713 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Dec 2021 14:48:29 +0100 Subject: [PATCH 2/8] enabled ACS board A side --- .../pollingSequenceFactory.cpp | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 73a27116..69982156 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -439,8 +439,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = false; - bool enableBside = true; + bool enableAside = true; + bool enableBside = false; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, @@ -465,16 +465,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -512,16 +512,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); From 52d8ae5ffb94d72f43bcabd3e3776121f61f075c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Dec 2021 17:23:35 +0100 Subject: [PATCH 3/8] compiling for windows again --- CMakeLists.txt | 2 +- fsfw | 2 +- linux/devices/CMakeLists.txt | 1 + {mission => linux}/devices/StarTrackerHandler.cpp | 0 {mission => linux}/devices/StarTrackerHandler.h | 0 .../devices/devicedefinitions/StarTrackerDefinitions.h | 0 misc/eclipse/.cproject | 5 ++++- misc/eclipse/Host/eive-mingw-debug-cmake.launch | 2 +- mission/devices/CMakeLists.txt | 1 - mission/devices/RwHandler.cpp | 4 ++-- mission/devices/devicedefinitions/RwDefinitions.h | 2 +- 11 files changed, 11 insertions(+), 8 deletions(-) rename {mission => linux}/devices/StarTrackerHandler.cpp (100%) rename {mission => linux}/devices/StarTrackerHandler.h (100%) rename {mission => linux}/devices/devicedefinitions/StarTrackerDefinitions.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d76f2fb..59d9d32d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,6 +177,7 @@ endif() if(NOT EIVE_BUILD_WATCHDOG) if(NOT EIVE_BUILD_UNITTESTS) if(EIVE_ADD_LINUX_FILES) + add_subdirectory(${LIB_ARCSEC_PATH}) add_subdirectory(${LINUX_PATH}) endif() add_subdirectory(${BSP_PATH}) @@ -192,7 +193,6 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG)) add_subdirectory(${FSFW_PATH}) add_subdirectory(${MISSION_PATH}) add_subdirectory(${TEST_PATH}) - add_subdirectory(${LIB_ARCSEC_PATH}) endif() if(EIVE_BUILD_UNITTESTS) diff --git a/fsfw b/fsfw index ceb87b5a..e4999fe0 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit ceb87b5abb2992a18266328e0ea34d9af15db7af +Subproject commit e4999fe01c0446f9820ceede55be3970aa22bbad diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 3871a6a6..6c529d8e 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -2,4 +2,5 @@ target_sources(${TARGET_NAME} PRIVATE HeaterHandler.cpp SolarArrayDeploymentHandler.cpp SusHandler.cpp + StarTrackerHandler.cpp ) diff --git a/mission/devices/StarTrackerHandler.cpp b/linux/devices/StarTrackerHandler.cpp similarity index 100% rename from mission/devices/StarTrackerHandler.cpp rename to linux/devices/StarTrackerHandler.cpp diff --git a/mission/devices/StarTrackerHandler.h b/linux/devices/StarTrackerHandler.h similarity index 100% rename from mission/devices/StarTrackerHandler.h rename to linux/devices/StarTrackerHandler.h diff --git a/mission/devices/devicedefinitions/StarTrackerDefinitions.h b/linux/devices/devicedefinitions/StarTrackerDefinitions.h similarity index 100% rename from mission/devices/devicedefinitions/StarTrackerDefinitions.h rename to linux/devices/devicedefinitions/StarTrackerDefinitions.h diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 7d7c4c09..3bab5367 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -19,7 +19,7 @@ - +