From 93e3f3578d2d542c1dfb86ae470b9329bca780e5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Oct 2023 17:48:28 +0200 Subject: [PATCH] swap RTDs --- common/config/devices/gpioIds.h | 6 +-- linux/ObjectFactory.cpp | 46 +++++++++-------- linux/callbacks/gpioCallbacks.cpp | 84 +++++++++++++++---------------- tmtc | 2 +- 4 files changed, 71 insertions(+), 67 deletions(-) diff --git a/common/config/devices/gpioIds.h b/common/config/devices/gpioIds.h index bed82142..2cab2c32 100644 --- a/common/config/devices/gpioIds.h +++ b/common/config/devices/gpioIds.h @@ -37,6 +37,9 @@ enum gpioId_t { TEST_ID_0, TEST_ID_1, + RTD_IC_0, + RTD_IC_1, + RTD_IC_2, RTD_IC_3, RTD_IC_4, RTD_IC_5, @@ -50,9 +53,6 @@ enum gpioId_t { RTD_IC_13, RTD_IC_14, RTD_IC_15, - RTD_IC_16, - RTD_IC_17, - RTD_IC_18, CS_SUS_0, CS_SUS_1, diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index cb3e043b..756dc0af 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -206,74 +206,78 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc0); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_0, gpioRtdIc0); GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc1); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_1, gpioRtdIc1); GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc2); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_2, gpioRtdIc2); GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc3); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc3); GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc4); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc4); GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc5); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc5); GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc6); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc6); GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc7); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc7); GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc8); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc8); GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc9); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc9); GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc10); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc10); GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc11); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc11); GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc12); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc12); GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc13); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc13); GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc14); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc14); GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", Direction::OUT, Levels::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); - rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15); + rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc15); gpioChecker(gpioComIF->addGpios(rtdGpioCookie), "RTDs"); #if OBSW_ADD_RTD_DEVICES == 1 using namespace EiveMax31855; + // ! NOTE ! + // The chip selects for device 9 and 11 are swapped here. It is strongly suspected the cables + // for those devices were swapped during integration. This is probably the easiest way to + // fix the issue. std::array, NUM_RTDS> cookieArgs = {{ + {addresses::RTD_IC_0, gpioIds::RTD_IC_0}, + {addresses::RTD_IC_1, gpioIds::RTD_IC_1}, + {addresses::RTD_IC_2, gpioIds::RTD_IC_2}, {addresses::RTD_IC_3, gpioIds::RTD_IC_3}, {addresses::RTD_IC_4, gpioIds::RTD_IC_4}, {addresses::RTD_IC_5, gpioIds::RTD_IC_5}, {addresses::RTD_IC_6, gpioIds::RTD_IC_6}, {addresses::RTD_IC_7, gpioIds::RTD_IC_7}, {addresses::RTD_IC_8, gpioIds::RTD_IC_8}, - {addresses::RTD_IC_9, gpioIds::RTD_IC_9}, - {addresses::RTD_IC_10, gpioIds::RTD_IC_10}, {addresses::RTD_IC_11, gpioIds::RTD_IC_11}, + {addresses::RTD_IC_10, gpioIds::RTD_IC_10}, + {addresses::RTD_IC_9, gpioIds::RTD_IC_9}, {addresses::RTD_IC_12, gpioIds::RTD_IC_12}, {addresses::RTD_IC_13, gpioIds::RTD_IC_13}, {addresses::RTD_IC_14, gpioIds::RTD_IC_14}, {addresses::RTD_IC_15, gpioIds::RTD_IC_15}, - {addresses::RTD_IC_16, gpioIds::RTD_IC_16}, - {addresses::RTD_IC_17, gpioIds::RTD_IC_17}, - {addresses::RTD_IC_18, gpioIds::RTD_IC_18}, }}; // HSPD: Heatspreader diff --git a/linux/callbacks/gpioCallbacks.cpp b/linux/callbacks/gpioCallbacks.cpp index 969aada0..4c05bac3 100644 --- a/linux/callbacks/gpioCallbacks.cpp +++ b/linux/callbacks/gpioCallbacks.cpp @@ -21,6 +21,18 @@ void gpioCallbacks::spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gp if (value == gpio::Levels::HIGH) { switch (gpioId) { + case (gpioIds::RTD_IC_0): { + disableDecoderTcsIc1(gpioIF); + break; + } + case (gpioIds::RTD_IC_1): { + disableDecoderTcsIc1(gpioIF); + break; + } + case (gpioIds::RTD_IC_2): { + disableDecoderTcsIc1(gpioIF); + break; + } case (gpioIds::RTD_IC_3): { disableDecoderTcsIc1(gpioIF); break; @@ -42,15 +54,15 @@ void gpioCallbacks::spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gp break; } case (gpioIds::RTD_IC_8): { - disableDecoderTcsIc1(gpioIF); + disableDecoderTcsIc2(gpioIF); break; } case (gpioIds::RTD_IC_9): { - disableDecoderTcsIc1(gpioIF); + disableDecoderTcsIc2(gpioIF); break; } case (gpioIds::RTD_IC_10): { - disableDecoderTcsIc1(gpioIF); + disableDecoderTcsIc2(gpioIF); break; } case (gpioIds::RTD_IC_11): { @@ -73,18 +85,6 @@ void gpioCallbacks::spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gp disableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_16): { - disableDecoderTcsIc2(gpioIF); - break; - } - case (gpioIds::RTD_IC_17): { - disableDecoderTcsIc2(gpioIF); - break; - } - case (gpioIds::RTD_IC_18): { - disableDecoderTcsIc2(gpioIF); - break; - } case (gpioIds::CS_SUS_0): { disableDecoderInterfaceBoardIc1(gpioIF); break; @@ -154,82 +154,82 @@ void gpioCallbacks::spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gp } } else if (value == gpio::Levels::LOW) { switch (gpioId) { - case (gpioIds::RTD_IC_3): { + case (gpioIds::RTD_IC_0): { selectY7(gpioIF); enableDecoderTcsIc1(gpioIF); break; } + case (gpioIds::RTD_IC_1): { + selectY6(gpioIF); + enableDecoderTcsIc1(gpioIF); + break; + } + case (gpioIds::RTD_IC_2): { + selectY5(gpioIF); + enableDecoderTcsIc1(gpioIF); + break; + } + case (gpioIds::RTD_IC_3): { + selectY4(gpioIF); + enableDecoderTcsIc1(gpioIF); + break; + } case (gpioIds::RTD_IC_4): { - selectY6(gpioIF); + selectY3(gpioIF); enableDecoderTcsIc1(gpioIF); break; } case (gpioIds::RTD_IC_5): { - selectY5(gpioIF); + selectY2(gpioIF); enableDecoderTcsIc1(gpioIF); break; } case (gpioIds::RTD_IC_6): { - selectY4(gpioIF); + selectY1(gpioIF); enableDecoderTcsIc1(gpioIF); break; } case (gpioIds::RTD_IC_7): { - selectY3(gpioIF); - enableDecoderTcsIc1(gpioIF); - break; - } - case (gpioIds::RTD_IC_8): { - selectY2(gpioIF); - enableDecoderTcsIc1(gpioIF); - break; - } - case (gpioIds::RTD_IC_9): { - selectY1(gpioIF); - enableDecoderTcsIc1(gpioIF); - break; - } - case (gpioIds::RTD_IC_10): { selectY0(gpioIF); enableDecoderTcsIc1(gpioIF); break; } - case (gpioIds::RTD_IC_11): { + case (gpioIds::RTD_IC_8): { selectY7(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_12): { + case (gpioIds::RTD_IC_9): { selectY6(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_13): { + case (gpioIds::RTD_IC_10): { selectY5(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_14): { + case (gpioIds::RTD_IC_11): { selectY4(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_15): { + case (gpioIds::RTD_IC_12): { selectY3(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_16): { + case (gpioIds::RTD_IC_13): { selectY2(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_17): { + case (gpioIds::RTD_IC_14): { selectY1(gpioIF); enableDecoderTcsIc2(gpioIF); break; } - case (gpioIds::RTD_IC_18): { + case (gpioIds::RTD_IC_15): { selectY0(gpioIF); enableDecoderTcsIc2(gpioIF); break; diff --git a/tmtc b/tmtc index 60f7ae54..97f99415 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 60f7ae5453b387ee5ebcf6a338c34284004dbce7 +Subproject commit 97f99415d6be40d35bf9c373fea40b41c8457386