From 1d8c4be47a01ad1e01c2bad988cef6716c4d51cc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Sep 2021 14:47:03 +0200 Subject: [PATCH 01/23] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index e8050183..87b68e84 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e8050183f4f54452caceba67a9d4da50bd230770 +Subproject commit 87b68e84bef1b77ad87ccd189c12b5a49a8f5955 From 652cfa09864926dd14d398fde1907c558438f2e4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Sep 2021 17:31:55 +0200 Subject: [PATCH 02/23] gpio refactoring --- bsp_q7s/core/ObjectFactory.cpp | 122 +++++++++++++++------------- bsp_q7s/gpio/gpioCallbacks.cpp | 41 +++++----- fsfw | 2 +- linux/archive/gpio/LinuxLibgpioIF.h | 4 +- linux/boardtest/SpiTestClass.cpp | 51 ++++++------ 5 files changed, 115 insertions(+), 105 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e8be0ef1..cf17cb25 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -265,8 +265,8 @@ void ObjectFactory::createPcduComponents() { void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { GpioCookie* gpioCookieRadSensor = new GpioCookie; - GpiodRegular* chipSelectRadSensor = new GpiodRegular("Chip Select Radiation Sensor", gpio::OUT, - 1, q7s::GPIO_RAD_SENSOR_LABEL, q7s::GPIO_RAD_SENSOR_CS); + auto chipSelectRadSensor = new GpiodRegularByLabel(q7s::GPIO_RAD_SENSOR_LABEL, + q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, gpio::HIGH); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioComIF->addGpios(gpioCookieRadSensor); @@ -392,47 +392,47 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { GpioCookie* gpioCookieAcsBoard = new GpioCookie(); - GpiodRegular* gpio = nullptr; - gpio = new GpiodRegular("CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - q7s::GPIO_GYRO_0_ADIS_CS); + GpiodRegularByLabel* gpio = nullptr; + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_0_ADIS_CS, + "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS, + "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - q7s::GPIO_GYRO_2_ADIS_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_2_ADIS_CS, + "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS, + "CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular("CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS, + "CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular("CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, + "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular("CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, - q7s::GPIO_MGM_2_LIS3_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, + "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular("CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, + "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); // GNSS reset pins are active low - gpio = new GpiodRegular("GNSS_0_NRESET", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0, + "GNSS_0_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio); - gpio = new GpiodRegular("GNSS_1_NRESET", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1, + "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, - q7s::GPIO_GYRO_0_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, - q7s::GPIO_GYRO_2_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio); // TODO: Add enable pins for GPS as soon as new interface board design is finished @@ -542,37 +542,37 @@ void ObjectFactory::createHeaterComponents() { GpioCookie* heaterGpiosCookie = new GpioCookie; /* Pin H2-11 on stack connector */ - GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN); + auto gpioConfigHeater0 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN, + "Heater0", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ - GpiodRegular* gpioConfigHeater1 = new GpiodRegular("Heater1", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN); + auto gpioConfigHeater1 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN, + "Heater1", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); /* Pin H2-13 on stack connector */ - GpiodRegular* gpioConfigHeater2 = new GpiodRegular("Heater2", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN); + auto gpioConfigHeater2 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN, + "Heater2", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); - GpiodRegular* gpioConfigHeater3 = new GpiodRegular("Heater3", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN); + auto gpioConfigHeater3 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN, + "Heater3", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); - GpiodRegular* gpioConfigHeater4 = new GpiodRegular("Heater4", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN); + auto gpioConfigHeater4 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN, + "Heater4", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); - GpiodRegular* gpioConfigHeater5 = new GpiodRegular("Heater5", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN); + auto gpioConfigHeater5 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN, + "Heater5", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); - GpiodRegular* gpioConfigHeater6 = new GpiodRegular("Heater6", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN); + auto gpioConfigHeater6 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN, + "Heater6", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); - GpiodRegular* gpioConfigHeater7 = new GpiodRegular("Heater7", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN); + auto gpioConfigHeater7 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN, + "Heater7", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, @@ -582,11 +582,11 @@ void ObjectFactory::createHeaterComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() { GpioCookie* solarArrayDeplCookie = new GpioCookie; - GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular("DeplSA0", gpio::OUT, 0, - q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_0_PIN); + auto gpioConfigDeplSA0 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, + q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, gpio::LOW); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0); - GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular("DeplSA1", gpio::OUT, 0, - q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_1_PIN); + auto gpioConfigDeplSA1 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, + q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, gpio::LOW); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1); //TODO: Find out burn time. For now set to 1000 ms. @@ -766,17 +766,25 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); - GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); +// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); +// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); +// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); +// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); +// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); + auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, + "Enable reaction wheel 1", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); - GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); + auto enRw2 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS, + "Enable reaction wheel 2", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); - GpiodRegular* enRw3 = new GpiodRegular("Enable reaction wheel 3", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); + auto enRw3 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS, + "Enable reaction wheel 3", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3); - GpiodRegular* enRw4 = new GpiodRegular("Enable reaction wheel 4", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS); + auto enRw4 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS, + "Enable reaction wheel 4", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4); /** @@ -784,8 +792,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core. * Per default the PS SPI is selected (EMIO = 0). */ - GpiodRegular* spiMux = new GpiodRegular("EMIO 0 SPI Mux", gpio::OUT, 0, - q7s::GPIO_RW_SPI_MUX_LABEL, q7s::GPIO_RW_SPI_MUX_CS); + auto spiMux = new GpiodRegularByLabel(q7s::GPIO_RW_SPI_MUX_LABEL, + q7s::GPIO_RW_SPI_MUX_CS, "EMIO 0 SPI Mux", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux); gpioComIF->addGpios(gpioCookieRw); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index da3678c6..da7c58e4 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -24,30 +24,31 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpioCookie* spiMuxGpios = new GpioCookie; + GpiodRegularByLabel* spiMuxBit = nullptr; /** Setting mux bit 1 to low will disable IC21 on the interface board */ - GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("SPI Mux Bit 1"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1, + "SPI Mux Bit 1", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("SPI Mux Bit 2"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2, + "SPI Mux Bit 2", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ - GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("SPI Mux Bit 3"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3, + "SPI Mux Bit 3", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); /** The following gpios can take arbitrary initial values */ - GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("SPI Mux Bit 4"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4); - GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("SPI Mux Bit 5"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5); - GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("SPI Mux Bit 6"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6); - GpiodRegular* enRwDecoder = new GpiodRegular(std::string("EN_RW_CS"), gpio::OUT, 1, - q7s::GPIO_FLEX_OBC1F_B1, q7s::EN_RW_CS); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4, + "SPI Mux Bit 4", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5, + "SPI Mux Bit 5", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6, + "SPI Mux Bit 6", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit); + GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1, + q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); result = gpioComInterface->addGpios(spiMuxGpios); diff --git a/fsfw b/fsfw index 8374d495..8e65d2d3 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8374d495fa4ca7208af5fd6e2273d9b52e7d9ee0 +Subproject commit 8e65d2d3fcbccc9cfda4803f9cf6461981266356 diff --git a/linux/archive/gpio/LinuxLibgpioIF.h b/linux/archive/gpio/LinuxLibgpioIF.h index a5015999..9c444e50 100644 --- a/linux/archive/gpio/LinuxLibgpioIF.h +++ b/linux/archive/gpio/LinuxLibgpioIF.h @@ -47,9 +47,9 @@ private: * @param gpioId The GPIO ID of the GPIO to drive. * @param logiclevel The logic level to set. O or 1. */ - ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); + ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, unsigned int logiclevel); - ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); + ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio); /** * @brief This function checks if GPIOs are already registered and whether diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index e69c63e5..1f54c5ec 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -298,8 +298,9 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { void SpiTestClass::acsInit() { GpioCookie* gpioCookie = new GpioCookie(); - GpiodRegular* gpio = nullptr; - #ifdef RASPBERRY_PI + +#ifdef RASPBERRY_PI + GpiodRegularByChip* gpio = nullptr; std::string rpiGpioName = "gpiochip0"; gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); @@ -328,42 +329,42 @@ void SpiTestClass::acsInit() { gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - #elif defined(XIPHOS_Q7S) - -gpio = new GpiodRegular("MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect); +#elif defined(XIPHOS_Q7S) + GpiodRegularByLabel* gpio = nullptr; + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect, + "MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular("MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect, + "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular("MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, - mgm2Lis3mdlChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, mgm2Lis3mdlChipSelect, + "MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular("MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect, + "MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - gpio = new GpiodRegular("GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - gyro0AdisChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro0AdisChipSelect, + "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular("GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect, + "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular("GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - gyro2AdisChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro2AdisChipSelect, "GYRO_2_ADIS", + gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular("GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect, + "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, - q7s::GPIO_GYRO_0_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, - q7s::GPIO_GYRO_2_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio); - #endif +#endif if (gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); } From 28040f85ccd61a3fb2703ca99b5f7033d16f849c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Sep 2021 19:28:22 +0200 Subject: [PATCH 03/23] fixes for new gpio update --- bsp_q7s/boardconfig/busConf.h | 7 +- bsp_q7s/core/ObjectFactory.cpp | 4 +- fsfw | 2 +- linux/archive/gpio/LinuxLibgpioIF.cpp | 3 + .../pollingSequenceFactory.cpp | 64 +++++++++---------- 5 files changed, 44 insertions(+), 36 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index f5b4a860..a86a6c79 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -28,10 +28,12 @@ static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 /** OBC1F B0 */ /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000"; +static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20; static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0; + static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 static constexpr uint32_t GPIO_RW_1_CS = 3; // G22 static constexpr uint32_t GPIO_RW_2_CS = 11; // E18 @@ -56,7 +58,10 @@ static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 /** OBC1F B1 */ /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000"; -static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1; +// Need to use chip name here for now because the label name is the name for +// gpiochip 5 and gpiochip6 +static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6"; +static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP; static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18 /**************************************************************/ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index cf17cb25..3f1d4c7d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -412,9 +412,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, + auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioChip); gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); diff --git a/fsfw b/fsfw index 8e65d2d3..3d1be94e 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8e65d2d3fcbccc9cfda4803f9cf6461981266356 +Subproject commit 3d1be94e120b76f7d1c86ff8f2a82e596f13c165 diff --git a/linux/archive/gpio/LinuxLibgpioIF.cpp b/linux/archive/gpio/LinuxLibgpioIF.cpp index 64ee2982..92ffa63c 100644 --- a/linux/archive/gpio/LinuxLibgpioIF.cpp +++ b/linux/archive/gpio/LinuxLibgpioIF.cpp @@ -10,6 +10,9 @@ LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { + struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000"); + + sif::debug << chip->name << std::endl; } LinuxLibgpioIF::~LinuxLibgpioIF() { diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 8a756a56..1b5ec2e3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,8 +425,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; if(enableAside) { // A side // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, @@ -440,16 +440,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -487,16 +487,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -509,16 +509,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ From da45326150f98c428efe94ecf310a496120c1629 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 09:22:06 +0200 Subject: [PATCH 04/23] bumped SW subversion --- common/config/OBSWVersion.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/config/OBSWVersion.h b/common/config/OBSWVersion.h index 1656eda0..5e9b1b9c 100644 --- a/common/config/OBSWVersion.h +++ b/common/config/OBSWVersion.h @@ -4,7 +4,7 @@ const char* const SW_NAME = "eive"; #define SW_VERSION 1 -#define SW_SUBVERSION 6 -#define SW_REVISION 1 +#define SW_SUBVERSION 7 +#define SW_REVISION 0 #endif /* COMMON_CONFIG_OBSWVERSION_H_ */ From e1ae1c021acacee92d4d87510a5170c27a152674 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 11:45:25 +0200 Subject: [PATCH 05/23] made more spi devices optional --- bsp_q7s/boardconfig/q7sConfig.h.in | 1 - bsp_q7s/core/ObjectFactory.cpp | 8 +- linux/fsfwconfig/OBSWConfig.h.in | 25 +++ .../pollingSequenceFactory.cpp | 188 ++++++++++-------- 4 files changed, 130 insertions(+), 92 deletions(-) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 40b5a510..43283ea1 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -28,7 +28,6 @@ // Probably better if this is disabled for mission code. Convenient for development #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 -#define Q7S_ADD_RTD_DEVICES 0 #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 3f1d4c7d..a6d6dda3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -129,13 +129,13 @@ void ObjectFactory::produce(void* args) { #endif /* OBSW_ADD_ACS_BOARD == 1 */ createHeaterComponents(); createSolarArrayDeploymentComponents(); -#if Q7S_ADD_SYRLINKS_HANDLER == 1 +#if OBSW_ADD_SYRLINKS == 1 createSyrlinksComponents(); -#endif /* Q7S_ADD_SYRLINKS_HANDLER == 1 */ +#endif /* OBSW_ADD_SYRLINKS == 1 */ -#if Q7S_ADD_RTD_DEVICES == 1 +#if OBSW_ADD_RTD_DEVICES == 1 createRtdComponents(); -#endif /* Q7S_ADD_RTD_DEVICES == 1 */ +#endif /* OBSW_ADD_RTD_DEVICES == 1 */ I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 7abe1ea8..bf5c1405 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -31,6 +31,8 @@ debugging. */ //! Timers can mess up the code when debugging //! All of this should be enabled for mission code! +#if defined XIPHOS_Q7S + #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 @@ -39,6 +41,29 @@ debugging. */ #define OBSW_ADD_ACS_BOARD 0 #define OBSW_ADD_GPS_0 0 #define OBSW_ADD_GPS_1 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_SYRLINKS 0 + +#elif defined RASPBERRY_PI + +#define OBSW_ENABLE_TIMERS 1 +#define OBSW_ADD_STAR_TRACKER 0 +#define OBSW_ADD_PLOC_SUPERVISOR 0 +#define OBSW_ADD_PLOC_MPSOC 0 +#define OBSW_ADD_SUN_SENSORS 0 +#define OBSW_ADD_ACS_BOARD 0 +#define OBSW_ADD_GPS_0 0 +#define OBSW_ADD_GPS_1 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_SYRLINKS 0 + +#endif /*******************************************************************/ /** All of the following flags should be disabled for mission code */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 1b5ec2e3..1f74cca6 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -28,12 +28,14 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { uint32_t length = thisSequence->getPeriodMs(); - + static_cast(length); +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC5, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -50,11 +52,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC17, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC18, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.2, DeviceHandlerIF::SEND_WRITE); @@ -71,11 +75,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.2, DeviceHandlerIF::SEND_WRITE); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -92,11 +98,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.6, DeviceHandlerIF::SEND_READ); @@ -113,11 +121,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.6, DeviceHandlerIF::SEND_READ); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.8, DeviceHandlerIF::GET_READ); @@ -134,14 +144,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.8, DeviceHandlerIF::GET_READ); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_RAD_SENSORS == 1 /* Radiation sensor */ thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); +#endif #if OBSW_ADD_SUN_SENSORS == 1 /** @@ -400,6 +412,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ); #endif +#if OBSW_ADD_RW == 1 thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW1, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -408,70 +421,71 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW2, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW2, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW2, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW2, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW3, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW3, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW3, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW3, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW4, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW4, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW4, length * 0.85, DeviceHandlerIF::GET_READ); +#endif #if OBSW_ADD_ACS_BOARD == 1 bool enableAside = false; bool enableBside = true; if(enableAside) { // A side -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + 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::MGM_0_LIS3_HANDLER, length * 0.2, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); - - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - // DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, - // DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, - // DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - // DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, - // DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } if(enableBside) { @@ -480,45 +494,45 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.205, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + 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::MGM_3_RM3100_HANDLER, length * 0.2, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.210, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// 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.2, - // DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, - // DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, - // DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, - // DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.215, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ @@ -580,7 +594,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::GET_READ); #endif -#if Q7S_ADD_SYRLINKS_HANDLER == 1 +#if OBSW_ADD_SYRLINKS == 1 uartPstEmpty = false; thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); From d6e22e7d4d34b754f5598af01b405b91508e4c36 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 11:48:56 +0200 Subject: [PATCH 06/23] trying other timing --- .../pollingSequenceFactory.cpp | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 1f74cca6..78c613de 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -439,20 +439,20 @@ 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, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); } if(enableBside) { @@ -503,7 +503,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.205, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); @@ -514,7 +514,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.210, +// 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); @@ -525,7 +525,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.215, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); From f9050ab185929eb9ee151b94353db29104e4743a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 12:19:45 +0200 Subject: [PATCH 07/23] fixes for RPi code --- bsp_linux_board/ObjectFactory.cpp | 5 +-- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 16 ++++---- linux/boardtest/SpiTestClass.h | 11 ++--- .../pollingSequenceFactory.cpp | 40 +++++++++---------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 60ca5b6e..19b0d9e4 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -14,9 +14,6 @@ #include "mission/core/GenericFactory.h" #include "mission/utility/TmFunnel.h" #include -#include - -#include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/GyroADIS16507Handler.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h" @@ -34,6 +31,8 @@ #include "fsfw/osal/common/UdpTcPollingTask.h" #endif +#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" +#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/rpi/GpioRPi.h" diff --git a/fsfw b/fsfw index 3d1be94e..5c56eda6 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 3d1be94e120b76f7d1c86ff8f2a82e596f13c165 +Subproject commit 5c56eda61077e3aef00d32133c5546987b476e8c diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 1f54c5ec..8a340ecb 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -206,7 +206,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { /* Configure all SPI chip selects and pull them high */ acsInit(); - l3gId = gyro3L3gd20ChipSelect; + l3gId = gyro1L3gd20ChipSelect; /* Adapt accordingly */ if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) { @@ -302,31 +302,31 @@ void SpiTestClass::acsInit() { #ifdef RASPBERRY_PI GpiodRegularByChip* gpio = nullptr; std::string rpiGpioName = "gpiochip0"; - gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", + gpio = new GpiodRegularByChip(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", + gpio = new GpiodRegularByChip(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", + gpio = new GpiodRegularByChip(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", + gpio = new GpiodRegularByChip(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", + gpio = new GpiodRegularByChip(rpiGpioName, gyro3L3gd20ChipSelect, "GYRO_2_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", + gpio = new GpiodRegularByChip(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", + gpio = new GpiodRegularByChip(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); #elif defined(XIPHOS_Q7S) diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index d5309a1e..7ccc2eb7 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -45,11 +45,12 @@ private: /* ACS board specific variables */ #ifdef RASPBERRY_PI - uint8_t mgm0Lis3mdlChipSelect = 0; - uint8_t mgm1Rm3100ChipSelect = 1; - uint8_t gyro0AdisChipSelect = 5; - uint8_t gyro1L3gd20ChipSelect = 6; - uint8_t gyro2L3gd20ChipSelect = 4; + uint8_t mgm0Lis3mdlChipSelect = 2; + uint8_t mgm1Rm3100ChipSelect = 3; + uint8_t gyro0AdisChipSelect = 4; + uint8_t gyro1L3gd20ChipSelect = 5; + int8_t gyro2AdisChipSelect = 6; + uint8_t gyro3L3gd20ChipSelect = 16; uint8_t mgm2Lis3mdlChipSelect = 17; uint8_t mgm3Rm3100ChipSelect = 27; #elif defined(XIPHOS_Q7S) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 78c613de..3219b984 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -454,16 +454,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// 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); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } if(enableBside) { From dbcf4f5d699f043f98cded492bbe82e13265b0e0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 12:29:43 +0200 Subject: [PATCH 08/23] more improvements for RPi code --- bsp_linux_board/InitMission.cpp | 6 ++++-- bsp_linux_board/ObjectFactory.cpp | 10 +++++----- linux/boardtest/SpiTestClass.h | 17 +++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index febae2f3..48e91013 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -135,6 +135,7 @@ void initmission::initTasks() { } bool startTestPst = true; + static_cast(startTestPst); #if OBSW_ADD_TEST_PST == 1 FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); @@ -145,14 +146,14 @@ void initmission::initTasks() { } #endif /* RPI_TEST_ACS_BOARD == 1 */ + +#if OBSW_ADD_TEST_CODE == 1 PeriodicTaskIF* testTask = factory->createPeriodicTask( "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); -#if OBSW_ADD_TEST_CODE == 1 result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } -#endif /* OBSW_ADD_TEST_CODE == 1 */ #if RPI_ADD_SPI_TEST == 1 result = testTask->addComponent(objects::SPI_TEST); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -171,6 +172,7 @@ void initmission::initTasks() { initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } #endif /* RPI_ADD_GPIO_TEST == 1 */ +#endif /* OBSW_ADD_TEST_CODE == 1 */ sif::info << "Starting tasks.." << std::endl; tmTcDistributor->startTask(); diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 19b0d9e4..5597242c 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -132,20 +132,20 @@ void ObjectFactory::produce(void* args){ spiDev = "/dev/spidev0.0"; spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie); + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); mgmRm3100Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie); + spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #endif /* RPI_TEST_ACS_BOARD == 1 */ diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index 7ccc2eb7..45a7cdd8 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -45,14 +45,15 @@ private: /* ACS board specific variables */ #ifdef RASPBERRY_PI - uint8_t mgm0Lis3mdlChipSelect = 2; - uint8_t mgm1Rm3100ChipSelect = 3; - uint8_t gyro0AdisChipSelect = 4; - uint8_t gyro1L3gd20ChipSelect = 5; - int8_t gyro2AdisChipSelect = 6; - uint8_t gyro3L3gd20ChipSelect = 16; - uint8_t mgm2Lis3mdlChipSelect = 17; - uint8_t mgm3Rm3100ChipSelect = 27; + uint8_t mgm0Lis3mdlChipSelect = gpio::MGM_0_BCM_PIN; + uint8_t mgm1Rm3100ChipSelect = gpio::MGM_1_BCM_PIN; + uint8_t mgm2Lis3mdlChipSelect = gpio::MGM_2_BCM_PIN; + uint8_t mgm3Rm3100ChipSelect = gpio::MGM_3_BCM_PIN; + + uint8_t gyro0AdisChipSelect = gpio::GYRO_0_BCM_PIN; + uint8_t gyro1L3gd20ChipSelect = gpio::GYRO_1_BCM_PIN; + uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN; + uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN; #elif defined(XIPHOS_Q7S) uint8_t mgm0Lis3mdlChipSelect = q7s::GPIO_MGM_0_LIS3_CS; uint8_t mgm1Rm3100ChipSelect = q7s::GPIO_MGM_1_RM3100_CS; From 9a165448360afb0e8fab299f6924e3233ab8b001 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 14:04:39 +0200 Subject: [PATCH 09/23] cleaning up RPi code --- bsp_linux_board/InitMission.cpp | 89 +++++++++---- bsp_linux_board/InitMission.h | 13 ++ bsp_linux_board/ObjectFactory.cpp | 120 +++++++++++------- bsp_linux_board/ObjectFactory.h | 2 + .../pollingSequenceFactory.cpp | 111 +++------------- 5 files changed, 174 insertions(+), 161 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 48e91013..1adc8a2b 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -36,6 +36,7 @@ void initmission::initMission() { void initmission::initTasks() { TaskFactory* factory = TaskFactory::instance(); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; if(factory == nullptr) { /* Should never happen ! */ return; @@ -46,11 +47,11 @@ void initmission::initTasks() { void (*missedDeadlineFunc) (void) = nullptr; #endif + /* TMTC Distribution */ PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( "DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); - ReturnValue_t result = tmTcDistributor->addComponent( - objects::CCSDS_PACKET_DISTRIBUTOR); + result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } @@ -146,9 +147,68 @@ void initmission::initTasks() { } #endif /* RPI_TEST_ACS_BOARD == 1 */ + std::vector pstTasks; + createPstTasks(*factory, missedDeadlineFunc, pstTasks); +#if OBSW_ADD_TEST_CODE == 1 + std::vector testTasks; + createTestTasks(*factory, missedDeadlineFunc, pstTasks); +#endif /* OBSW_ADD_TEST_CODE == 1 */ + + auto taskStarter = [](std::vector& taskVector, std::string name) { + for(const auto& task: taskVector) { + if(task != nullptr) { + task->startTask(); + } + else { + sif::error << "Task in vector " << name << " is invalid!" << std::endl; + } + } + }; + + sif::info << "Starting tasks.." << std::endl; + tmTcDistributor->startTask(); + udpBridgeTask->startTask(); + udpPollingTask->startTask(); + + pusVerification->startTask(); + pusEvents->startTask(); + pusHighPrio->startTask(); + pusMedPrio->startTask(); + pusLowPrio->startTask(); #if OBSW_ADD_TEST_CODE == 1 - PeriodicTaskIF* testTask = factory->createPeriodicTask( + taskStarter(testTasks, "Test Tasks"); +#endif /* OBSW_ADD_TEST_CODE == 1 */ + taskStarter(pstTasks, "PST Tasks"); + +#if OBSW_ADD_TEST_PST == 1 + if(startTestPst) { + pstTestTask->startTask(); + } +#endif /* RPI_TEST_ACS_BOARD == 1 */ + sif::info << "Tasks started.." << std::endl; +} + +void initmission::createPstTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; +#if OBSW_ADD_SPI_TEST_CODE == 0 + FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( + "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, + missedDeadlineFunc); + result = pst::pstSpi(spiPst); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; + } + taskVec.push_back(spiPst); +#endif +} + +void initmission::createTestTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* testTask = factory.createPeriodicTask( "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -172,27 +232,4 @@ void initmission::initTasks() { initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } #endif /* RPI_ADD_GPIO_TEST == 1 */ -#endif /* OBSW_ADD_TEST_CODE == 1 */ - - sif::info << "Starting tasks.." << std::endl; - tmTcDistributor->startTask(); - udpBridgeTask->startTask(); - udpPollingTask->startTask(); - - pusVerification->startTask(); - pusEvents->startTask(); - pusHighPrio->startTask(); - pusMedPrio->startTask(); - pusLowPrio->startTask(); - -#if OBSW_ADD_TEST_CODE == 1 - testTask->startTask(); -#endif /* OBSW_ADD_TEST_CODE == 1 */ - -#if OBSW_ADD_TEST_PST == 1 - if(startTestPst) { - pstTestTask->startTask(); - } -#endif /* RPI_TEST_ACS_BOARD == 1 */ - sif::info << "Tasks started.." << std::endl; } diff --git a/bsp_linux_board/InitMission.h b/bsp_linux_board/InitMission.h index 01c72008..aaeea8c1 100644 --- a/bsp_linux_board/InitMission.h +++ b/bsp_linux_board/InitMission.h @@ -1,9 +1,22 @@ #ifndef BSP_LINUX_INITMISSION_H_ #define BSP_LINUX_INITMISSION_H_ +#include "fsfw/tasks/Typedef.h" +#include + +class PeriodicTaskIF; +class TaskFactory; + namespace initmission { void initMission(); void initTasks(); + +void createPstTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec); +void createTestTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec); }; #endif /* BSP_LINUX_INITMISSION_H_ */ diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 5597242c..5c6b5f47 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -81,7 +81,82 @@ void ObjectFactory::produce(void* args){ SpiCookie* spiCookie = nullptr; static_cast(spiCookie); +#if OBSW_ADD_ACS_BOARD == 1 + if(gpioCookie == nullptr) { + gpioCookie = new GpioCookie(); + } + // TODO: Missing pin for Gyro 2 + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, + "MGM_0_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, + "MGM_1_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, + "MGM_2_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, + "MGM_3_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, + "GYRO_0_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, + "GYRO_1_L3G", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, + "GYRO_2_L3G", gpio::Direction::OUT, 1); + gpioIF->addGpios(gpioCookie); + + spiDev = "/dev/spidev0.1"; + spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); + adisHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); + gyroL3gHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); + gyroL3gHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + adisHandler = new GyroADIS16507Handler(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie); + gyroL3gHandler->setStartUpImmediately(); + +#endif /* RPI_TEST_ACS_BOARD == 1 */ + #if OBSW_ADD_TEST_CODE == 1 + createTestTasks(); +#endif /* OBSW_ADD_TEST_CODE == 1 */ +} + +void ObjectFactory::createTestTasks() { + new TestTask(objects::TEST_TASK); #if RPI_ADD_SPI_TEST == 1 @@ -108,48 +183,6 @@ void ObjectFactory::produce(void* args){ new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback); #endif /* RPI_LOOPBACK_TEST_GPIO == 1 */ -#if RPI_TEST_ACS_BOARD == 1 - if(gpioCookie == nullptr) { - gpioCookie = new GpioCookie(); - } - // TODO: Missing pin for Gyro 2 - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, - "MGM_0_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, - "MGM_1_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, - "MGM_2_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, - "MGM_3_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, - "GYRO_0_ADIS", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, - "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, - "GYRO_2_L3G", gpio::Direction::OUT, 1); - gpioIF->addGpios(gpioCookie); - - spiDev = "/dev/spidev0.0"; - spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, - MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); - mgmLis3Handler->setStartUpImmediately(); - - spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, - RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); - mgmRm3100Handler->setStartUpImmediately(); - - spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); - gyroL3gHandler->setStartUpImmediately(); - -#endif /* RPI_TEST_ACS_BOARD == 1 */ - #if RPI_TEST_ADIS16507 == 1 if(gpioCookie == nullptr) { gpioCookie = new GpioCookie(); @@ -158,7 +191,7 @@ void ObjectFactory::produce(void* args){ "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookie); - spiDev = "/dev/spidev0.0"; + spiDev = "/dev/spidev0.1"; spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr); @@ -176,5 +209,4 @@ void ObjectFactory::produce(void* args){ gpsHandler->setStartUpImmediately(); #endif -#endif /* OBSW_ADD_TEST_CODE == 1 */ } diff --git a/bsp_linux_board/ObjectFactory.h b/bsp_linux_board/ObjectFactory.h index feaba70e..3b9aca49 100644 --- a/bsp_linux_board/ObjectFactory.h +++ b/bsp_linux_board/ObjectFactory.h @@ -5,6 +5,8 @@ namespace ObjectFactory { void setStatics(); void produce(void* args); + + void createTestTasks(); }; #endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 3219b984..47851b0d 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -443,27 +443,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool enableBside = false; if(enableAside) { // A side -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + 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); @@ -722,77 +722,6 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) { /* Length of a communication cycle */ uint32_t length = thisSequence->getPeriodMs(); bool notEmpty = false; -#if OBSW_ADD_ACS_BOARD == 1 - notEmpty = true; - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); -#endif #if RPI_TEST_ADIS16507 == 1 notEmpty = true; From af9a9b837a00417a081bb32b9612d383257c7257 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 14:10:21 +0200 Subject: [PATCH 10/23] added missing GPIO --- bsp_linux_board/ObjectFactory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 5c6b5f47..419bb6d8 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -98,8 +98,10 @@ void ObjectFactory::produce(void* args){ "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, - "GYRO_2_L3G", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN, + "GYRO_2_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, + "GYRO_3_L3G", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookie); spiDev = "/dev/spidev0.1"; From 1284d102570ad234c7721f9d714d024960200588 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 14:27:01 +0200 Subject: [PATCH 11/23] RPI updates --- bsp_linux_board/InitMission.cpp | 158 +++++++++++++++++--------------- bsp_linux_board/InitMission.h | 2 + 2 files changed, 87 insertions(+), 73 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 1adc8a2b..b81754a7 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -79,73 +79,8 @@ void initmission::initTasks() { } /* PUS Services */ - PeriodicTaskIF* pusVerification = factory->createPeriodicTask( - "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); - if(result != HasReturnvaluesIF::RETURN_OK){ - sif::error << "Object add component failed" << std::endl; - } - - PeriodicTaskIF* pusEvents = factory->createPeriodicTask( - "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); - if(result != HasReturnvaluesIF::RETURN_OK){ - initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING); - } - - PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( - "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS); - } - result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); - } - - PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask( - "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); - result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT); - } - result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT); - } - result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); - } - result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); - } - - PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( - "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); - result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); - } - result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("INT_ERR_RPRT", - objects::INTERNAL_ERROR_REPORTER); - } - - bool startTestPst = true; - static_cast(startTestPst); -#if OBSW_ADD_TEST_PST == 1 - FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, - PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); - result = pst::pstTest(pstTestTask); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; - startTestPst = false; - } -#endif /* RPI_TEST_ACS_BOARD == 1 */ + std::vector pusTasks; + createPstTasks(*factory, missedDeadlineFunc, pusTasks); std::vector pstTasks; createPstTasks(*factory, missedDeadlineFunc, pstTasks); @@ -170,12 +105,7 @@ void initmission::initTasks() { udpBridgeTask->startTask(); udpPollingTask->startTask(); - pusVerification->startTask(); - pusEvents->startTask(); - pusHighPrio->startTask(); - pusMedPrio->startTask(); - pusLowPrio->startTask(); - + taskStarter(pusTasks, "PUS Tasks"); #if OBSW_ADD_TEST_CODE == 1 taskStarter(testTasks, "Test Tasks"); #endif /* OBSW_ADD_TEST_CODE == 1 */ @@ -189,6 +119,75 @@ void initmission::initTasks() { sif::info << "Tasks started.." << std::endl; } +void initmission::createPusTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* pusVerification = factory.createPeriodicTask( + "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + taskVec.push_back(pusVerification); + + PeriodicTaskIF* pusEvents = factory.createPeriodicTask( + "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING); + } + result = pusEvents->addComponent(objects::EVENT_MANAGER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER); + } + taskVec.push_back(pusEvents); + + PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask( + "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS); + } + result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); + } + taskVec.push_back(pusHighPrio); + + PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask( + "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); + result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); + } + taskVec.push_back(pusMedPrio); + + PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask( + "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); + result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); + } + result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("INT_ERR_RPRT", + objects::INTERNAL_ERROR_REPORTER); + } + taskVec.push_back(pusLowPrio); +} + void initmission::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; @@ -232,4 +231,17 @@ void initmission::createTestTasks(TaskFactory& factory, initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } #endif /* RPI_ADD_GPIO_TEST == 1 */ + + bool startTestPst = true; + static_cast(startTestPst); +#if OBSW_ADD_TEST_PST == 1 + FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, + PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); + result = pst::pstTest(pstTestTask); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; + startTestPst = false; + } +#endif /* RPI_TEST_ACS_BOARD == 1 */ + } diff --git a/bsp_linux_board/InitMission.h b/bsp_linux_board/InitMission.h index aaeea8c1..f5da5855 100644 --- a/bsp_linux_board/InitMission.h +++ b/bsp_linux_board/InitMission.h @@ -17,6 +17,8 @@ void createPstTasks(TaskFactory& factory, void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec); +void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector& taskVec); }; #endif /* BSP_LINUX_INITMISSION_H_ */ From 413108497337019a53ae9b7def7875596a426b71 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 15:43:11 +0200 Subject: [PATCH 12/23] several tweaks and fixes --- bsp_linux_board/InitMission.cpp | 6 +-- bsp_linux_board/ObjectFactory.cpp | 36 +++++++++++++---- bsp_linux_board/boardconfig/rpiConfig.h.in | 11 ++--- fsfw | 2 +- .../pollingSequenceFactory.cpp | 40 +++++++++---------- 5 files changed, 59 insertions(+), 36 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index b81754a7..d265fded 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -80,7 +80,7 @@ void initmission::initTasks() { /* PUS Services */ std::vector pusTasks; - createPstTasks(*factory, missedDeadlineFunc, pusTasks); + createPusTasks(*factory, missedDeadlineFunc, pusTasks); std::vector pstTasks; createPstTasks(*factory, missedDeadlineFunc, pstTasks); @@ -193,7 +193,7 @@ void initmission::createPstTasks(TaskFactory& factory, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; #if OBSW_ADD_SPI_TEST_CODE == 0 FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( - "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, + "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc); result = pst::pstSpi(spiPst); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -235,7 +235,7 @@ void initmission::createTestTasks(TaskFactory& factory, bool startTestPst = true; static_cast(startTestPst); #if OBSW_ADD_TEST_PST == 1 - FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, + FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); result = pst::pstTest(pstTestTask); if(result != HasReturnvaluesIF::RETURN_OK) { diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 419bb6d8..1d3e0b31 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -64,10 +64,12 @@ void ObjectFactory::produce(void* args){ ObjectFactory::produceGenericObjects(); #if OBSW_USE_TMTC_TCP_BRIDGE == 1 - new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + tmtcBridge->setMaxNumberOfPacketsStored(50); new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); #else - new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + tmtcBridge->setMaxNumberOfPacketsStored(50); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); #endif @@ -110,24 +112,36 @@ void ObjectFactory::produce(void* args){ auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmRm3100Handler->setStartUpImmediately(); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmRm3100Handler->setStartUpImmediately(); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); @@ -139,16 +153,24 @@ void ObjectFactory::produce(void* args){ auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1 + gyroL3gHandler->setToGoToNormalMode(true); +#endif + spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); - gyroL3gHandler->setStartUpImmediately(); + adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); + adisHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - adisHandler = new GyroADIS16507Handler(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1 + gyroL3gHandler->setToGoToNormalMode(true); +#endif #endif /* RPI_TEST_ACS_BOARD == 1 */ diff --git a/bsp_linux_board/boardconfig/rpiConfig.h.in b/bsp_linux_board/boardconfig/rpiConfig.h.in index 5198ddb7..7341fcca 100644 --- a/bsp_linux_board/boardconfig/rpiConfig.h.in +++ b/bsp_linux_board/boardconfig/rpiConfig.h.in @@ -19,13 +19,14 @@ /* Adapt these values accordingly */ namespace gpio { -static constexpr uint8_t MGM_0_BCM_PIN = 0; -static constexpr uint8_t MGM_1_BCM_PIN = 1; -static constexpr uint8_t MGM_2_BCM_PIN = 17; -static constexpr uint8_t MGM_3_BCM_PIN = 27; +static constexpr uint8_t MGM_0_BCM_PIN = 17; +static constexpr uint8_t MGM_1_BCM_PIN = 27; +static constexpr uint8_t MGM_2_BCM_PIN = 22; +static constexpr uint8_t MGM_3_BCM_PIN = 23; static constexpr uint8_t GYRO_0_BCM_PIN = 5; static constexpr uint8_t GYRO_1_BCM_PIN = 6; -static constexpr uint8_t GYRO_2_BCM_PIN = 4; +static constexpr uint8_t GYRO_2_BCM_PIN = 13; +static constexpr uint8_t GYRO_3_BCM_PIN = 19; } #endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */ diff --git a/fsfw b/fsfw index 5c56eda6..d3b83f3c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5c56eda61077e3aef00d32133c5546987b476e8c +Subproject commit d3b83f3cf9d702f76ddc5a00ac715dc3a9ef5343 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 47851b0d..611928f3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -443,16 +443,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool enableBside = false; if(enableAside) { // A side - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); } if(enableBside) { From 0b50d9aedf9b38a5f45b7c4c5880b19558ea9b40 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 16:00:31 +0200 Subject: [PATCH 13/23] fix for ADIS device --- bsp_linux_board/ObjectFactory.cpp | 4 +-- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + .../pollingSequenceFactory.cpp | 32 +++++++++---------- mission/devices/GyroADIS16507Handler.cpp | 7 ++-- mission/devices/GyroADIS16507Handler.h | 8 +++-- .../GyroADIS16507Definitions.h | 1 + 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 1d3e0b31..5cd52c91 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -144,7 +144,7 @@ void ObjectFactory::produce(void* args){ #endif spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); adisHandler->setStartUpImmediately(); @@ -158,7 +158,7 @@ void ObjectFactory::produce(void* args){ #endif spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); adisHandler->setStartUpImmediately(); diff --git a/fsfw b/fsfw index d3b83f3c..c51d2df4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d3b83f3cf9d702f76ddc5a00ac715dc3a9ef5343 +Subproject commit c51d2df43dca317175a9448e662f7f469e5f8725 diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 7314b275..1b8251da 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -78,5 +78,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #define FSFW_HAL_RM3100_MGM_DEBUG 0 #define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 +#define FSFW_HAL_ADIS16507_GYRO_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 611928f3..646b8633 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -454,28 +454,28 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, +// 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_3_L3G_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, diff --git a/mission/devices/GyroADIS16507Handler.cpp b/mission/devices/GyroADIS16507Handler.cpp index 793aad66..02e69eaf 100644 --- a/mission/devices/GyroADIS16507Handler.cpp +++ b/mission/devices/GyroADIS16507Handler.cpp @@ -1,8 +1,7 @@ +#include "GyroADIS16507Handler.h" #include #include -#include "GyroADIS16507Handler.h" - #if OBSW_ADIS16507_LINUX_COM_IF == 1 #include "fsfw_hal/linux/utility.h" #include "fsfw_hal/linux/spi/SpiCookie.h" @@ -16,7 +15,7 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId, object_id_t deviceCommunication, CookieIF * comCookie): DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this), configDataset(this), breakCountdown() { -#if OBSW_DEBUG_ADIS16507 == 1 +#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1 debugDivider = new PeriodicOperationDivider(5); #endif @@ -285,7 +284,7 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) { primaryDataset.setValidity(true, true); } -#if OBSW_DEBUG_ADIS16507 == 1 +#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1 if(debugDivider->checkAndIncrement()) { sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl; sif::info << "X: " << primaryDataset.angVelocX.value << std::endl; diff --git a/mission/devices/GyroADIS16507Handler.h b/mission/devices/GyroADIS16507Handler.h index 41be5734..467e0906 100644 --- a/mission/devices/GyroADIS16507Handler.h +++ b/mission/devices/GyroADIS16507Handler.h @@ -1,11 +1,13 @@ #ifndef MISSION_DEVICES_GYROADIS16507HANDLER_H_ #define MISSION_DEVICES_GYROADIS16507HANDLER_H_ -#include #include "OBSWConfig.h" -#include "fsfw/devicehandlers/DeviceHandlerBase.h" +#include "FSFWConfig.h" #include "devicedefinitions/GyroADIS16507Definitions.h" +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" +#include "fsfw/devicehandlers/DeviceHandlerBase.h" + #if OBSW_ADIS16507_LINUX_COM_IF == 1 class SpiComIF; class SpiCookie; @@ -69,7 +71,7 @@ private: const uint8_t *sendData, size_t sendLen, void* args); #endif -#if OBSW_DEBUG_ADIS16507 == 1 +#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1 PeriodicOperationDivider* debugDivider; #endif Countdown breakCountdown; diff --git a/mission/devices/devicedefinitions/GyroADIS16507Definitions.h b/mission/devices/devicedefinitions/GyroADIS16507Definitions.h index a7970b81..b83c984d 100644 --- a/mission/devices/devicedefinitions/GyroADIS16507Definitions.h +++ b/mission/devices/devicedefinitions/GyroADIS16507Definitions.h @@ -1,6 +1,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ +#include "fsfw/devicehandlers/DeviceHandlerIF.h" #include "fsfw/datapoollocal/StaticLocalDataSet.h" #include From ee878d9fe9205cdf1146cb8586dd6279c0a12782 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 16:14:33 +0200 Subject: [PATCH 14/23] bugfix EIVE PST --- .../pollingSequenceFactory.cpp | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 646b8633..fdbdd52e 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -443,27 +443,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool enableBside = false; if(enableAside) { // A side -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + 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); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } if(enableBside) { From 7b7bd7670369719865e771004c55f6238b68082e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 18:38:06 +0200 Subject: [PATCH 15/23] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index c51d2df4..29c74283 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c51d2df43dca317175a9448e662f7f469e5f8725 +Subproject commit 29c74283f117bb68186d1161896d82e3361680c2 From c035a2605176eef1f9e3892aa6168ee66cda87f5 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 23 Sep 2021 10:51:47 +0200 Subject: [PATCH 16/23] gpio open by line name test on te0720 --- bsp_q7s/core/ObjectFactory.cpp | 5 ++++- linux/fsfwconfig/OBSWConfig.h.in | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a6d6dda3..873b1b32 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -835,9 +835,12 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { #endif #if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 -#if OBSW_TEST_GPIO_LABEL == 1 +#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1 /* Configure MIO0 as input */ GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0); +#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME + GpiodRegularByLineName* testGpio = new GpiodRegularByLineName("test-name", "gpio-test", + gpio::OUT, 0); #else /* Configure MIO0 as input */ GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0); diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index bf5c1405..4feb45e2 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -84,7 +84,8 @@ debugging. */ #define OBSW_TEST_CCSDS_BRIDGE 0 #define OBSW_TEST_CCSDS_PTME 0 #define OBSW_TEST_TE7020_HEATER 0 -#define OBSW_TEST_GPIO_LABEL 0 +#define OBSW_TEST_GPIO_OPEN_BY_LABEL 0 +#define OBSW_TEST_GPIO_OPEN_BY_LINE_NAME 0 #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 From e56a30df0650e7ebd5c83dc3a1138b4fb494facb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 13:13:46 +0200 Subject: [PATCH 17/23] HW bug fixes, board should work cleanly now --- bsp_q7s/core/ObjectFactory.cpp | 4 ++-- .../pollingSequenceFactory.cpp | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a6d6dda3..9c1b58d3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -490,7 +490,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 - gyroL3gHandler->setGoNormalModeAtStartup(); + gyroL3gHandler->setToGoToNormalMode(true); #endif // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, @@ -506,7 +506,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 - gyroL3gHandler->setGoNormalModeAtStartup(); + gyroL3gHandler->setToGoToNormalMode(true); #endif bool debugGps = false; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index fdbdd52e..642199da 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 = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; 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); From aa71159a9a2e3bbb565fbef8a3aada8a28f53e3f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 14:45:42 +0200 Subject: [PATCH 18/23] A side enabled by default --- linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 642199da..3b826119 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, From 0ccf062d51be57d42d1aaa96453b105bd50a71ef Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:20:55 +0200 Subject: [PATCH 19/23] transition delays --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++------ common/config/devConf.h | 5 ++++- fsfw | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 9c1b58d3..4223c8fc 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -442,7 +442,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::LIS3_TRANSITION_DELAY); mgmLis3Handler->setStartUpImmediately(); #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 mgmLis3Handler->setToGoToNormalMode(true); @@ -451,7 +451,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, - spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); + spiCookie, spi::RM3100_TRANSITION_DELAY); mgmRm3100Handler->setStartUpImmediately(); #if FSFW_HAL_RM3100_MGM_DEBUG == 1 mgmRm3100Handler->setToGoToNormalMode(true); @@ -460,7 +460,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::LIS3_TRANSITION_DELAY); mgmLis3Handler2->setStartUpImmediately(); #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 mgmLis3Handler2->setToGoToNormalMode(true); @@ -469,7 +469,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, - spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); + spiCookie, spi::RM3100_TRANSITION_DELAY); mgmRm3100Handler->setStartUpImmediately(); #if FSFW_HAL_RM3100_MGM_DEBUG == 1 mgmRm3100Handler->setToGoToNormalMode(true); @@ -487,7 +487,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::L3G_TRANSITION_DELAY); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 gyroL3gHandler->setToGoToNormalMode(true); @@ -503,7 +503,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::L3G_TRANSITION_DELAY); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 gyroL3gHandler->setToGoToNormalMode(true); diff --git a/common/config/devConf.h b/common/config/devConf.h index e1d95b5e..fbd9763b 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -10,14 +10,17 @@ */ namespace spi { -/* Default values, changing them is not supported for now */ +// Default values, changing them is not supported for now static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000; +static constexpr uint32_t LIS3_TRANSITION_DELAY = 10000; static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000; +static constexpr uint32_t RM3100_TRANSITION_DELAY = 10000; static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000; +static constexpr uint32_t L3G_TRANSITION_DELAY = 10000; static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; diff --git a/fsfw b/fsfw index 29c74283..c9b343eb 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 29c74283f117bb68186d1161896d82e3361680c2 +Subproject commit c9b343ebcd92de1d214a9b1d7abafee4a7e79888 From 0e68dbd86c49e3bfadf99f6ffd9d7b00b0cc260f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 23 Sep 2021 17:13:17 +0200 Subject: [PATCH 20/23] open mgm 2 lis3 chip select by name --- bsp_q7s/core/ObjectFactory.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 873b1b32..5e264d30 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -412,9 +412,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, - "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioChip); +// auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, +// "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); + auto gpioByLineName = new GpiodRegularByLineName("mgm_2_lis3_chip_select", "LIS3 Handler", gpio::OUT, + gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioByLineName); gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); From 11537f9988b0b19ae7ceac3c0ebc62355098d5a3 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 24 Sep 2021 09:42:20 +0200 Subject: [PATCH 21/23] mgm 2 lis3 chip select opened by name --- bsp_q7s/core/ObjectFactory.cpp | 8 ++++++-- fsfw | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 1fbf9a33..6d6358c3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,3 +1,5 @@ +#include + #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -414,8 +416,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); // auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, // "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); - auto gpioByLineName = new GpiodRegularByLineName("mgm_2_lis3_chip_select", "LIS3 Handler", gpio::OUT, - gpio::HIGH); + std::stringstream consumer; + consumer << std::hex << objects::MGM_2_LIS3_HANDLER; + auto gpioByLineName = new GpiodRegularByLineName("mgm_2_lis3_chip_select", consumer.str(), + gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioByLineName); gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); diff --git a/fsfw b/fsfw index c9b343eb..e7df5207 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c9b343ebcd92de1d214a9b1d7abafee4a7e79888 +Subproject commit e7df520780242f98f9a1189906c0ade1a8a99f29 From 9fd4c477f06084392f159ba94390c4015a8155d9 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sat, 25 Sep 2021 10:49:03 +0200 Subject: [PATCH 22/23] changed all gpio configurations to open by line name --- bsp_q7s/boardconfig/busConf.h | 37 ++++ bsp_q7s/core/ObjectFactory.cpp | 208 +++++++++++------- bsp_q7s/gpio/gpioCallbacks.cpp | 25 +-- fsfw | 2 +- .../pollingSequenceFactory.cpp | 4 +- 5 files changed, 173 insertions(+), 103 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index a86a6c79..c78125ea 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -95,6 +95,43 @@ static constexpr uint32_t SPI_MUX_BIT_5 = 17; static constexpr uint32_t SPI_MUX_BIT_6 = 9; static constexpr uint32_t EN_RW_CS = 17; +namespace gpioNames { + static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select"; + static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select"; + static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select"; + static constexpr char GYRO_3_L3G_CS[] = "gyro_3_l3g_chip_select"; + static constexpr char MGM_0_CS[] = "mgm_0_lis3_chip_select"; + static constexpr char MGM_1_CS[] = "mgm_1_rm3100_chip_select"; + static constexpr char MGM_2_CS[] = "mgm_2_lis3_chip_select"; + static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select"; + static constexpr char RESET_GNSS_0[] = "reset_gnss_0"; + static constexpr char RESET_GNSS_1[] = "reset_gnss_1"; + static constexpr char GYRO_0_ENABLE[] = "gyro_0_enable"; + static constexpr char GYRO_2_ENABLE[] = "gyro_2_enable"; + static constexpr char HEATER_0[] = "heater0"; + static constexpr char HEATER_1[] = "heater1"; + static constexpr char HEATER_2[] = "heater2"; + static constexpr char HEATER_3[] = "heater3"; + static constexpr char HEATER_4[] = "heater4"; + static constexpr char HEATER_5[] = "heater5"; + static constexpr char HEATER_6[] = "heater6"; + static constexpr char HEATER_7[] = "heater7"; + static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0"; + static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1"; + static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1"; + static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2"; + static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3"; + static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4"; + static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5"; + static constexpr char SPI_MUX_BIT_6_PIN[] = "spi_mux_bit_6"; + static constexpr char EN_RW_CS[] = "en_rw_cs"; + static constexpr char EN_RW_1[] = "enable_rw_1"; + static constexpr char EN_RW_2[] = "enable_rw_2"; + static constexpr char EN_RW_3[] = "enable_rw_3"; + static constexpr char EN_RW_4[] = "enable_rw_4"; + static constexpr char SPI_MUX_SELECT[] = "spi_mux_select"; + static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select"; +} } #endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 6d6358c3..44b27890 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -267,9 +267,11 @@ void ObjectFactory::createPcduComponents() { void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { GpioCookie* gpioCookieRadSensor = new GpioCookie; - auto chipSelectRadSensor = new GpiodRegularByLabel(q7s::GPIO_RAD_SENSOR_LABEL, - q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, gpio::HIGH); - gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); + std::stringstream consumer; + consumer << "0x" << std::hex << objects::RAD_SENSOR; + GpiodRegularByLineName* gpio = new GpiodRegularByLineName( + q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::OUT, gpio::HIGH); + gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio); gpioComIF->addGpios(gpioCookieRadSensor); SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, @@ -394,51 +396,79 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { GpioCookie* gpioCookieAcsBoard = new GpioCookie(); - GpiodRegularByLabel* gpio = nullptr; - gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_0_ADIS_CS, - "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); + + std::stringstream consumer; + GpiodRegularByLineName* gpio = nullptr; + consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS, - "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); + + consumer.str(""); + consumer << "0x" << std::hex << objects::GYRO_1_L3G_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_2_ADIS_CS, - "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); + + consumer.str(""); + consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS, - "CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH); + + consumer.str(""); + consumer << "0x" << std::hex << objects::GYRO_3_L3G_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS, - "CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH); + consumer.str(""); + consumer << "0x" << std::hex << objects::MGM_0_LIS3_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, - "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); + + consumer.str(""); + consumer << "0x" << std::hex << objects::MGM_1_RM3100_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); -// auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, -// "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); - std::stringstream consumer; - consumer << std::hex << objects::MGM_2_LIS3_HANDLER; - auto gpioByLineName = new GpiodRegularByLineName("mgm_2_lis3_chip_select", consumer.str(), + + consumer.str(""); + consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioByLineName); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, - "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + + consumer.str(""); + consumer << "0x" << std::hex << objects::MGM_3_RM3100_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); + consumer.str(""); + consumer << "0x" << std::hex << objects::GPS0_HANDLER; // GNSS reset pins are active low - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0, - "GNSS_0_NRESET", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1, - "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); + + consumer.str(""); + consumer << "0x" << std::hex << objects::GPS1_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::OUT, + gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); + consumer.str(""); + consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER; // Enable pins must be pulled low for regular operations - gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, - "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(), + gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, - "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); + + consumer.str(""); + consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), gpio::OUT, + gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio); // TODO: Add enable pins for GPS as soon as new interface board design is finished @@ -546,40 +576,43 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI void ObjectFactory::createHeaterComponents() { GpioCookie* heaterGpiosCookie = new GpioCookie; + GpiodRegularByLineName* gpio = nullptr; + std::stringstream consumer; + consumer << "0x" << std::hex << objects::HEATER_HANDLER; /* Pin H2-11 on stack connector */ - auto gpioConfigHeater0 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN, - "Heater0", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), gpio::OUT, + gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpio); /* Pin H2-12 on stack connector */ - auto gpioConfigHeater1 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN, - "Heater1", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), gpio::OUT, + gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpio); /* Pin H2-13 on stack connector */ - auto gpioConfigHeater2 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN, - "Heater2", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), gpio::OUT, + gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio); - auto gpioConfigHeater3 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN, - "Heater3", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(), + gpio::OUT, gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio); - auto gpioConfigHeater4 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN, - "Heater4", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(), + gpio::OUT, gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio); - auto gpioConfigHeater5 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN, - "Heater5", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(), + gpio::OUT, gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio); - auto gpioConfigHeater6 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN, - "Heater6", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(), + gpio::OUT, gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio); - auto gpioConfigHeater7 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN, - "Heater7", gpio::OUT, gpio::LOW); - heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); + gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(), + gpio::OUT, gpio::LOW); + heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN); @@ -587,13 +620,16 @@ void ObjectFactory::createHeaterComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() { GpioCookie* solarArrayDeplCookie = new GpioCookie; + GpiodRegularByLineName* gpio = nullptr; - auto gpioConfigDeplSA0 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, - q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, gpio::LOW); - solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0); - auto gpioConfigDeplSA1 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, - q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, gpio::LOW); - solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1); + std::stringstream consumer; + consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER; + gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0, + consumer.str(), gpio::OUT, gpio::LOW); + solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio); + gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::OUT, + gpio::LOW); + solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio); //TODO: Find out burn time. For now set to 1000 ms. new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF, @@ -772,35 +808,36 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); -// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); -// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); -// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); -// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); -// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); - auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, - "Enable reaction wheel 1", gpio::OUT, gpio::LOW); - gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); - auto enRw2 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS, - "Enable reaction wheel 2", gpio::OUT, gpio::LOW); - gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); - auto enRw3 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS, - "Enable reaction wheel 3", gpio::OUT, gpio::LOW); - gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3); - auto enRw4 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS, - "Enable reaction wheel 4", gpio::OUT, gpio::LOW); - gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4); + std::stringstream consumer; + GpiodRegularByLineName* gpio = nullptr; + consumer << "0x" << std::hex << objects::RW1; + gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio); + consumer.str(""); + consumer << "0x" << std::hex << objects::RW2; + gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio); + consumer.str(""); + consumer << "0x" << std::hex << objects::RW3; + gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio); + consumer.str(""); + consumer << "0x" << std::hex << objects::RW4; + gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio); /** * This GPIO is only internally connected to the SPI MUX module and responsible to disconnect * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core. * Per default the PS SPI is selected (EMIO = 0). */ - auto spiMux = new GpiodRegularByLabel(q7s::GPIO_RW_SPI_MUX_LABEL, - q7s::GPIO_RW_SPI_MUX_CS, "EMIO 0 SPI Mux", gpio::OUT, gpio::LOW); - gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux); + gpio = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_SELECT, + "SPI Reaction Wheel Callback ", gpio::OUT, gpio::LOW); + gpioCookieRw->addGpio(gpioIds::SPI_MUX, gpio); gpioComIF->addGpios(gpioCookieRw); @@ -820,6 +857,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1); rw1SpiCookie->setCallbackArgs(rwHandler1); + rwHandler1->setStartUpImmediately(); auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index da7c58e4..3787c829 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -24,31 +24,26 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpioCookie* spiMuxGpios = new GpioCookie; - GpiodRegularByLabel* spiMuxBit = nullptr; + GpiodRegularByLineName* spiMuxBit = nullptr; /** Setting mux bit 1 to low will disable IC21 on the interface board */ - spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1, - "SPI Mux Bit 1", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1", + gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2, - "SPI Mux Bit 2", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ - spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3, - "SPI Mux Bit 3", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); /** The following gpios can take arbitrary initial values */ - spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4, - "SPI Mux Bit 4", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); - spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5, - "SPI Mux Bit 5", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 5", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit); - spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6, - "SPI Mux Bit 6", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit); - GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1, - q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH); + GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS, + "EN_RW_CS", gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); result = gpioComInterface->addGpios(spiMuxGpios); diff --git a/fsfw b/fsfw index e7df5207..16b125ef 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e7df520780242f98f9a1189906c0ade1a8a99f29 +Subproject commit 16b125ef6cdfbe1349e5b21b783cd72c871372a8 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 3b826119..642199da 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 = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, From f0885fcb2ebbee0f9c168efc9a20a1a7f67f1104 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sat, 25 Sep 2021 11:09:29 +0200 Subject: [PATCH 23/23] removed unused gpio definitions in busConf.h --- bsp_q7s/boardconfig/busConf.h | 79 -------------------------------- linux/boardtest/SpiTestClass.cpp | 46 ++++++++----------- linux/boardtest/SpiTestClass.h | 9 ---- 3 files changed, 20 insertions(+), 114 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index c78125ea..1149a54e 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -16,85 +16,6 @@ static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8"; static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0"; static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; -/**************************************************************/ -/** OBC1E */ -/**************************************************************/ -static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "/amba_pl/gpio@42020000"; -static const char* const GPIO_GYRO_ADIS_LABEL = GPIO_MULTIPURPOSE_1V8_OBC1D; -static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20 -static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 - -/**************************************************************/ -/** OBC1F B0 */ -/**************************************************************/ -static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000"; -static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20; -static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; -static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; -static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0; - - -static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 -static constexpr uint32_t GPIO_RW_1_CS = 3; // G22 -static constexpr uint32_t GPIO_RW_2_CS = 11; // E18 -static constexpr uint32_t GPIO_RW_3_CS = 6; // B19 - -static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22 -static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21 -static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18 -static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16 -static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17 - -// Active low enable pin (needs to be driven low for regular operations) -static constexpr uint32_t GPIO_GYRO_0_ENABLE = 2; // H22 - -// Active low reset pin (needs to be driven high for regular operations) -static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22 -static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21 - -static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 - -/**************************************************************/ -/** OBC1F B1 */ -/**************************************************************/ -static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000"; -// Need to use chip name here for now because the label name is the name for -// gpiochip 5 and gpiochip6 -static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6"; -static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP; -static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18 - -/**************************************************************/ -/** OBC1C */ -/**************************************************************/ -static constexpr char GPIO_3V3_OBC1C[] = "/amba_pl/gpio@42040000"; -static const char* const GPIO_HEATER_LABEL = GPIO_3V3_OBC1C; -static const char* const GPIO_SOLAR_ARR_DEPL_LABEL = GPIO_3V3_OBC1C; -static constexpr uint32_t GPIO_HEATER_0_PIN = 6; -static constexpr uint32_t GPIO_HEATER_1_PIN = 12; -static constexpr uint32_t GPIO_HEATER_2_PIN = 7; -static constexpr uint32_t GPIO_HEATER_3_PIN = 5; -static constexpr uint32_t GPIO_HEATER_4_PIN = 3; -static constexpr uint32_t GPIO_HEATER_5_PIN = 0; -static constexpr uint32_t GPIO_HEATER_6_PIN = 1; -static constexpr uint32_t GPIO_HEATER_7_PIN = 11; -static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22 - -static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4; -static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2; - -static constexpr char GPIO_RW_SPI_MUX_LABEL[] = "zynq_gpio"; -// Uses EMIO interface to PL, starts at 54 -static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54; - -static constexpr uint32_t SPI_MUX_BIT_1 = 13; -static constexpr uint32_t SPI_MUX_BIT_2 = 14; -static constexpr uint32_t SPI_MUX_BIT_3 = 15; -static constexpr uint32_t SPI_MUX_BIT_4 = 16; -static constexpr uint32_t SPI_MUX_BIT_5 = 17; -static constexpr uint32_t SPI_MUX_BIT_6 = 9; -static constexpr uint32_t EN_RW_CS = 17; - namespace gpioNames { static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select"; static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select"; diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 8a340ecb..5168ba95 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -206,12 +206,6 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { /* Configure all SPI chip selects and pull them high */ acsInit(); - l3gId = gyro1L3gd20ChipSelect; - - /* Adapt accordingly */ - if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) { - sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl; - } gpioId_t currentGpioId = 0; uint8_t chipSelectPin = l3gId; uint8_t whoAmIReg = 0b0000'1111; @@ -330,39 +324,39 @@ void SpiTestClass::acsInit() { gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); #elif defined(XIPHOS_Q7S) - GpiodRegularByLabel* gpio = nullptr; - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect, - "MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH); + GpiodRegularByLineName* gpio = nullptr; + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, "MGM_0_LIS3", gpio::Direction::OUT, + gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect, - "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_1_RM3100", gpio::Direction::OUT, + gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, mgm2Lis3mdlChipSelect, - "MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, "MGM_2_LIS3", gpio::Direction::OUT, + gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect, - "MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_3_RM3100", gpio::Direction::OUT, + gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro0AdisChipSelect, - "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, "GYRO_0_ADIS", + gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect, - "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, "GYRO_1_L3G", gpio::Direction::OUT, + gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro2AdisChipSelect, "GYRO_2_ADIS", + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, "GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect, - "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, "GYRO_3_L3G", gpio::Direction::OUT, + gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, - "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_0_ENABLE", gpio::OUT, + gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, - "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_2_ENABLE", gpio::OUT, + gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio); #endif if (gpioIF != nullptr) { diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index 45a7cdd8..ffd56dd1 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -54,15 +54,6 @@ private: uint8_t gyro1L3gd20ChipSelect = gpio::GYRO_1_BCM_PIN; uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN; uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN; -#elif defined(XIPHOS_Q7S) - uint8_t mgm0Lis3mdlChipSelect = q7s::GPIO_MGM_0_LIS3_CS; - uint8_t mgm1Rm3100ChipSelect = q7s::GPIO_MGM_1_RM3100_CS; - uint8_t gyro0AdisChipSelect = q7s::GPIO_GYRO_0_ADIS_CS; - uint8_t gyro2AdisChipSelect = q7s::GPIO_GYRO_2_ADIS_CS; - uint8_t gyro1L3gd20ChipSelect = q7s::GPIO_GYRO_1_L3G_CS; - uint8_t gyro3L3gd20ChipSelect = q7s::GPIO_GYRO_3_L3G_CS; - uint8_t mgm2Lis3mdlChipSelect = q7s::GPIO_MGM_2_LIS3_CS; - uint8_t mgm3Rm3100ChipSelect = q7s::GPIO_MGM_3_RM3100_CS; #else uint8_t mgm0Lis3mdlChipSelect = 0; uint8_t mgm1Rm3100ChipSelect = 0;