From a563640a1434312c2b891a11d49158bd266b9ba1 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:07:17 -0400 Subject: [PATCH 01/68] Add load switch component --- .../Components/CMakeLists.txt | 1 + .../Components/LoadSwitch/CMakeLists.txt | 36 ++++++++++ .../Components/LoadSwitch/LoadSwitch.cpp | 28 ++++++++ .../Components/LoadSwitch/LoadSwitch.fpp | 60 +++++++++++++++++ .../Components/LoadSwitch/LoadSwitch.hpp | 42 ++++++++++++ .../Components/LoadSwitch/docs/sdd.md | 67 +++++++++++++++++++ 6 files changed, 234 insertions(+) create mode 100644 FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp create mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp create mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp create mode 100644 FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index b881a4a6..186ac4e0 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -8,3 +8,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/") diff --git a/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt b/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt new file mode 100644 index 00000000..5be47b2d --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp new file mode 100644 index 00000000..7476eba7 --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -0,0 +1,28 @@ +// ====================================================================== +// \title LoadSwitch.cpp +// \author kyang25 +// \brief cpp file for LoadSwitch component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp" + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +LoadSwitch ::LoadSwitch(const char* const compName) : LoadSwitchComponentBase(compName) {} + +LoadSwitch ::~LoadSwitch() {} + +// ---------------------------------------------------------------------- +// Handler implementations for commands +// ---------------------------------------------------------------------- + +void LoadSwitch ::TODO_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + // TODO + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); +} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp new file mode 100644 index 00000000..32ce8d7e --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -0,0 +1,60 @@ +module Components { + @ A generic load switch for controlling power to components + active component LoadSwitch { + + # One async command/port is required for active components + # This should be overridden by the developers with a useful command/port + @ TODO + async command TODO opcode 0 + + ############################################################################## + #### Uncomment the following examples to start customizing your component #### + ############################################################################## + + # @ Example async command + # async command COMMAND_NAME(param_name: U32) + + # @ Example telemetry counter + # telemetry ExampleCounter: U64 + + # @ Example event + # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + + # @ Example port: receiving calls from the rate group + # sync input port run: Svc.Sched + + # @ Example parameter + # param PARAMETER_NAME: U32 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending command registrations + command reg port cmdRegOut + + @ Port for receiving commands + command recv port cmdIn + + @ Port for sending command responses + command resp port cmdResponseOut + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + @ Port to return the value of a parameter + param get port prmGetOut + + @Port to set the value of a parameter + param set port prmSetOut + + } +} \ No newline at end of file diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp new file mode 100644 index 00000000..ae2e61d4 --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -0,0 +1,42 @@ +// ====================================================================== +// \title LoadSwitch.hpp +// \author kyang25 +// \brief hpp file for LoadSwitch component implementation class +// ====================================================================== + +#ifndef Components_LoadSwitch_HPP +#define Components_LoadSwitch_HPP + +#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" + +namespace Components { + +class LoadSwitch final : public LoadSwitchComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct LoadSwitch object + LoadSwitch(const char* const compName //!< The component name + ); + + //! Destroy LoadSwitch object + ~LoadSwitch(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for commands + // ---------------------------------------------------------------------- + + //! Handler implementation for command TODO + //! + //! TODO + void TODO_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq //!< The command sequence number + ) override; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md new file mode 100644 index 00000000..ccd6de36 --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -0,0 +1,67 @@ +# Components::LoadSwitch + +A generic load switch for controlling power to components + +## Usage Examples +Add usage examples here + +### Diagrams +Add diagrams here + +### Typical Usage +And the typical usage of the component here + +## Class Diagram +Add a class diagram here + +## Port Descriptions +| Name | Description | +|---|---| +|---|---| + +## Component States +| Name | Description | +|-------|--------------------------------------| +| Off | No power to the component | +| On | Power supplied to the component | +| Error | An error occurred in the load switch | + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|---|---| +|---|---| + +## Commands +| Name | Description | +|---|---| +|---|---| + +## Events +| Name | Description | +|---|---| +|---|---| + +## Telemetry +| Name | Description | +|---|---| +|---|---| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|---|---|---| +|---|---|---| + +## Change Log +| Date | Description | +|---|---| +|---| Initial Draft | \ No newline at end of file From 5d5648faba04dcca61c5d1a31c46c573ebe884a6 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:11:39 -0400 Subject: [PATCH 02/68] Fix tables --- FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md index ccd6de36..92c0064d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -50,13 +50,11 @@ Add sequence diagrams here |---|---| ## Unit Tests -Add unit test descriptions in the chart below | Name | Description | Output | Coverage | |---|---|---|---| |---|---|---|---| ## Requirements -Add requirements in the chart below | Name | Description | Validation | |---|---|---| |---|---|---| From 8f00e037a3783a5b4ab39be9f86b8792d92dd479 Mon Sep 17 00:00:00 2001 From: sarah Date: Wed, 22 Oct 2025 20:33:26 -0400 Subject: [PATCH 03/68] Sarah Kevin MoMata Squad Load Switch --- .../Components/LoadSwitch/LoadSwitch.fpp | 5 +++++ .../Components/LoadSwitch/docs/sdd.md | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 32ce8d7e..de5f76a0 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -13,15 +13,20 @@ module Components { # @ Example async command # async command COMMAND_NAME(param_name: U32) + async command TURN_ON() + async command TURN_OFF() # @ Example telemetry counter # telemetry ExampleCounter: U64 + telemetry IsOn: Fw.On # @ Example event # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + event StatusChanged($state: Fw.On) severity activity high id 1 format "Load switch state changed to {}" # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched + output port Status: Fw.On # @ Example parameter # param PARAMETER_NAME: U32 diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md index 92c0064d..0537abb4 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -9,7 +9,7 @@ Add usage examples here Add diagrams here ### Typical Usage -And the typical usage of the component here +The load switch would be used whenever a sensor is to be turned on or off. ## Class Diagram Add a class diagram here @@ -17,7 +17,7 @@ Add a class diagram here ## Port Descriptions | Name | Description | |---|---| -|---|---| +| Status | Boolean value displaying whether the load switch is on or not. | ## Component States | Name | Description | @@ -37,17 +37,18 @@ Add sequence diagrams here ## Commands | Name | Description | |---|---| -|---|---| +| On | Turn on power to the component | +| Off | Turn off power to the component | ## Events | Name | Description | |---|---| -|---|---| +| StatusChanged | Emits event whenever the status of the load switch changes | ## Telemetry | Name | Description | |---|---| -|---|---| +| IsOn | Returns whether the load switch is supplying power to the component or not | ## Unit Tests | Name | Description | Output | Coverage | @@ -62,4 +63,4 @@ Add sequence diagrams here ## Change Log | Date | Description | |---|---| -|---| Initial Draft | \ No newline at end of file +| 10-22-2025 | Sarah, Kevin, and MoMata's first commit | \ No newline at end of file From 628fcbe5e4bbabddeb7fdafb68025c0298890e11 Mon Sep 17 00:00:00 2001 From: sarah Date: Wed, 22 Oct 2025 20:42:09 -0400 Subject: [PATCH 04/68] Sarah Kevin and MoMata fixed a bug --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index de5f76a0..b6167b85 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -4,8 +4,6 @@ module Components { # One async command/port is required for active components # This should be overridden by the developers with a useful command/port - @ TODO - async command TODO opcode 0 ############################################################################## #### Uncomment the following examples to start customizing your component #### @@ -26,7 +24,7 @@ module Components { # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched - output port Status: Fw.On + output port Status: Drv.GpioRead # @ Example parameter # param PARAMETER_NAME: U32 From 91b25fe9bbbccc5929a3cc4d70defe65b15bb15a Mon Sep 17 00:00:00 2001 From: sarah Date: Wed, 22 Oct 2025 20:43:39 -0400 Subject: [PATCH 05/68] Commit farming --- .../Components/LoadSwitch/LoadSwitch.cpp | 9 +++++++-- .../Components/LoadSwitch/LoadSwitch.hpp | 17 ++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 7476eba7..a4c28a8d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -1,6 +1,6 @@ // ====================================================================== // \title LoadSwitch.cpp -// \author kyang25 +// \author sarah // \brief cpp file for LoadSwitch component implementation class // ====================================================================== @@ -20,7 +20,12 @@ LoadSwitch ::~LoadSwitch() {} // Handler implementations for commands // ---------------------------------------------------------------------- -void LoadSwitch ::TODO_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { +void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + // TODO + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); +} + +void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { // TODO this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index ae2e61d4..92e5dc3d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -1,6 +1,6 @@ // ====================================================================== // \title LoadSwitch.hpp -// \author kyang25 +// \author sarah // \brief hpp file for LoadSwitch component implementation class // ====================================================================== @@ -29,12 +29,15 @@ class LoadSwitch final : public LoadSwitchComponentBase { // Handler implementations for commands // ---------------------------------------------------------------------- - //! Handler implementation for command TODO - //! - //! TODO - void TODO_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq //!< The command sequence number - ) override; + //! Handler implementation for command TURN_ON + void TURN_ON_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq //!< The command sequence number + ) override; + + //! Handler implementation for command TURN_OFF + void TURN_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq //!< The command sequence number + ) override; }; } // namespace Components From 076bf65e67e655de525ade13b85b4d8a2a27f7b0 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 22 Oct 2025 21:13:52 -0400 Subject: [PATCH 06/68] Added mcp23017 to v5 dtsi --- .../proves_flight_control_board_v5.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 397708c7..41715c98 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -137,4 +137,20 @@ zephyr_udc0: &usbd { lsb-microamp = <100>; label = "INA219"; }; + mcp23017: mcp23017@20 { + compatible = "microchip,mcp23017"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + + // GPIO line names for traceability + gpio-line-names = "FACE4_ENABLE", "FACE0_ENABLE", "FACE1_ENABLE", "FACE2_ENABLE", + "FACE3_ENABLE", "FACE5_ENABLE", "READONLY", "CHARGE", + "ENABLE_Heater", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", + "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3"; + + reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + + ngpios = <16>; + }; }; From 24a2e97777035706e14dd9e7eef9e49ebf97cb4b Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Thu, 23 Oct 2025 12:53:24 -0400 Subject: [PATCH 07/68] Rough initial implementation + add to topology --- .../Components/LoadSwitch/LoadSwitch.cpp | 16 ++++++++++++++-- .../Components/LoadSwitch/LoadSwitch.hpp | 11 +++++++++++ .../Top/ReferenceDeploymentPackets.fppi | 4 ++++ .../Top/ReferenceDeploymentTopology.cpp | 3 +++ .../ReferenceDeployment/Top/instances.fpp | 5 +++++ .../ReferenceDeployment/Top/topology.fpp | 2 ++ 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index a4c28a8d..c8420616 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -21,13 +21,25 @@ LoadSwitch ::~LoadSwitch() {} // ---------------------------------------------------------------------- void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - // TODO + gpio_pin_set(m_device, m_pinNum, 1); + this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON); + // I think some code needed to send this status to the port as well this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - // TODO + gpio_pin_set(m_device, m_pinNum, 0); + this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF); + // I think some code needed to send this status to the port as well this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } + +// This is meant to be used in Topology.cpp to configure the pin and device +void LoadSwitch ::pin_configuration(const struct device* device, uint8_t pinNum) { + this->m_pinNum = pinNum; + this->m_device = device; + gpio_pin_configure(m_device, m_pinNum, GPIO_OUTPUT_INACTIVE); +} + } // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 92e5dc3d..585e193d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -8,6 +8,7 @@ #define Components_LoadSwitch_HPP #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +#include namespace Components { @@ -24,6 +25,12 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Destroy LoadSwitch object ~LoadSwitch(); + // ---------------------------------------------------------------------- + // Configuration Meant to be used in ***Topology.cpp + // ---------------------------------------------------------------------- + + void pin_configuration(const struct device* device, uint8_t pinNum); + private: // ---------------------------------------------------------------------- // Handler implementations for commands @@ -38,6 +45,10 @@ class LoadSwitch final : public LoadSwitchComponentBase { void TURN_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number ) override; + + uint8_t m_pinNum; + static const struct device* m_device; + }; } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 4c2e3fc1..566f68a1 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -55,7 +55,11 @@ telemetry packets ReferenceDeploymentPackets { } + } omit { + # Needs to be added appropriately later + loadSwitch1.IsOn + CdhCore.cmdDisp.CommandErrors # Only has one library, no custom versions CdhCore.version.LibraryVersion02 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 21306966..156660ee 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -16,6 +16,8 @@ static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios); static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire0), gpios); static const struct gpio_dt_spec burnwire1Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire1), gpios); +static const struct device *mcp23017_dev = DEVICE_DT_GET(DT_NODELABEL(mcp23017)); + // Allows easy reference to objects in FPP/autocoder required namespaces using namespace ReferenceDeployment; @@ -59,6 +61,7 @@ void configureTopology() { gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + loadSwitch1.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index bdbb36a8..133cc7d3 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -35,6 +35,11 @@ module ReferenceDeployment { queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 4 + + instance loadSwitch1: Components.LoadSwitch base id 0x10003000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 # ---------------------------------------------------------------------- # Queued component instances diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 89626e35..3a25a838 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -42,6 +42,8 @@ module ReferenceDeployment { instance comSplitterTelemetry # For UART sideband communication instance comDriver + + instance loadSwitch1 # ---------------------------------------------------------------------- # Pattern graph specifiers From 3761180c517bcd262c6dd8deb908e352f62ea0b4 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Thu, 23 Oct 2025 12:56:14 -0400 Subject: [PATCH 08/68] Ion even know any mane --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index c8420616..ed53998b 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -8,6 +8,7 @@ namespace Components { +const struct device* LoadSwitch::m_device = nullptr; // ---------------------------------------------------------------------- // Component construction and destruction // ---------------------------------------------------------------------- From 3fec032d319372e918a1503ac7a6403e61a6ff75 Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:25:28 -0800 Subject: [PATCH 09/68] Working Device Tree (But F Prime Crash) --- .../Components/LoadSwitch/LoadSwitch.cpp | 1 + .../Components/LoadSwitch/LoadSwitch.hpp | 4 +- .../proves_flight_control_board_v5.dtsi | 112 +++++++++++++++++- 3 files changed, 115 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 351e2ea5..e92b1aea 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -5,6 +5,7 @@ // ====================================================================== #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp" +#include namespace Components { diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index bb4288b3..12d79c01 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -7,9 +7,11 @@ #ifndef Components_LoadSwitch_HPP #define Components_LoadSwitch_HPP -#include #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +// Forward declare Zephyr types to avoid header conflicts +struct device; + namespace Components { class LoadSwitch final : public LoadSwitchComponentBase { diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 4aa68723..d4db1c0d 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -178,8 +178,118 @@ zephyr_udc0: &usbd { "ENABLE_Heater", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3"; - reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; ngpios = <16>; }; }; + +// GPIO Expander IO +/ { + + // Define the GPIO outputs based on your schematic + gpio_outputs { + compatible = "gpio-leds"; // Using gpio-leds as a convenient container + + face4_enable: face4-enable { + + gpios = <&mcp23017 8 GPIO_ACTIVE_HIGH>; // GPB0 + label = "FACE4_ENABLE"; + }; + + face0_enable: face0-enable { + + gpios = <&mcp23017 9 GPIO_ACTIVE_HIGH>; // GPB1 + label = "FACE0_ENABLE"; + }; + + face1_enable: face1-enable { + + gpios = <&mcp23017 10 GPIO_ACTIVE_HIGH>; // GPB2 + label = "FACE1_ENABLE"; + }; + + face2_enable: face2-enable { + + gpios = <&mcp23017 11 GPIO_ACTIVE_HIGH>; // GPB3 + label = "FACE2_ENABLE"; + }; + + face3_enable: face3-enable { + + gpios = <&mcp23017 12 GPIO_ACTIVE_HIGH>; // GPB4 + label = "FACE3_ENABLE"; + }; + + face5_enable: face5-enable { + + gpios = <&mcp23017 13 GPIO_ACTIVE_HIGH>; // GPB5 + label = "FACE5_ENABLE"; + }; + + enable_heater: enable-heater { + + gpios = <&mcp23017 0 GPIO_ACTIVE_HIGH>; // GPA0 + label = "ENABLE_Heater"; + }; + + payload_pwr_enable: payload-pwr-enable { + + gpios = <&mcp23017 1 GPIO_ACTIVE_HIGH>; // GPA1 + label = "PAYLOAD_PWR_ENABLE"; + }; + + fire_deploy2_b: fire-deploy2-b { + + gpios = <&mcp23017 2 GPIO_ACTIVE_HIGH>; // GPA2 + label = "FIRE_DEPLOY2_B"; + }; + + payload_batt_enable: payload-batt-enable { + + gpios = <&mcp23017 3 GPIO_ACTIVE_HIGH>; // GPA3 + label = "PAYLOAD_BATT_ENABLE"; + }; + }; + + // Define GPIO inputs + gpio_inputs { + compatible = "gpio-keys"; + + charge: charge { + + gpios = <&mcp23017 16 GPIO_ACTIVE_HIGH>; // GPB7 + label = "CHARGE"; + }; + + readonly: readonly { + + gpios = <&mcp23017 15 GPIO_ACTIVE_HIGH>; // GPB6 + label = "READONLY"; + }; + + rf2_io2: rf2-io2 { + + gpios = <&mcp23017 4 GPIO_ACTIVE_HIGH>; // GPA4 + label = "RF2_IO2"; + }; + + rf2_io1: rf2-io1 { + + gpios = <&mcp23017 5 GPIO_ACTIVE_HIGH>; // GPA5 + label = "RF2_IO1"; + }; + + rf2_io0: rf2-io0 { + + gpios = <&mcp23017 6 GPIO_ACTIVE_HIGH>; // GPA6 + label = "RF2_IO0"; + }; + + rf2_io3: rf2-io3 { + + gpios = <&mcp23017 7 GPIO_ACTIVE_HIGH>; // GPA7 + label = "RF2_IO3"; + }; + }; +}; From 09c61fdc4284ec3690e3e7b4dddcc035de2f93fa Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:33:58 -0800 Subject: [PATCH 10/68] Update CommandDispatcherImplCfg.hpp Fixed the Crashes! --- .../project/config/CommandDispatcherImplCfg.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp index ab88a46b..350367d4 100644 --- a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp +++ b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp @@ -11,7 +11,7 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 50, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 100, // !< The size of the table holding opcodes to dispatch CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress }; From b5544e72a29ec50fe48ecca11732e4597469210a Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Tue, 4 Nov 2025 11:13:29 -0500 Subject: [PATCH 11/68] Update Submodules --- lib/fprime | 2 +- lib/fprime-zephyr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fprime b/lib/fprime index 064b6455..626473fc 160000 --- a/lib/fprime +++ b/lib/fprime @@ -1 +1 @@ -Subproject commit 064b64553f1c0dce5afd43453bbf58993004e1e2 +Subproject commit 626473fc4e89e491d43ad95bb0d1b7727014c80d diff --git a/lib/fprime-zephyr b/lib/fprime-zephyr index 11c2a109..dc83bef6 160000 --- a/lib/fprime-zephyr +++ b/lib/fprime-zephyr @@ -1 +1 @@ -Subproject commit 11c2a109c0225745237c46a0f45902ffc598500b +Subproject commit dc83bef61c25c65d3854cf65b045daf42a6a58f9 From 5351c58c7df7578d7488d40d5ccc28142590a07a Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Tue, 4 Nov 2025 16:42:40 -0800 Subject: [PATCH 12/68] Revert "Update Submodules" This reverts commit b5544e72a29ec50fe48ecca11732e4597469210a. --- lib/fprime | 2 +- lib/fprime-zephyr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fprime b/lib/fprime index 626473fc..064b6455 160000 --- a/lib/fprime +++ b/lib/fprime @@ -1 +1 @@ -Subproject commit 626473fc4e89e491d43ad95bb0d1b7727014c80d +Subproject commit 064b64553f1c0dce5afd43453bbf58993004e1e2 diff --git a/lib/fprime-zephyr b/lib/fprime-zephyr index dc83bef6..11c2a109 160000 --- a/lib/fprime-zephyr +++ b/lib/fprime-zephyr @@ -1 +1 @@ -Subproject commit dc83bef61c25c65d3854cf65b045daf42a6a58f9 +Subproject commit 11c2a109c0225745237c46a0f45902ffc598500b From e90ffe7a948db1597cdcd5ab0a07925bba7751a5 Mon Sep 17 00:00:00 2001 From: "Sam S. Yu" <25761223+yudataguy@users.noreply.github.com> Date: Wed, 5 Nov 2025 10:48:40 -0800 Subject: [PATCH 13/68] need to add manager next --- .../Components/Drv/CMakeLists.txt | 1 + .../Drv/Tmp112Manager/CMakeLists.txt | 36 ++++++++++++ .../Drv/Tmp112Manager/TMP112Manager.cpp | 49 ++++++++++++++++ .../Drv/Tmp112Manager/TMP112Manager.fpp | 36 ++++++++++++ .../Drv/Tmp112Manager/TMP112Manager.hpp | 58 +++++++++++++++++++ .../ReferenceDeployment/Main.cpp | 2 + .../Top/ReferenceDeploymentPackets.fppi | 1 + .../Top/ReferenceDeploymentTopology.cpp | 1 + .../Top/ReferenceDeploymentTopologyDefs.hpp | 1 + .../ReferenceDeployment/Top/instances.fpp | 2 + .../ReferenceDeployment/Top/topology.fpp | 1 + .../proves_flight_control_board_v5.dtsi | 5 ++ ...ht_control_board_v5c_rp2350a_m33_defconfig | 1 + ...ht_control_board_v5d_rp2350a_m33_defconfig | 1 + 14 files changed, 195 insertions(+) create mode 100644 FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp create mode 100644 FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp create mode 100644 FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp diff --git a/FprimeZephyrReference/Components/Drv/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/CMakeLists.txt index efcd2f90..d55d258b 100644 --- a/FprimeZephyrReference/Components/Drv/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/CMakeLists.txt @@ -2,4 +2,5 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ina219Manager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lis2mdlManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RtcManager") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/") diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt new file mode 100644 index 00000000..744ebde3 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/TMP112Manager.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/TMP112Manager.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/TMP112Manager.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/TMP112ManagerTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/TMP112ManagerTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp new file mode 100644 index 00000000..f66a86d0 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -0,0 +1,49 @@ +// ====================================================================== +// \title TMP112Manager.cpp +// \brief cpp file for TMP112Manager component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp" +#include + +namespace Drv { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +TMP112Manager ::TMP112Manager(const char* const compName) : TMP112ManagerComponentBase(compName) {} + +TMP112Manager ::~TMP112Manager() {} + +// ---------------------------------------------------------------------- +// Helper methods +// ---------------------------------------------------------------------- + +void TMP112Manager::configure(const struct device* dev) { + this->m_dev = dev; +} + +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +F64 TMP112Manager ::ambientTemperatureGet_handler(FwIndexType portNum) { + if (!device_is_ready(this->m_dev)) { + this->log_WARNING_HI_DeviceNotReady(); + return 0; + } + this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); + + struct sensor_value temp; + + sensor_sample_fetch(this->m_dev); + + sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); + + this->tlmWrite_AmbientTemperature(sensor_value_to_double(&temp)); + + return sensor_value_to_double(&temp); +} + +} // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp new file mode 100644 index 00000000..4eac8887 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -0,0 +1,36 @@ +module Drv { + port AmbientTemperatureGet -> F64 +} + +module Drv { + @ Manager for TMP112 device + passive component TMP112Manager { + # Ports + @ Port to read the ambient temperature in degrees Celsius + sync input port ambientTemperatureGet: AmbientTemperatureGet + + # Telemetry channels + + @ Telemetry channel for ambient temperature in degrees Celsius + telemetry AmbientTemperature: F64 + + @ Event for reporting TMP112 not ready error + event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + } +} diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp new file mode 100644 index 00000000..23b85a6f --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -0,0 +1,58 @@ +// ====================================================================== +// \title TMP112Manager.hpp +// \brief hpp file for TMP112Manager component implementation class +// ====================================================================== + +#ifndef Drv_TMP112Manager_HPP +#define Drv_TMP112Manager_HPP + +#include "FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112ManagerComponentAc.hpp" + +#include +#include +#include +namespace Drv { + +class TMP112Manager final : public TMP112ManagerComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct TMP112Manager object + TMP112Manager(const char* const compName //!< The component name + ); + + //! Destroy TMP112Manager object + ~TMP112Manager(); + + public: + // ---------------------------------------------------------------------- + // Helper methods + // ---------------------------------------------------------------------- + + //! Configure the TMP112 device + void configure(const struct device* dev); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for ambientTemperatureGet + //! + //! Port to read the ambient temperature in degrees Celsius + F64 ambientTemperatureGet_handler(FwIndexType portNum //!< The port number + ) override; + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + + //! Zephyr device stores the initialized TMP112 sensor + const struct device* m_dev; +}; + +} // namespace Drv + +#endif diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 6b5187a8..e87ba32e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -16,6 +16,7 @@ const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0)); const struct device* lsm6dso = DEVICE_DT_GET(DT_NODELABEL(lsm6dso0)); const struct device* lis2mdl = DEVICE_DT_GET(DT_NODELABEL(lis2mdl0)); +const struct device* tmp112 = device_get_binding("TMP112"); int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// @@ -32,6 +33,7 @@ int main(int argc, char* argv[]) { inputs.uartDevice = serial; inputs.lsm6dsoDevice = lsm6dso; inputs.lis2mdlDevice = lis2mdl; + inputs.tmp112Device = tmp112; inputs.baudRate = 115200; // Setup, cycle, and teardown topology diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index e8e74ee4..3680f528 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -49,6 +49,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.lsm6dsoManager.AngularVelocity ReferenceDeployment.lsm6dsoManager.Temperature ReferenceDeployment.lis2mdlManager.MagneticField + ReferenceDeployment.tmp112Manager.AmbientTemperature } packet LoRa id 7 group 4 { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 0580479a..3db0ce13 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -92,6 +92,7 @@ void setupTopology(const TopologyState& state) { lis2mdlManager.configure(state.lis2mdlDevice); ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); + tmp112Manager.configure(state.tmp112Device); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index fc9fe0ce..f4eaad02 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -75,6 +75,7 @@ struct TopologyState { const device* loraDevice; //!< LoRa device path for communication const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer + const device* tmp112Device; //!< TMP112 device path for temperature sensor U32 baudRate; //!< Baud rate for UART communication CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 4cf1dbf9..a666dba4 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -95,4 +95,6 @@ module ReferenceDeployment { instance ina219SysManager: Drv.Ina219Manager base id 0x10032000 instance ina219SolManager: Drv.Ina219Manager base id 0x10033000 + + instance tmp112Manager: Drv.TMP112Manager base id 0x10034000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 79169a2e..549c2719 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -47,6 +47,7 @@ module ReferenceDeployment { instance powerMonitor instance ina219SysManager instance ina219SolManager + instance tmp112Manager # ---------------------------------------------------------------------- diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 363ac07c..829739b8 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -190,4 +190,9 @@ zephyr_udc0: &usbd { backup-switch-mode = "direct"; label = "RV3028"; }; + tmp112: tmp112@48 { + compatible = "ti,tmp112"; + reg = <0x48>; + label = "TMP112"; + }; }; diff --git a/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig b/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig index 02bb4603..a1a4d236 100644 --- a/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig +++ b/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig @@ -17,6 +17,7 @@ CONFIG_LSM6DSO=y CONFIG_LSM6DSO_ENABLE_TEMP=y CONFIG_LIS2MDL=y CONFIG_INA219=y +CONFIG_TMP112=y # Radio CONFIG_LORA=y diff --git a/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig b/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig index fccf5b0f..f0817de0 100644 --- a/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig +++ b/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig @@ -17,6 +17,7 @@ CONFIG_LSM6DSO=y CONFIG_LSM6DSO_ENABLE_TEMP=y CONFIG_LIS2MDL=y CONFIG_INA219=y +CONFIG_TMP112=y # Radio CONFIG_LORA=y From db0bc823880b7d36ad45d4f98374aefb65129a4c Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Wed, 5 Nov 2025 11:32:56 -0800 Subject: [PATCH 14/68] Updated Device Tree --- .../proves_flight_control_board_v5.dtsi | 123 +++++++++++++++++- ...ht_control_board_v5c_rp2350a_m33_defconfig | 2 + ...ht_control_board_v5d_rp2350a_m33_defconfig | 2 + prj.conf | 5 + 4 files changed, 127 insertions(+), 5 deletions(-) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 829739b8..a3fe354e 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -163,6 +163,124 @@ zephyr_udc0: &usbd { lsb-microamp = <61>; label = "INA219 sol"; }; + + tca9548a: tca9548a@77 { + compatible = "ti,tca9548a"; + status = "okay"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + label = "TCA9548A"; + reset-gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; + + i2c_mux@0 { + compatible = "ti,tca9548a-channel"; + label = "face0_i2c"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + face0_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + + i2c_mux@1 { + compatible = "ti,tca9548a-channel"; + label = "face1_i2c"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + face1_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + + i2c_mux@2 { + compatible = "ti,tca9548a-channel"; + label = "face2_i2c"; + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + face2_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + + i2c_mux@3 { + compatible = "ti,tca9548a-channel"; + label = "face3_i2c"; + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + face3_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + + i2c_mux@4 { + compatible = "ti,tca9548a-channel"; + label = "battery_i2c"; + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + batt_cell1_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + batt_cell2_temp_sens: tmp112@73 { + compatible = "ti,tmp112"; + reg = <0x73>; + }; + batt_cell3_temp_sens: tmp112@74 { + compatible = "ti,tmp112"; + reg = <0x74>; + }; + batt_cell4_temp_sens: tmp112@75 { + compatible = "ti,tmp112"; + reg = <0x75>; + }; + }; + + i2c_mux@5 { + compatible = "ti,tca9548a-channel"; + label = "face4_i2c"; + reg = <5>; + #address-cells = <1>; + #size-cells = <0>; + face4_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + + i2c_mux@6 { + compatible = "ti,tca9548a-channel"; + label = "face5_i2c"; + reg = <6>; + #address-cells = <1>; + #size-cells = <0>; + face5_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + + i2c_mux@7 { + compatible = "ti,tca9548a-channel"; + label = "top_i2c"; + reg = <7>; + #address-cells = <1>; + #size-cells = <0>; + top_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; + }; }; @@ -190,9 +308,4 @@ zephyr_udc0: &usbd { backup-switch-mode = "direct"; label = "RV3028"; }; - tmp112: tmp112@48 { - compatible = "ti,tmp112"; - reg = <0x48>; - label = "TMP112"; - }; }; diff --git a/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig b/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig index a1a4d236..28955a32 100644 --- a/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig +++ b/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig @@ -12,6 +12,8 @@ CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="PROVES Flight Control Board v5c" CONFIG_USB_DEVICE_VID=0x0028 +CONFIG_I2C_TCA954X=y + # Sensors CONFIG_LSM6DSO=y CONFIG_LSM6DSO_ENABLE_TEMP=y diff --git a/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig b/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig index f0817de0..c8df32a1 100644 --- a/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig +++ b/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig @@ -12,6 +12,8 @@ CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="PROVES Flight Control Board v5d" CONFIG_USB_DEVICE_VID=0x0028 +CONFIG_I2C_TCA954X=y + # Sensors CONFIG_LSM6DSO=y CONFIG_LSM6DSO_ENABLE_TEMP=y diff --git a/prj.conf b/prj.conf index b1e35675..51c30cce 100644 --- a/prj.conf +++ b/prj.conf @@ -32,6 +32,11 @@ CONFIG_SPI=y CONFIG_PINCTRL=y CONFIG_ASSERT=y +#### I2C Multiplexer Configuration #### +CONFIG_I2C_TCA954X=y +CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=50 +CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=51 + CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y CONFIG_DYNAMIC_THREAD_ALLOC=n From 46e660460cc7cb7e39e6d7aae99335afd88a27be Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 5 Nov 2025 20:35:23 -0500 Subject: [PATCH 15/68] Add Reset port functionality --- .../Components/LoadSwitch/LoadSwitch.cpp | 10 ++++++++++ .../Components/LoadSwitch/LoadSwitch.fpp | 5 +++++ .../Components/LoadSwitch/LoadSwitch.hpp | 13 +++++++++++++ 3 files changed, 28 insertions(+) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index e92b1aea..b61ff198 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -18,6 +18,16 @@ LoadSwitch ::LoadSwitch(const char* const compName) : LoadSwitchComponentBase(co LoadSwitch ::~LoadSwitch() {} +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +void LoadSwitch ::Reset_handler(FwIndexType portNum) { + gpio_pin_set(m_device, m_pinNum, 0); + k_sleep(K_MSEC(100)); + gpio_pin_set(m_device, m_pinNum, 1); +} + // ---------------------------------------------------------------------- // Handler implementations for commands // ---------------------------------------------------------------------- diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index ff564b24..d00d49b1 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -26,6 +26,11 @@ module Components { # sync input port run: Svc.Sched output port Status: Drv.GpioRead + + # Input that will be used by other components if they want to force a reset + # (off and on again) of the load switch + async input port Reset: Fw.Signal + # @ Example parameter # param PARAMETER_NAME: U32 diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 12d79c01..bc94e4ea 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -8,6 +8,7 @@ #define Components_LoadSwitch_HPP #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +#include // Forward declare Zephyr types to avoid header conflicts struct device; @@ -48,6 +49,18 @@ class LoadSwitch final : public LoadSwitchComponentBase { U32 cmdSeq //!< The command sequence number ) override; + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for Reset + void Reset_handler(FwIndexType portNum //!< The port number + ) override; + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + uint8_t m_pinNum; static const struct device* m_device; }; From 98326f2630f9f875847e97ddab3fc6714d498337 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:54:13 -0500 Subject: [PATCH 16/68] Add remaining load switch instances --- .../Top/ReferenceDeploymentTopology.cpp | 9 ++++- .../ReferenceDeployment/Top/instances.fpp | 37 ++++++++++++++++++- .../ReferenceDeployment/Top/topology.fpp | 9 ++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 7f242a01..da089523 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -61,7 +61,14 @@ void configureTopology() { gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); - loadSwitch1.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 + face4LoadSwitch.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 + face0LoadSwitch.pin_configuration(mcp23017_dev, 1); // Pin 1 on MCP23017 + face1LoadSwitch.pin_configuration(mcp23017_dev, 2); // Pin 2 on MCP23017 + face2LoadSwitch.pin_configuration(mcp23017_dev, 3); // Pin 3 on MCP23017 + face3LoadSwitch.pin_configuration(mcp23017_dev, 4); // Pin 4 on MCP23017 + face5LoadSwitch.pin_configuration(mcp23017_dev, 5); // Pin 5 on MCP23017 + payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 7); // Pin 7 on MCP23017 + payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 9); // Pin 9 on MCP23017 } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 19d28754..f98c69b6 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,7 +37,42 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance loadSwitch1: Components.LoadSwitch base id 0x10004000 \ + instance face4LoadSwitch: Components.LoadSwitch base id 0x10014000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face0LoadSwitch: Components.LoadSwitch base id 0x10010000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face1LoadSwitch: Components.LoadSwitch base id 0x10011000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face2LoadSwitch: Components.LoadSwitch base id 0x10012000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face3LoadSwitch: Components.LoadSwitch base id 0x10013000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face5LoadSwitch: Components.LoadSwitch base id 0x10015000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10016000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x10017000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 9b0cd82b..d96a5013 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -44,7 +44,14 @@ module ReferenceDeployment { # For UART sideband communication instance comDriver - instance loadSwitch1 + instance face4LoadSwitch + instance face0LoadSwitch + instance face1LoadSwitch + instance face2LoadSwitch + instance face3LoadSwitch + instance face5LoadSwitch + instance payloadPowerLoadSwitch + instance payloadBatteryLoadSwitch instance fsSpace From 9c72d7a550bcec6c6c16b4cfe0a7f1fb5451f502 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 5 Nov 2025 21:11:02 -0500 Subject: [PATCH 17/68] Small updates to extra loadSwitch instances, update max packets - Max packets from 8 to 9 --- .../Top/ReferenceDeploymentPackets.fppi | 13 ++++++++++--- .../ReferenceDeployment/Top/instances.fpp | 18 +++++++++--------- .../project/config/TlmPacketizerCfg.hpp | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index e3097dab..ec186e21 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -61,11 +61,18 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.antennaDeployer.LastDistance } + packet LoadSwitches id 9 group 4 { + ReferenceDeployment.face4LoadSwitch.IsOn + ReferenceDeployment.face0LoadSwitch.IsOn + ReferenceDeployment.face1LoadSwitch.IsOn + ReferenceDeployment.face2LoadSwitch.IsOn + ReferenceDeployment.face3LoadSwitch.IsOn + ReferenceDeployment.face5LoadSwitch.IsOn + ReferenceDeployment.payloadPowerLoadSwitch.IsOn + ReferenceDeployment.payloadBatteryLoadSwitch.IsOn + } } omit { - # Needs to be added appropriately later - loadSwitch1.IsOn - CdhCore.cmdDisp.CommandErrors # Only has one library, no custom versions CdhCore.version.LibraryVersion02 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index f98c69b6..016dee51 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,47 +37,47 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance face4LoadSwitch: Components.LoadSwitch base id 0x10014000 \ + instance face4LoadSwitch: Components.LoadSwitch base id 0x10003000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face0LoadSwitch: Components.LoadSwitch base id 0x10010000 \ + instance face0LoadSwitch: Components.LoadSwitch base id 0x10004000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face1LoadSwitch: Components.LoadSwitch base id 0x10011000 \ + instance face1LoadSwitch: Components.LoadSwitch base id 0x10005000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face2LoadSwitch: Components.LoadSwitch base id 0x10012000 \ + instance face2LoadSwitch: Components.LoadSwitch base id 0x10006000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face3LoadSwitch: Components.LoadSwitch base id 0x10013000 \ + instance face3LoadSwitch: Components.LoadSwitch base id 0x10007000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face5LoadSwitch: Components.LoadSwitch base id 0x10015000 \ + instance face5LoadSwitch: Components.LoadSwitch base id 0x10008000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10016000 \ + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10009000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x10017000 \ + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1000A000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance prmDb: Svc.PrmDb base id 0x10003000 \ + instance prmDb: Svc.PrmDb base id 0x1000B000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 diff --git a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp index 3c11895d..e86a06c9 100644 --- a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp +++ b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp @@ -16,7 +16,7 @@ #include namespace Svc { -static const FwChanIdType MAX_PACKETIZER_PACKETS = 8; +static const FwChanIdType MAX_PACKETIZER_PACKETS = 9; static const FwChanIdType TLMPACKETIZER_NUM_TLM_HASH_SLOTS = 15; // !< Number of slots in the hash table. // Works best when set to about twice the number of components producing telemetry From d7fce15cb716d9acb0ec37453beee03042a3b4a5 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 5 Nov 2025 21:13:19 -0500 Subject: [PATCH 18/68] Remove output read port, add output write port --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index d00d49b1..8a166d55 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -24,7 +24,11 @@ module Components { # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched - output port Status: Drv.GpioRead + #output port Status: Drv.GpioRead + #We will not be putting a Drv.GpioRead port here, we are using the Gpio Driver component which has this already! + + @ Port sending calls to the GPIO driver + output port gpioSet: Drv.GpioWrite # Input that will be used by other components if they want to force a reset From c633bf9a993ca1afb24e638eb15f5a1e75344feb Mon Sep 17 00:00:00 2001 From: hrfarmer Date: Wed, 5 Nov 2025 20:55:09 -0600 Subject: [PATCH 19/68] add magnetorquer component --- .../Components/Drv/CMakeLists.txt | 1 + .../Drv/MagnetorquerManager/CMakeLists.txt | 36 ++++++++++ .../MagnetorquerManager.cpp | 42 ++++++++++++ .../MagnetorquerManager.fpp | 57 ++++++++++++++++ .../MagnetorquerManager.hpp | 44 +++++++++++++ .../Drv/MagnetorquerManager/docs/sdd.md | 66 +++++++++++++++++++ .../ReferenceDeployment/Top/instances.fpp | 2 + .../ReferenceDeployment/Top/topology.fpp | 1 + .../proves_flight_control_board_v5.dtsi | 26 ++++++++ prj.conf | 6 ++ 10 files changed, 281 insertions(+) create mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp create mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp create mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp create mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md diff --git a/FprimeZephyrReference/Components/Drv/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/CMakeLists.txt index efcd2f90..793c22a4 100644 --- a/FprimeZephyrReference/Components/Drv/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/CMakeLists.txt @@ -3,3 +3,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lis2mdlManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RtcManager") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager/") diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt new file mode 100644 index 00000000..92da00df --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/MagnetorquerManagerTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/MagnetorquerManagerTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp new file mode 100644 index 00000000..453947a6 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp @@ -0,0 +1,42 @@ +// ====================================================================== +// \title MagnetorquerManager.cpp +// \author aychar +// \brief cpp file for MagnetorquerManager component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp" + +#include +#include + +namespace Drv { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +MagnetorquerManager ::MagnetorquerManager(const char* const compName) : MagnetorquerManagerComponentBase(compName) { + dev = device_get_binding("DRV2605"); +} + +MagnetorquerManager ::~MagnetorquerManager() {} + +void MagnetorquerManager ::START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + if (!device_is_ready(dev)) { + this->log_WARNING_HI_DeviceNotReady(); + return; + } + drv2605_haptic_config(this->dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&this->rom); +} + +void MagnetorquerManager ::START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + if (!device_is_ready(dev)) { + this->log_WARNING_HI_DeviceNotReady(); + return; + } + + struct drv2605_rom_data rom2 = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {50, 0, 0, 0, 0, 0, 0, 0}}; + drv2605_haptic_config(this->dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&rom2); +} + +} // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp new file mode 100644 index 00000000..62e23685 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp @@ -0,0 +1,57 @@ +module Drv { + @ Component for F Prime FSW framework. + passive component MagnetorquerManager { + + @ Event for reporting DRV2605 not ready error + event DeviceNotReady() severity warning high format "DRV2605 device not ready" throttle 5 + + @ Start DRV2605 playback with effect #47 + sync command START_PLAYBACK_TEST() + + @ Start DRV2605 playback with effect #50 + sync command START_PLAYBACK_TEST2() + + # @ Example telemetry counter + # telemetry ExampleCounter: U64 + + # @ Example event + # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + + # @ Example port: receiving calls from the rate group + # sync input port run: Svc.Sched + + # @ Example parameter + # param PARAMETER_NAME: U32 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending command registrations + command reg port cmdRegOut + + @ Port for receiving commands + command recv port cmdIn + + @ Port for sending command responses + command resp port cmdResponseOut + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + @ Port to return the value of a parameter + param get port prmGetOut + + @Port to set the value of a parameter + param set port prmSetOut + + } +} diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp new file mode 100644 index 00000000..7ed6ce28 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp @@ -0,0 +1,44 @@ +// ====================================================================== +// \title MagnetorquerManager.hpp +// \author aychar +// \brief hpp file for MagnetorquerManager component implementation class +// ====================================================================== + +#ifndef Drv_MagnetorquerManager_HPP +#define Drv_MagnetorquerManager_HPP + +#include "FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManagerComponentAc.hpp" + +#include +#include +#include + +#include + +namespace Drv { + +class MagnetorquerManager final : public MagnetorquerManagerComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct MagnetorquerManager object + MagnetorquerManager(const char* const compName //!< The component name + ); + + //! Destroy MagnetorquerManager object + ~MagnetorquerManager(); + + private: + //! Zephyr device to store initialized DRV2605 + const struct device* dev; + struct drv2605_rom_data rom = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {47, 0, 0, 0, 0, 0, 0, 0}}; + + void START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; + void START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; +}; + +} // namespace Drv + +#endif diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md new file mode 100644 index 00000000..43ec4dc8 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md @@ -0,0 +1,66 @@ +# Drv::MagnetorquerManager + +Component for F Prime FSW framework. + +## Usage Examples +Add usage examples here + +### Diagrams +Add diagrams here + +### Typical Usage +And the typical usage of the component here + +## Class Diagram +Add a class diagram here + +## Port Descriptions +| Name | Description | +|---|---| +|---|---| + +## Component States +Add component states in the chart below +| Name | Description | +|---|---| +|---|---| + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|---|---| +|---|---| + +## Commands +| Name | Description | +|---|---| +|---|---| + +## Events +| Name | Description | +|---|---| +|---|---| + +## Telemetry +| Name | Description | +|---|---| +|---|---| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|---|---|---| +|---|---|---| + +## Change Log +| Date | Description | +|---|---| +|---| Initial Draft | \ No newline at end of file diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 4cf1dbf9..5aa0f8fa 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -95,4 +95,6 @@ module ReferenceDeployment { instance ina219SysManager: Drv.Ina219Manager base id 0x10032000 instance ina219SolManager: Drv.Ina219Manager base id 0x10033000 + + instance magnetorquerManager: Drv.MagnetorquerManager base id 0x10034000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 79169a2e..cd5d82b8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -47,6 +47,7 @@ module ReferenceDeployment { instance powerMonitor instance ina219SysManager instance ina219SolManager + instance magnetorquerManager # ---------------------------------------------------------------------- diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 363ac07c..8a5ced71 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -163,6 +163,32 @@ zephyr_udc0: &usbd { lsb-microamp = <61>; label = "INA219 sol"; }; + + tca9548a: tca9548a@70 { + compatible = "ti,tca9548a"; + reg = <0x70>; + #address-cells = <1>; + #size-cells = <0>; + label = "TCA9548A"; + + tca_channel0: channel@0 { + compatible = "ti,tca9548a-channel"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "DRV2605"; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + }; + }; }; diff --git a/prj.conf b/prj.conf index b1e35675..e4f3cf9b 100644 --- a/prj.conf +++ b/prj.conf @@ -28,6 +28,9 @@ CONFIG_GPIO=y CONFIG_LED=y CONFIG_PWM=n CONFIG_I2C=y +# I2C multiplexer (TCA9548A) priority configuration +CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=70 +CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=71 CONFIG_SPI=y CONFIG_PINCTRL=y CONFIG_ASSERT=y @@ -65,3 +68,6 @@ CONFIG_FAT_FILESYSTEM_ELM=y CONFIG_FS_FATFS_EXFAT=y CONFIG_FS_FATFS_MOUNT_MKFS=y CONFIG_FS_FATFS_FSTAB_AUTOMOUNT=y + +CONFIG_HAPTICS=y +CONFIG_HAPTICS_DRV2605=y From b456c1d818a666d80a4fae97b3416966a5a1a30d Mon Sep 17 00:00:00 2001 From: hrfarmer Date: Wed, 5 Nov 2025 21:03:33 -0600 Subject: [PATCH 20/68] switch to use new device initialization pattern --- .../MagnetorquerManager.cpp | 20 ++++++++++++------- .../MagnetorquerManager.hpp | 5 ++++- .../ReferenceDeployment/Main.cpp | 2 ++ .../Top/ReferenceDeploymentTopology.cpp | 1 + .../Top/ReferenceDeploymentTopologyDefs.hpp | 13 ++++++------ 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp index 453947a6..4ae87c25 100644 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp @@ -15,28 +15,34 @@ namespace Drv { // Component construction and destruction // ---------------------------------------------------------------------- -MagnetorquerManager ::MagnetorquerManager(const char* const compName) : MagnetorquerManagerComponentBase(compName) { - dev = device_get_binding("DRV2605"); -} +MagnetorquerManager ::MagnetorquerManager(const char* const compName) : MagnetorquerManagerComponentBase(compName) {} MagnetorquerManager ::~MagnetorquerManager() {} +// ---------------------------------------------------------------------- +// Helper methods +// ---------------------------------------------------------------------- + +void MagnetorquerManager ::configure(const struct device* dev) { + this->m_dev = dev; +} + void MagnetorquerManager ::START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - if (!device_is_ready(dev)) { + if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); return; } - drv2605_haptic_config(this->dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&this->rom); + drv2605_haptic_config(this->m_dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&this->rom); } void MagnetorquerManager ::START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - if (!device_is_ready(dev)) { + if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); return; } struct drv2605_rom_data rom2 = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {50, 0, 0, 0, 0, 0, 0, 0}}; - drv2605_haptic_config(this->dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&rom2); + drv2605_haptic_config(this->m_dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&rom2); } } // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp index 7ed6ce28..68a4480b 100644 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp @@ -30,9 +30,12 @@ class MagnetorquerManager final : public MagnetorquerManagerComponentBase { //! Destroy MagnetorquerManager object ~MagnetorquerManager(); + //! Configure the DRV2605 device + void configure(const struct device* dev); + private: //! Zephyr device to store initialized DRV2605 - const struct device* dev; + const struct device* m_dev; struct drv2605_rom_data rom = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {47, 0, 0, 0, 0, 0, 0, 0}}; void START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 6b5187a8..b5b6aafa 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -16,6 +16,7 @@ const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0)); const struct device* lsm6dso = DEVICE_DT_GET(DT_NODELABEL(lsm6dso0)); const struct device* lis2mdl = DEVICE_DT_GET(DT_NODELABEL(lis2mdl0)); +const struct device* drv2605 = device_get_binding("DRV2605"); int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// @@ -32,6 +33,7 @@ int main(int argc, char* argv[]) { inputs.uartDevice = serial; inputs.lsm6dsoDevice = lsm6dso; inputs.lis2mdlDevice = lis2mdl; + inputs.drv2605Device = drv2605; inputs.baudRate = 115200; // Setup, cycle, and teardown topology diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 0580479a..12dd0814 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -92,6 +92,7 @@ void setupTopology(const TopologyState& state) { lis2mdlManager.configure(state.lis2mdlDevice); ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); + magnetorquerManager.configure(state.drv2605Device); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index fc9fe0ce..71146aa3 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -69,12 +69,13 @@ namespace ReferenceDeployment { * autocoder. The contents are entirely up to the definition of the project. This deployment uses subtopologies. */ struct TopologyState { - const device* ina219SysDevice; //!< device path for battery board ina219 - const device* ina219SolDevice; //!< device path for solar panel ina219 - const device* uartDevice; //!< UART device path for communication - const device* loraDevice; //!< LoRa device path for communication - const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope - const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer + const device* ina219SysDevice; //!< device path for battery board ina219 + const device* ina219SolDevice; //!< device path for solar panel ina219 + const device* uartDevice; //!< UART device path for communication + const device* loraDevice; //!< LoRa device path for communication + const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope + const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer + const device* drv2605Device; U32 baudRate; //!< Baud rate for UART communication CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds From 7ee7e146b026c3058d552915f8bf3f02700f7f9b Mon Sep 17 00:00:00 2001 From: hrfarmer Date: Fri, 7 Nov 2025 14:05:37 -0600 Subject: [PATCH 21/68] increase command limit --- .../project/config/CommandDispatcherImplCfg.hpp | 2 +- .../proves_flight_control_board_v5.dtsi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp index ab88a46b..5af97d4c 100644 --- a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp +++ b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp @@ -11,7 +11,7 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 50, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 60, // !< The size of the table holding opcodes to dispatch CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress }; diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 8a5ced71..22f75c96 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -164,9 +164,9 @@ zephyr_udc0: &usbd { label = "INA219 sol"; }; - tca9548a: tca9548a@70 { + tca9548a: tca9548a@77 { compatible = "ti,tca9548a"; - reg = <0x70>; + reg = <0x77>; #address-cells = <1>; #size-cells = <0>; label = "TCA9548A"; From bdb62026c3ce92a7378b4bc8ba5b33a3bb0504d1 Mon Sep 17 00:00:00 2001 From: hrfarmer Date: Fri, 7 Nov 2025 14:45:27 -0600 Subject: [PATCH 22/68] update dtsi --- .../proves_flight_control_board_v5.dtsi | 165 +++++++++++++++++- 1 file changed, 162 insertions(+), 3 deletions(-) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 22f75c96..35ed3949 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -164,30 +164,189 @@ zephyr_udc0: &usbd { label = "INA219 sol"; }; + tca9548a: tca9548a@77 { compatible = "ti,tca9548a"; + status = "okay"; reg = <0x77>; #address-cells = <1>; #size-cells = <0>; label = "TCA9548A"; + reset-gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; - tca_channel0: channel@0 { + i2c_mux@0 { compatible = "ti,tca9548a-channel"; + label = "face0_i2c"; reg = <0>; #address-cells = <1>; #size-cells = <0>; + face0_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + + face0_drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "FACE0_DRV2605"; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + }; + + i2c_mux@1 { + compatible = "ti,tca9548a-channel"; + label = "face1_i2c"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + face1_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + + face1_drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "FACE1_DRV2605"; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + }; + + i2c_mux@2 { + compatible = "ti,tca9548a-channel"; + label = "face2_i2c"; + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + face2_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + + face2_drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "FACE2_DRV2605"; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + }; + + i2c_mux@3 { + compatible = "ti,tca9548a-channel"; + label = "face3_i2c"; + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + face3_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + + face3_drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "FACE3_DRV2605"; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + }; + + i2c_mux@4 { + compatible = "ti,tca9548a-channel"; + label = "battery_i2c"; + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + batt_cell1_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + batt_cell2_temp_sens: tmp112@73 { + compatible = "ti,tmp112"; + reg = <0x73>; + }; + batt_cell3_temp_sens: tmp112@74 { + compatible = "ti,tmp112"; + reg = <0x74>; + }; + batt_cell4_temp_sens: tmp112@75 { + compatible = "ti,tmp112"; + reg = <0x75>; + }; + }; + + i2c_mux@5 { + compatible = "ti,tca9548a-channel"; + label = "face4_i2c"; + reg = <5>; + #address-cells = <1>; + #size-cells = <0>; + face4_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; - drv2605: drv2605@5a { + face4_drv2605: drv2605@5a { compatible = "ti,drv2605"; status = "okay"; reg = <0x5a>; - label = "DRV2605"; + label = "FACE4_DRV2605"; actuator-mode = "LRA"; loop-gain = "HIGH"; feedback-brake-factor = "2X"; }; }; + + i2c_mux@6 { + compatible = "ti,tca9548a-channel"; + label = "face5_i2c"; + reg = <6>; + #address-cells = <1>; + #size-cells = <0>; + face5_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + + face5_drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "FACE5_DRV2605"; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + }; + + i2c_mux@7 { + compatible = "ti,tca9548a-channel"; + label = "top_i2c"; + reg = <7>; + #address-cells = <1>; + #size-cells = <0>; + top_temp_sens: tmp112@72 { + compatible = "ti,tmp112"; + reg = <0x72>; + }; + }; }; }; From d47659372ca994f8f40b36be283ff4a702e55d07 Mon Sep 17 00:00:00 2001 From: hrfarmer Date: Fri, 7 Nov 2025 15:28:13 -0600 Subject: [PATCH 23/68] update everything to handle multiple devices initialized --- .../MagnetorquerManager.cpp | 33 ++++++++++++++----- .../MagnetorquerManager.fpp | 10 +++--- .../MagnetorquerManager.hpp | 11 ++++--- .../ReferenceDeployment/Main.cpp | 16 +++++++-- .../Top/ReferenceDeploymentTopology.cpp | 2 +- .../Top/ReferenceDeploymentTopologyDefs.hpp | 14 ++++---- 6 files changed, 60 insertions(+), 26 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp index 4ae87c25..971a1985 100644 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp @@ -23,26 +23,43 @@ MagnetorquerManager ::~MagnetorquerManager() {} // Helper methods // ---------------------------------------------------------------------- -void MagnetorquerManager ::configure(const struct device* dev) { - this->m_dev = dev; +void MagnetorquerManager ::configure(const struct device* const devices[6]) { + for (int i = 0; i < 6; ++i) { + this->m_devices[i] = devices[i]; + } } -void MagnetorquerManager ::START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - if (!device_is_ready(this->m_dev)) { +void MagnetorquerManager ::START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) { + // Validate face index (0..5) + if (faceIdx >= 6) { + this->log_WARNING_HI_DeviceNotReady(); + return; + } + + const struct device* dev = this->m_devices[faceIdx]; + if (!device_is_ready(dev)) { this->log_WARNING_HI_DeviceNotReady(); return; } - drv2605_haptic_config(this->m_dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&this->rom); + + drv2605_haptic_config(dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&this->rom); } -void MagnetorquerManager ::START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - if (!device_is_ready(this->m_dev)) { +void MagnetorquerManager ::START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) { + // Validate face index (0..5) + if (faceIdx >= 6) { + this->log_WARNING_HI_DeviceNotReady(); + return; + } + + const struct device* dev = this->m_devices[faceIdx]; + if (!device_is_ready(dev)) { this->log_WARNING_HI_DeviceNotReady(); return; } struct drv2605_rom_data rom2 = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {50, 0, 0, 0, 0, 0, 0, 0}}; - drv2605_haptic_config(this->m_dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&rom2); + drv2605_haptic_config(dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&rom2); } } // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp index 62e23685..222f9bb0 100644 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp @@ -5,11 +5,13 @@ module Drv { @ Event for reporting DRV2605 not ready error event DeviceNotReady() severity warning high format "DRV2605 device not ready" throttle 5 - @ Start DRV2605 playback with effect #47 - sync command START_PLAYBACK_TEST() + @ Start DRV2605 playback on a device with effect #47 on a specific face + @ faceIdx: index of the face to actuate (valid range: 0..5) + sync command START_PLAYBACK_TEST(faceIdx: U8) - @ Start DRV2605 playback with effect #50 - sync command START_PLAYBACK_TEST2() + @ Start DRV2605 playback on a device with effect #50 on a specific face + @ faceIdx: index of the face to actuate (valid range: 0..5) + sync command START_PLAYBACK_TEST2(faceIdx: U8) # @ Example telemetry counter # telemetry ExampleCounter: U64 diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp index 68a4480b..460ef2df 100644 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp +++ b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp @@ -31,15 +31,18 @@ class MagnetorquerManager final : public MagnetorquerManagerComponentBase { ~MagnetorquerManager(); //! Configure the DRV2605 device - void configure(const struct device* dev); + // Accept an array of six pointers to const device objects. The pointers themselves are const + // to match callers that provide const device* const* types. + void configure(const struct device* const devices[6]); private: //! Zephyr device to store initialized DRV2605 - const struct device* m_dev; + const struct device* m_devices[6]; struct drv2605_rom_data rom = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {47, 0, 0, 0, 0, 0, 0, 0}}; - void START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; - void START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; + // Command handlers updated to accept a face index (0..5) + void START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) override; + void START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) override; }; } // namespace Drv diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index b5b6aafa..43c9c073 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -16,7 +16,14 @@ const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0)); const struct device* lsm6dso = DEVICE_DT_GET(DT_NODELABEL(lsm6dso0)); const struct device* lis2mdl = DEVICE_DT_GET(DT_NODELABEL(lis2mdl0)); -const struct device* drv2605 = device_get_binding("DRV2605"); + +// Magnetorquer devices +const struct device* face0_drv2605 = device_get_binding("FACE0_DRV2605"); +const struct device* face1_drv2605 = device_get_binding("FACE1_DRV2605"); +const struct device* face2_drv2605 = device_get_binding("FACE2_DRV2605"); +const struct device* face3_drv2605 = device_get_binding("FACE3_DRV2605"); +const struct device* face4_drv2605 = device_get_binding("FACE4_DRV2605"); +const struct device* face5_drv2605 = device_get_binding("FACE5_DRV2605"); int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// @@ -33,7 +40,12 @@ int main(int argc, char* argv[]) { inputs.uartDevice = serial; inputs.lsm6dsoDevice = lsm6dso; inputs.lis2mdlDevice = lis2mdl; - inputs.drv2605Device = drv2605; + inputs.drv2605Devices[0] = face0_drv2605; + inputs.drv2605Devices[1] = face1_drv2605; + inputs.drv2605Devices[2] = face2_drv2605; + inputs.drv2605Devices[3] = face3_drv2605; + inputs.drv2605Devices[4] = face4_drv2605; + inputs.drv2605Devices[5] = face5_drv2605; inputs.baudRate = 115200; // Setup, cycle, and teardown topology diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 12dd0814..43296dd7 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -92,7 +92,7 @@ void setupTopology(const TopologyState& state) { lis2mdlManager.configure(state.lis2mdlDevice); ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); - magnetorquerManager.configure(state.drv2605Device); + magnetorquerManager.configure(state.drv2605Devices); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 71146aa3..ff27f01b 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -69,13 +69,13 @@ namespace ReferenceDeployment { * autocoder. The contents are entirely up to the definition of the project. This deployment uses subtopologies. */ struct TopologyState { - const device* ina219SysDevice; //!< device path for battery board ina219 - const device* ina219SolDevice; //!< device path for solar panel ina219 - const device* uartDevice; //!< UART device path for communication - const device* loraDevice; //!< LoRa device path for communication - const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope - const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer - const device* drv2605Device; + const device* ina219SysDevice; //!< device path for battery board ina219 + const device* ina219SolDevice; //!< device path for solar panel ina219 + const device* uartDevice; //!< UART device path for communication + const device* loraDevice; //!< LoRa device path for communication + const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope + const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer + const device* drv2605Devices[6]; //!< Array of drv2605 devices (6) U32 baudRate; //!< Baud rate for UART communication CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds From 194a67a5ed6255315c509e863282351757e063d2 Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Fri, 7 Nov 2025 14:38:37 -0800 Subject: [PATCH 24/68] Hello World --- .../Top/ReferenceDeploymentTopology.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 86e2791f..6571a0e5 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -61,14 +61,14 @@ void configureTopology() { gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); - face4LoadSwitch.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 - face0LoadSwitch.pin_configuration(mcp23017_dev, 1); // Pin 1 on MCP23017 - face1LoadSwitch.pin_configuration(mcp23017_dev, 2); // Pin 2 on MCP23017 - face2LoadSwitch.pin_configuration(mcp23017_dev, 3); // Pin 3 on MCP23017 - face3LoadSwitch.pin_configuration(mcp23017_dev, 4); // Pin 4 on MCP23017 - face5LoadSwitch.pin_configuration(mcp23017_dev, 5); // Pin 5 on MCP23017 - payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 7); // Pin 7 on MCP23017 - payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 9); // Pin 9 on MCP23017 + face4LoadSwitch.pin_configuration(mcp23017_dev, 8); + face0LoadSwitch.pin_configuration(mcp23017_dev, 9); + face1LoadSwitch.pin_configuration(mcp23017_dev, 10); + face2LoadSwitch.pin_configuration(mcp23017_dev, 11); + face3LoadSwitch.pin_configuration(mcp23017_dev, 12); + face5LoadSwitch.pin_configuration(mcp23017_dev, 13); + payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 1); + payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 3); } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment From c5f9066f0ba4712a5784af00e807868f002fe055 Mon Sep 17 00:00:00 2001 From: "Sam S. Yu" <25761223+yudataguy@users.noreply.github.com> Date: Fri, 7 Nov 2025 16:30:07 -0800 Subject: [PATCH 25/68] current working tmp112 sensors --- .../Components/CMakeLists.txt | 1 + .../Components/ThermalManager/CMakeLists.txt | 18 +++++++ .../ThermalManager/ThermalManager.cpp | 43 +++++++++++++++++ .../ThermalManager/ThermalManager.fpp | 47 +++++++++++++++++++ .../ThermalManager/ThermalManager.hpp | 41 ++++++++++++++++ .../ReferenceDeployment/Main.cpp | 29 +++++++++++- .../Top/ReferenceDeploymentPackets.fppi | 15 +++++- .../Top/ReferenceDeploymentTopology.cpp | 14 +++++- .../Top/ReferenceDeploymentTopologyDefs.hpp | 15 +++++- .../ReferenceDeployment/Top/instances.fpp | 24 +++++++++- .../ReferenceDeployment/Top/topology.fpp | 28 ++++++++++- 11 files changed, 268 insertions(+), 7 deletions(-) create mode 100644 FprimeZephyrReference/Components/ThermalManager/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp create mode 100644 FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp create mode 100644 FprimeZephyrReference/Components/ThermalManager/ThermalManager.hpp diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index 9b9cab94..0902ae1c 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -10,4 +10,5 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FsSpace/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PowerMonitor/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ThermalManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") diff --git a/FprimeZephyrReference/Components/ThermalManager/CMakeLists.txt b/FprimeZephyrReference/Components/ThermalManager/CMakeLists.txt new file mode 100644 index 00000000..16905ca2 --- /dev/null +++ b/FprimeZephyrReference/Components/ThermalManager/CMakeLists.txt @@ -0,0 +1,18 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/ThermalManager.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/ThermalManager.cpp" +) diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp new file mode 100644 index 00000000..7fcc7db0 --- /dev/null +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -0,0 +1,43 @@ +// ====================================================================== +// \title ThermalManager.cpp +// \brief cpp file for ThermalManager component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/ThermalManager/ThermalManager.hpp" +#include + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ThermalManager::ThermalManager(const char* const compName) : ThermalManagerComponentBase(compName) {} + +ThermalManager::~ThermalManager() {} + +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +void ThermalManager::run_handler(FwIndexType portNum, U32 context) { + // Read all 11 temperature sensors + // Cube face sensors (6 sensors) + this->face0TempGet_out(0); + this->face1TempGet_out(0); + this->face2TempGet_out(0); + this->face3TempGet_out(0); + this->face4TempGet_out(0); + this->face5TempGet_out(0); + + // Top sensor + this->topTempGet_out(0); + + // Battery cell sensors (4 sensors) + this->battCell1TempGet_out(0); + this->battCell2TempGet_out(0); + this->battCell3TempGet_out(0); + this->battCell4TempGet_out(0); +} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp new file mode 100644 index 00000000..65811c76 --- /dev/null +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -0,0 +1,47 @@ +module Components { + @ Thermal Manager Component for F Prime FSW framework. + @ Orchestrates temperature sensor readings from 11 TMP112 sensors + passive component ThermalManager { + sync input port run: Svc.Sched + + # Output ports to TMP112Manager instances + @ Port for face 0 temperature sensor + output port face0TempGet: Drv.AmbientTemperatureGet + + @ Port for face 1 temperature sensor + output port face1TempGet: Drv.AmbientTemperatureGet + + @ Port for face 2 temperature sensor + output port face2TempGet: Drv.AmbientTemperatureGet + + @ Port for face 3 temperature sensor + output port face3TempGet: Drv.AmbientTemperatureGet + + @ Port for face 4 temperature sensor + output port face4TempGet: Drv.AmbientTemperatureGet + + @ Port for face 5 temperature sensor + output port face5TempGet: Drv.AmbientTemperatureGet + + @ Port for top temperature sensor + output port topTempGet: Drv.AmbientTemperatureGet + + @ Port for battery cell 1 temperature sensor + output port battCell1TempGet: Drv.AmbientTemperatureGet + + @ Port for battery cell 2 temperature sensor + output port battCell2TempGet: Drv.AmbientTemperatureGet + + @ Port for battery cell 3 temperature sensor + output port battCell3TempGet: Drv.AmbientTemperatureGet + + @ Port for battery cell 4 temperature sensor + output port battCell4TempGet: Drv.AmbientTemperatureGet + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + } +} diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.hpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.hpp new file mode 100644 index 00000000..e307de18 --- /dev/null +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.hpp @@ -0,0 +1,41 @@ +// ====================================================================== +// \title ThermalManager.hpp +// \brief hpp file for ThermalManager component implementation class +// ====================================================================== + +#ifndef Components_ThermalManager_HPP +#define Components_ThermalManager_HPP + +#include "FprimeZephyrReference/Components/ThermalManager/ThermalManagerComponentAc.hpp" + +namespace Components { + +class ThermalManager final : public ThermalManagerComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ThermalManager object + ThermalManager(const char* const compName //!< The component name + ); + + //! Destroy ThermalManager object + ~ThermalManager(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for run + //! + //! Scheduled port for periodic temperature reading + void run_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index e87ba32e..18889f8c 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -16,7 +16,19 @@ const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0)); const struct device* lsm6dso = DEVICE_DT_GET(DT_NODELABEL(lsm6dso0)); const struct device* lis2mdl = DEVICE_DT_GET(DT_NODELABEL(lis2mdl0)); -const struct device* tmp112 = device_get_binding("TMP112"); + +// TMP112 temperature sensors (11 sensors behind I2C multiplexer) +const struct device* face0_temp = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sens)); +const struct device* face1_temp = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); +const struct device* face2_temp = DEVICE_DT_GET(DT_NODELABEL(face2_temp_sens)); +const struct device* face3_temp = DEVICE_DT_GET(DT_NODELABEL(face3_temp_sens)); +const struct device* face4_temp = DEVICE_DT_GET(DT_NODELABEL(face4_temp_sens)); +const struct device* face5_temp = DEVICE_DT_GET(DT_NODELABEL(face5_temp_sens)); +const struct device* top_temp = DEVICE_DT_GET(DT_NODELABEL(top_temp_sens)); +const struct device* batt_cell1_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell1_temp_sens)); +const struct device* batt_cell2_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell2_temp_sens)); +const struct device* batt_cell3_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell3_temp_sens)); +const struct device* batt_cell4_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell4_temp_sens)); int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// @@ -33,7 +45,20 @@ int main(int argc, char* argv[]) { inputs.uartDevice = serial; inputs.lsm6dsoDevice = lsm6dso; inputs.lis2mdlDevice = lis2mdl; - inputs.tmp112Device = tmp112; + + // TMP112 temperature sensor devices + inputs.face0TempDevice = face0_temp; + inputs.face1TempDevice = face1_temp; + inputs.face2TempDevice = face2_temp; + inputs.face3TempDevice = face3_temp; + inputs.face4TempDevice = face4_temp; + inputs.face5TempDevice = face5_temp; + inputs.topTempDevice = top_temp; + inputs.battCell1TempDevice = batt_cell1_temp; + inputs.battCell2TempDevice = batt_cell2_temp; + inputs.battCell3TempDevice = batt_cell3_temp; + inputs.battCell4TempDevice = batt_cell4_temp; + inputs.baudRate = 115200; // Setup, cycle, and teardown topology diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 3680f528..9184ee00 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -49,7 +49,6 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.lsm6dsoManager.AngularVelocity ReferenceDeployment.lsm6dsoManager.Temperature ReferenceDeployment.lis2mdlManager.MagneticField - ReferenceDeployment.tmp112Manager.AmbientTemperature } packet LoRa id 7 group 4 { @@ -71,6 +70,20 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.ina219SolManager.Power } + packet Thermal id 10 group 4 { + ReferenceDeployment.tmp112Face0Manager.AmbientTemperature + ReferenceDeployment.tmp112Face1Manager.AmbientTemperature + ReferenceDeployment.tmp112Face2Manager.AmbientTemperature + ReferenceDeployment.tmp112Face3Manager.AmbientTemperature + ReferenceDeployment.tmp112Face4Manager.AmbientTemperature + ReferenceDeployment.tmp112Face5Manager.AmbientTemperature + ReferenceDeployment.tmp112TopManager.AmbientTemperature + ReferenceDeployment.tmp112BattCell1Manager.AmbientTemperature + ReferenceDeployment.tmp112BattCell2Manager.AmbientTemperature + ReferenceDeployment.tmp112BattCell3Manager.AmbientTemperature + ReferenceDeployment.tmp112BattCell4Manager.AmbientTemperature + } + } omit { CdhCore.cmdDisp.CommandErrors # Only has one library, no custom versions diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 3db0ce13..3724eac2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -92,7 +92,19 @@ void setupTopology(const TopologyState& state) { lis2mdlManager.configure(state.lis2mdlDevice); ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); - tmp112Manager.configure(state.tmp112Device); + + // Configure all 11 TMP112 temperature sensor managers + tmp112Face0Manager.configure(state.face0TempDevice); + tmp112Face1Manager.configure(state.face1TempDevice); + tmp112Face2Manager.configure(state.face2TempDevice); + tmp112Face3Manager.configure(state.face3TempDevice); + tmp112Face4Manager.configure(state.face4TempDevice); + tmp112Face5Manager.configure(state.face5TempDevice); + tmp112TopManager.configure(state.topTempDevice); + tmp112BattCell1Manager.configure(state.battCell1TempDevice); + tmp112BattCell2Manager.configure(state.battCell2TempDevice); + tmp112BattCell3Manager.configure(state.battCell3TempDevice); + tmp112BattCell4Manager.configure(state.battCell4TempDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index f4eaad02..4012dd80 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -75,7 +75,20 @@ struct TopologyState { const device* loraDevice; //!< LoRa device path for communication const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer - const device* tmp112Device; //!< TMP112 device path for temperature sensor + + // TMP112 temperature sensor devices (11 sensors) + const device* face0TempDevice; //!< TMP112 device for cube face 0 + const device* face1TempDevice; //!< TMP112 device for cube face 1 + const device* face2TempDevice; //!< TMP112 device for cube face 2 + const device* face3TempDevice; //!< TMP112 device for cube face 3 + const device* face4TempDevice; //!< TMP112 device for cube face 4 + const device* face5TempDevice; //!< TMP112 device for cube face 5 + const device* topTempDevice; //!< TMP112 device for cube top + const device* battCell1TempDevice; //!< TMP112 device for battery cell 1 + const device* battCell2TempDevice; //!< TMP112 device for battery cell 2 + const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 + const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 + U32 baudRate; //!< Baud rate for UART communication CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index a666dba4..b475576e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -96,5 +96,27 @@ module ReferenceDeployment { instance ina219SolManager: Drv.Ina219Manager base id 0x10033000 - instance tmp112Manager: Drv.TMP112Manager base id 0x10034000 + instance thermalManager: Components.ThermalManager base id 0x10034000 + + instance tmp112Face0Manager: Drv.TMP112Manager base id 0x10035000 + + instance tmp112Face1Manager: Drv.TMP112Manager base id 0x10036000 + + instance tmp112Face2Manager: Drv.TMP112Manager base id 0x10037000 + + instance tmp112Face3Manager: Drv.TMP112Manager base id 0x10038000 + + instance tmp112Face4Manager: Drv.TMP112Manager base id 0x10039000 + + instance tmp112Face5Manager: Drv.TMP112Manager base id 0x1003A000 + + instance tmp112TopManager: Drv.TMP112Manager base id 0x1003B000 + + instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x1003C000 + + instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x1003D000 + + instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x1003E000 + + instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x1003F000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 549c2719..deafc464 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -47,7 +47,18 @@ module ReferenceDeployment { instance powerMonitor instance ina219SysManager instance ina219SolManager - instance tmp112Manager + instance thermalManager + instance tmp112Face0Manager + instance tmp112Face1Manager + instance tmp112Face2Manager + instance tmp112Face3Manager + instance tmp112Face4Manager + instance tmp112Face5Manager + instance tmp112TopManager + instance tmp112BattCell1Manager + instance tmp112BattCell2Manager + instance tmp112BattCell3Manager + instance tmp112BattCell4Manager # ---------------------------------------------------------------------- @@ -142,6 +153,7 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run rateGroup1Hz.RateGroupMemberOut[10] -> powerMonitor.run + rateGroup1Hz.RateGroupMemberOut[11] -> thermalManager.run } @@ -176,5 +188,19 @@ module ReferenceDeployment { powerMonitor.solPowerGet -> ina219SolManager.powerGet } + connections thermalMonitor { + thermalManager.face0TempGet -> tmp112Face0Manager.ambientTemperatureGet + thermalManager.face1TempGet -> tmp112Face1Manager.ambientTemperatureGet + thermalManager.face2TempGet -> tmp112Face2Manager.ambientTemperatureGet + thermalManager.face3TempGet -> tmp112Face3Manager.ambientTemperatureGet + thermalManager.face4TempGet -> tmp112Face4Manager.ambientTemperatureGet + thermalManager.face5TempGet -> tmp112Face5Manager.ambientTemperatureGet + thermalManager.topTempGet -> tmp112TopManager.ambientTemperatureGet + thermalManager.battCell1TempGet -> tmp112BattCell1Manager.ambientTemperatureGet + thermalManager.battCell2TempGet -> tmp112BattCell2Manager.ambientTemperatureGet + thermalManager.battCell3TempGet -> tmp112BattCell3Manager.ambientTemperatureGet + thermalManager.battCell4TempGet -> tmp112BattCell4Manager.ambientTemperatureGet + } + } } From c1e1efb00220dd453dc8ee78c9ebc55292499051 Mon Sep 17 00:00:00 2001 From: "Sam S. Yu" <25761223+yudataguy@users.noreply.github.com> Date: Tue, 11 Nov 2025 19:37:23 -0800 Subject: [PATCH 26/68] maybe not the best working code, possible revert to previous commit --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 7 ++ .../Components/LoadSwitch/LoadSwitch.cpp | 3 +- .../Components/LoadSwitch/LoadSwitch.hpp | 2 +- .../ReferenceDeployment/Main.cpp | 101 +++++++++++++----- .../Top/ReferenceDeploymentTopology.cpp | 27 +++++ prj.conf | 14 +-- 6 files changed, 121 insertions(+), 33 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index ffdc8268..7b1b9fd2 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -5,6 +5,7 @@ #include "FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp" #include +#include namespace Drv { @@ -31,6 +32,8 @@ void TMP112Manager::configure(const struct device* dev) { F64 TMP112Manager ::ambientTemperatureGet_handler(FwIndexType portNum) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); + printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", + this->m_dev->name, this->m_dev); return 0; } this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); @@ -40,12 +43,16 @@ F64 TMP112Manager ::ambientTemperatureGet_handler(FwIndexType portNum) { int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); if (rc != 0) { // Sensor fetch failed - return 0 to indicate error + printk("[TMP112Manager] sensor_sample_fetch_chan failed for %s: rc=%d\n", + this->m_dev->name, rc); return 0; } rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); if (rc != 0) { // Channel get failed - return 0 to indicate error + printk("[TMP112Manager] sensor_channel_get failed for %s: rc=%d\n", + this->m_dev->name, rc); return 0; } diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index b61ff198..1bbd1fcd 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -9,7 +9,6 @@ namespace Components { -const struct device* LoadSwitch::m_device = nullptr; // ---------------------------------------------------------------------- // Component construction and destruction // ---------------------------------------------------------------------- @@ -50,7 +49,7 @@ void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { void LoadSwitch ::pin_configuration(const struct device* device, uint8_t pinNum) { this->m_pinNum = pinNum; this->m_device = device; - gpio_pin_configure(m_device, m_pinNum, GPIO_OUTPUT_INACTIVE); + gpio_pin_configure(m_device, m_pinNum, GPIO_OUTPUT_ACTIVE); } } // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index bc94e4ea..796694a0 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -62,7 +62,7 @@ class LoadSwitch final : public LoadSwitchComponentBase { // ---------------------------------------------------------------------- uint8_t m_pinNum; - static const struct device* m_device; + const struct device* m_device; }; } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 9be6e369..ca044d5e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -9,6 +9,7 @@ #include #include +#include const struct device* ina219Sys = device_get_binding("INA219 sys"); const struct device* ina219Sol = device_get_binding("INA219 sol"); @@ -16,19 +17,7 @@ const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0)); const struct device* lsm6dso = DEVICE_DT_GET(DT_NODELABEL(lsm6dso0)); const struct device* lis2mdl = DEVICE_DT_GET(DT_NODELABEL(lis2mdl0)); - -// TMP112 temperature sensors (11 sensors behind I2C multiplexer) -const struct device* face0_temp = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sens)); -const struct device* face1_temp = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); -const struct device* face2_temp = DEVICE_DT_GET(DT_NODELABEL(face2_temp_sens)); -const struct device* face3_temp = DEVICE_DT_GET(DT_NODELABEL(face3_temp_sens)); -const struct device* face4_temp = DEVICE_DT_GET(DT_NODELABEL(face4_temp_sens)); -const struct device* face5_temp = DEVICE_DT_GET(DT_NODELABEL(face5_temp_sens)); -const struct device* top_temp = DEVICE_DT_GET(DT_NODELABEL(top_temp_sens)); -const struct device* batt_cell1_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell1_temp_sens)); -const struct device* batt_cell2_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell2_temp_sens)); -const struct device* batt_cell3_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell3_temp_sens)); -const struct device* batt_cell4_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell4_temp_sens)); +const struct device* mcp23017 = DEVICE_DT_GET(DT_NODELABEL(mcp23017)); // Magnetorquer devices const struct device* face0_drv2605 = device_get_binding("FACE0_DRV2605"); @@ -38,6 +27,47 @@ const struct device* face3_drv2605 = device_get_binding("FACE3_DRV2605"); const struct device* face4_drv2605 = device_get_binding("FACE4_DRV2605"); const struct device* face5_drv2605 = device_get_binding("FACE5_DRV2605"); +/** + * @brief Early boot initialization function to power on load switches + * + * This function runs during system initialization BEFORE sensor devices initialize. + * It powers on all face board and battery board load switches to ensure TMP112 + * sensors have power when their init functions run. + * + * Priority: 75 (after I2C mux channels at 71, before sensors at 90) + */ +static int proves_board_power_init(void) { + const struct device* mcp23017_dev = DEVICE_DT_GET(DT_NODELABEL(mcp23017)); + + if (!device_is_ready(mcp23017_dev)) { + printk("ERROR: MCP23017 not ready during early boot init!\n"); + return -1; + } + + printk("[Early Init] Powering on all face boards and battery board...\n"); + + // Turn on all 6 face board load switches + gpio_pin_configure(mcp23017_dev, 8, GPIO_OUTPUT_ACTIVE); // face4 + gpio_pin_configure(mcp23017_dev, 9, GPIO_OUTPUT_ACTIVE); // face0 + gpio_pin_configure(mcp23017_dev, 10, GPIO_OUTPUT_ACTIVE); // face1 + gpio_pin_configure(mcp23017_dev, 11, GPIO_OUTPUT_ACTIVE); // face2 + gpio_pin_configure(mcp23017_dev, 12, GPIO_OUTPUT_ACTIVE); // face3 + gpio_pin_configure(mcp23017_dev, 13, GPIO_OUTPUT_ACTIVE); // face5 + + // Turn on battery board load switch + gpio_pin_configure(mcp23017_dev, 3, GPIO_OUTPUT_ACTIVE); // battery + + // Allow 100ms for power to stabilize before sensor init + k_sleep(K_MSEC(100)); + + printk("[Early Init] All boards powered on, ready for sensor initialization\n"); + + return 0; +} + +// Register early init function to run after I2C mux (71) but before sensors (90) +SYS_INIT(proves_board_power_init, POST_KERNEL, 75); + int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// // @@ -45,6 +75,10 @@ int main(int argc, char* argv[]) { // the application starts writing to it. k_sleep(K_MSEC(3000)); Os::init(); + + // NOTE: Load switches are now powered on during early boot (SYS_INIT) + // before sensor initialization. See proves_board_power_init() above. + // Object for communicating state to the topology ReferenceDeployment::TopologyState inputs; inputs.ina219SysDevice = ina219Sys; @@ -55,17 +89,36 @@ int main(int argc, char* argv[]) { inputs.lis2mdlDevice = lis2mdl; // TMP112 temperature sensor devices - inputs.face0TempDevice = face0_temp; - inputs.face1TempDevice = face1_temp; - inputs.face2TempDevice = face2_temp; - inputs.face3TempDevice = face3_temp; - inputs.face4TempDevice = face4_temp; - inputs.face5TempDevice = face5_temp; - inputs.topTempDevice = top_temp; - inputs.battCell1TempDevice = batt_cell1_temp; - inputs.battCell2TempDevice = batt_cell2_temp; - inputs.battCell3TempDevice = batt_cell3_temp; - inputs.battCell4TempDevice = batt_cell4_temp; + inputs.face0TempDevice = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sens)); + inputs.face1TempDevice = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); + inputs.face2TempDevice = DEVICE_DT_GET(DT_NODELABEL(face2_temp_sens)); + inputs.face3TempDevice = DEVICE_DT_GET(DT_NODELABEL(face3_temp_sens)); + inputs.face4TempDevice = DEVICE_DT_GET(DT_NODELABEL(face4_temp_sens)); + inputs.face5TempDevice = DEVICE_DT_GET(DT_NODELABEL(face5_temp_sens)); + inputs.topTempDevice = DEVICE_DT_GET(DT_NODELABEL(top_temp_sens)); + inputs.battCell1TempDevice = DEVICE_DT_GET(DT_NODELABEL(batt_cell1_temp_sens)); + inputs.battCell2TempDevice = DEVICE_DT_GET(DT_NODELABEL(batt_cell2_temp_sens)); + inputs.battCell3TempDevice = DEVICE_DT_GET(DT_NODELABEL(batt_cell3_temp_sens)); + inputs.battCell4TempDevice = DEVICE_DT_GET(DT_NODELABEL(batt_cell4_temp_sens)); + + // Diagnostic: Check which TMP112 sensors are ready + printk("\n=== TMP112 Sensor Ready Status ===\n"); + const struct device* sensors[] = { + inputs.face0TempDevice, inputs.face1TempDevice, + inputs.face2TempDevice, inputs.face3TempDevice, + inputs.face4TempDevice, inputs.face5TempDevice, + inputs.topTempDevice, + inputs.battCell1TempDevice, inputs.battCell2TempDevice, + inputs.battCell3TempDevice, inputs.battCell4TempDevice + }; + const char* names[] = {"face0", "face1", "face2", "face3", + "face4", "face5", "top", + "batt1", "batt2", "batt3", "batt4"}; + for(int i=0; i<11; i++) { + int ready = device_is_ready(sensors[i]); + printk(" %s: %s (ptr: %p)\n", names[i], ready ? "READY" : "NOT READY", sensors[i]); + } + printk("==================================\n\n"); // Magnetorquer devices inputs.drv2605Devices[0] = face0_drv2605; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 2244b200..ab61e569 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -12,6 +12,7 @@ #include #include +#include static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios); static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire0), gpios); @@ -69,6 +70,32 @@ void configureTopology() { face5LoadSwitch.pin_configuration(mcp23017_dev, 13); payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 1); payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 3); + + // TMP112 temperature sensors (11 sensors behind I2C multiplexer) + const struct device* face0_temp = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sens)); + const struct device* face1_temp = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); + const struct device* face2_temp = DEVICE_DT_GET(DT_NODELABEL(face2_temp_sens)); + const struct device* face3_temp = DEVICE_DT_GET(DT_NODELABEL(face3_temp_sens)); + const struct device* face4_temp = DEVICE_DT_GET(DT_NODELABEL(face4_temp_sens)); + const struct device* face5_temp = DEVICE_DT_GET(DT_NODELABEL(face5_temp_sens)); + const struct device* top_temp = DEVICE_DT_GET(DT_NODELABEL(top_temp_sens)); + const struct device* batt_cell1_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell1_temp_sens)); + const struct device* batt_cell2_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell2_temp_sens)); + const struct device* batt_cell3_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell3_temp_sens)); + const struct device* batt_cell4_temp = DEVICE_DT_GET(DT_NODELABEL(batt_cell4_temp_sens)); + + // Suppress unused variable warnings + (void)face0_temp; + (void)face1_temp; + (void)face2_temp; + (void)face3_temp; + (void)face4_temp; + (void)face5_temp; + (void)top_temp; + (void)batt_cell1_temp; + (void)batt_cell2_temp; + (void)batt_cell3_temp; + (void)batt_cell4_temp; } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/prj.conf b/prj.conf index 463d40a1..153833b5 100644 --- a/prj.conf +++ b/prj.conf @@ -28,17 +28,16 @@ CONFIG_GPIO=y CONFIG_LED=y CONFIG_PWM=n CONFIG_I2C=y -# I2C multiplexer (TCA9548A) priority configuration -CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=70 -CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=71 CONFIG_SPI=y CONFIG_PINCTRL=y CONFIG_ASSERT=y #### I2C Multiplexer Configuration #### CONFIG_I2C_TCA954X=y -CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=50 -CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=51 +# Priority order: I2C Bus (16) < GPIO (11) < Mux Root (70) < Mux Channels (71) < Load Switches (75) < Sensors (90) +# Mux must initialize AFTER I2C bus (16) and GPIO (11) but BEFORE sensors (90) +CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=70 +CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=71 CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y @@ -58,8 +57,11 @@ CONFIG_COMMON_LIBC_MALLOC=y CONFIG_SENSOR=y -CONFIG_LOG=n +# Enable detailed logging for I2C and sensor debugging +CONFIG_LOG=y CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_I2C_LOG_LEVEL_DBG=y +CONFIG_SENSOR_LOG_LEVEL_DBG=y CONFIG_CBPRINTF_FP_SUPPORT=y From 712cc6fd97563bb11aa0f1d19985566403a671a5 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 26 Nov 2025 16:04:02 -0600 Subject: [PATCH 27/68] Remove loadswitch --- .../Components/CMakeLists.txt | 1 - .../Components/LoadSwitch/CMakeLists.txt | 36 ---------- .../Components/LoadSwitch/LoadSwitch.cpp | 55 -------------- .../Components/LoadSwitch/LoadSwitch.fpp | 72 ------------------- .../Components/LoadSwitch/LoadSwitch.hpp | 70 ------------------ .../Components/LoadSwitch/docs/sdd.md | 66 ----------------- 6 files changed, 300 deletions(-) delete mode 100644 FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt delete mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp delete mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp delete mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp delete mode 100644 FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index 3d371a43..0902ae1c 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -12,4 +12,3 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PowerMonitor/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ThermalManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/") diff --git a/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt b/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt deleted file mode 100644 index 5be47b2d..00000000 --- a/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -#### -# F Prime CMakeLists.txt: -# -# SOURCES: list of source files (to be compiled) -# AUTOCODER_INPUTS: list of files to be passed to the autocoders -# DEPENDS: list of libraries that this module depends on -# -# More information in the F´ CMake API documentation: -# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ -# -#### - -# Module names are derived from the path from the nearest project/library/framework -# root when not specifically overridden by the developer. i.e. The module defined by -# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. - -register_fprime_library( - AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp" - SOURCES - "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.cpp" -# DEPENDS -# MyPackage_MyOtherModule -) - -### Unit Tests ### -# register_fprime_ut( -# AUTOCODER_INPUTS -# "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp" -# SOURCES -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTestMain.cpp" -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTester.cpp" -# DEPENDS -# STest # For rules-based testing -# UT_AUTO_HELPERS -# ) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp deleted file mode 100644 index 1bbd1fcd..00000000 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// ====================================================================== -// \title LoadSwitch.cpp -// \author sarah -// \brief cpp file for LoadSwitch component implementation class -// ====================================================================== - -#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp" -#include - -namespace Components { - -// ---------------------------------------------------------------------- -// Component construction and destruction -// ---------------------------------------------------------------------- - -LoadSwitch ::LoadSwitch(const char* const compName) : LoadSwitchComponentBase(compName) {} - -LoadSwitch ::~LoadSwitch() {} - -// ---------------------------------------------------------------------- -// Handler implementations for typed input ports -// ---------------------------------------------------------------------- - -void LoadSwitch ::Reset_handler(FwIndexType portNum) { - gpio_pin_set(m_device, m_pinNum, 0); - k_sleep(K_MSEC(100)); - gpio_pin_set(m_device, m_pinNum, 1); -} - -// ---------------------------------------------------------------------- -// Handler implementations for commands -// ---------------------------------------------------------------------- - -void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - gpio_pin_set(m_device, m_pinNum, 1); - this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON); - // I think some code needed to send this status to the port as well - this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); -} - -void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - gpio_pin_set(m_device, m_pinNum, 0); - this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF); - // I think some code needed to send this status to the port as well - this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); -} - -// This is meant to be used in Topology.cpp to configure the pin and device -void LoadSwitch ::pin_configuration(const struct device* device, uint8_t pinNum) { - this->m_pinNum = pinNum; - this->m_device = device; - gpio_pin_configure(m_device, m_pinNum, GPIO_OUTPUT_ACTIVE); -} - -} // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp deleted file mode 100644 index 8a166d55..00000000 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ /dev/null @@ -1,72 +0,0 @@ -module Components { - @ A generic load switch for controlling power to components - active component LoadSwitch { - - # One async command/port is required for active components - # This should be overridden by the developers with a useful command/port - - ############################################################################## - #### Uncomment the following examples to start customizing your component #### - ############################################################################## - - # @ Example async command - # async command COMMAND_NAME(param_name: U32) - async command TURN_ON() - async command TURN_OFF() - - # @ Example telemetry counter - # telemetry ExampleCounter: U64 - telemetry IsOn: Fw.On - - # @ Example event - # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" - event StatusChanged($state: Fw.On) severity activity high id 1 format "Load switch state changed to {}" - - # @ Example port: receiving calls from the rate group - # sync input port run: Svc.Sched - #output port Status: Drv.GpioRead - #We will not be putting a Drv.GpioRead port here, we are using the Gpio Driver component which has this already! - - @ Port sending calls to the GPIO driver - output port gpioSet: Drv.GpioWrite - - - # Input that will be used by other components if they want to force a reset - # (off and on again) of the load switch - async input port Reset: Fw.Signal - - # @ Example parameter - # param PARAMETER_NAME: U32 - - ############################################################################### - # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # - ############################################################################### - @ Port for requesting the current time - time get port timeCaller - - @ Port for sending command registrations - command reg port cmdRegOut - - @ Port for receiving commands - command recv port cmdIn - - @ Port for sending command responses - command resp port cmdResponseOut - - @ Port for sending textual representation of events - text event port logTextOut - - @ Port for sending events to downlink - event port logOut - - @ Port for sending telemetry channels to downlink - telemetry port tlmOut - - @ Port to return the value of a parameter - param get port prmGetOut - - @Port to set the value of a parameter - param set port prmSetOut - - } -} diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp deleted file mode 100644 index 796694a0..00000000 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// ====================================================================== -// \title LoadSwitch.hpp -// \author sarah -// \brief hpp file for LoadSwitch component implementation class -// ====================================================================== - -#ifndef Components_LoadSwitch_HPP -#define Components_LoadSwitch_HPP - -#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" -#include - -// Forward declare Zephyr types to avoid header conflicts -struct device; - -namespace Components { - -class LoadSwitch final : public LoadSwitchComponentBase { - public: - // ---------------------------------------------------------------------- - // Component construction and destruction - // ---------------------------------------------------------------------- - - //! Construct LoadSwitch object - LoadSwitch(const char* const compName //!< The component name - ); - - //! Destroy LoadSwitch object - ~LoadSwitch(); - - // ---------------------------------------------------------------------- - // Configuration Meant to be used in ***Topology.cpp - // ---------------------------------------------------------------------- - - void pin_configuration(const struct device* device, uint8_t pinNum); - - private: - // ---------------------------------------------------------------------- - // Handler implementations for commands - // ---------------------------------------------------------------------- - - //! Handler implementation for command TURN_ON - void TURN_ON_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq //!< The command sequence number - ) override; - - //! Handler implementation for command TURN_OFF - void TURN_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq //!< The command sequence number - ) override; - - // ---------------------------------------------------------------------- - // Handler implementations for typed input ports - // ---------------------------------------------------------------------- - - //! Handler implementation for Reset - void Reset_handler(FwIndexType portNum //!< The port number - ) override; - - // ---------------------------------------------------------------------- - // Member variables - // ---------------------------------------------------------------------- - - uint8_t m_pinNum; - const struct device* m_device; -}; - -} // namespace Components - -#endif diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md deleted file mode 100644 index c1bbcfe8..00000000 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ /dev/null @@ -1,66 +0,0 @@ -# Components::LoadSwitch - -A generic load switch for controlling power to components - -## Usage Examples -Add usage examples here - -### Diagrams -Add diagrams here - -### Typical Usage -The load switch would be used whenever a sensor is to be turned on or off. - -## Class Diagram -Add a class diagram here - -## Port Descriptions -| Name | Description | -|---|---| -| Status | Boolean value displaying whether the load switch is on or not. | - -## Component States -| Name | Description | -|-------|--------------------------------------| -| Off | No power to the component | -| On | Power supplied to the component | -| Error | An error occurred in the load switch | - -## Sequence Diagrams -Add sequence diagrams here - -## Parameters -| Name | Description | -|---|---| -|---|---| - -## Commands -| Name | Description | -|---|---| -| On | Turn on power to the component | -| Off | Turn off power to the component | - -## Events -| Name | Description | -|---|---| -| StatusChanged | Emits event whenever the status of the load switch changes | - -## Telemetry -| Name | Description | -|---|---| -| IsOn | Returns whether the load switch is supplying power to the component or not | - -## Unit Tests -| Name | Description | Output | Coverage | -|---|---|---|---| -|---|---|---|---| - -## Requirements -| Name | Description | Validation | -|---|---|---| -|---|---|---| - -## Change Log -| Date | Description | -|---|---| -| 10-22-2025 | Sarah, Kevin, and MoMata's first commit | From 2898d23543d4a1d75847e8ac3e50252068860d8d Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 26 Nov 2025 19:10:36 -0600 Subject: [PATCH 28/68] Reduce lines changed --- .../Components/Drv/CMakeLists.txt | 1 - .../Drv/MagnetorquerManager/CMakeLists.txt | 36 ---------- .../MagnetorquerManager.cpp | 65 ------------------ .../MagnetorquerManager.fpp | 59 ----------------- .../MagnetorquerManager.hpp | 48 -------------- .../Drv/MagnetorquerManager/docs/sdd.md | 66 ------------------- .../ReferenceDeployment/Main.cpp | 4 -- .../Top/ReferenceDeploymentTopology.cpp | 1 - .../Top/ReferenceDeploymentTopologyDefs.hpp | 28 ++++---- .../ReferenceDeployment/Top/topology.fpp | 1 + 10 files changed, 14 insertions(+), 295 deletions(-) delete mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt delete mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp delete mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp delete mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp delete mode 100644 FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md diff --git a/FprimeZephyrReference/Components/Drv/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/CMakeLists.txt index 28009305..d55d258b 100644 --- a/FprimeZephyrReference/Components/Drv/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/CMakeLists.txt @@ -4,4 +4,3 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RtcManager") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager/") diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt deleted file mode 100644 index 92da00df..00000000 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -#### -# F Prime CMakeLists.txt: -# -# SOURCES: list of source files (to be compiled) -# AUTOCODER_INPUTS: list of files to be passed to the autocoders -# DEPENDS: list of libraries that this module depends on -# -# More information in the F´ CMake API documentation: -# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ -# -#### - -# Module names are derived from the path from the nearest project/library/framework -# root when not specifically overridden by the developer. i.e. The module defined by -# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. - -register_fprime_library( - AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.fpp" - SOURCES - "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.cpp" -# DEPENDS -# MyPackage_MyOtherModule -) - -### Unit Tests ### -# register_fprime_ut( -# AUTOCODER_INPUTS -# "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.fpp" -# SOURCES -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/MagnetorquerManagerTestMain.cpp" -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/MagnetorquerManagerTester.cpp" -# DEPENDS -# STest # For rules-based testing -# UT_AUTO_HELPERS -# ) diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp deleted file mode 100644 index 971a1985..00000000 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// ====================================================================== -// \title MagnetorquerManager.cpp -// \author aychar -// \brief cpp file for MagnetorquerManager component implementation class -// ====================================================================== - -#include "FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp" - -#include -#include - -namespace Drv { - -// ---------------------------------------------------------------------- -// Component construction and destruction -// ---------------------------------------------------------------------- - -MagnetorquerManager ::MagnetorquerManager(const char* const compName) : MagnetorquerManagerComponentBase(compName) {} - -MagnetorquerManager ::~MagnetorquerManager() {} - -// ---------------------------------------------------------------------- -// Helper methods -// ---------------------------------------------------------------------- - -void MagnetorquerManager ::configure(const struct device* const devices[6]) { - for (int i = 0; i < 6; ++i) { - this->m_devices[i] = devices[i]; - } -} - -void MagnetorquerManager ::START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) { - // Validate face index (0..5) - if (faceIdx >= 6) { - this->log_WARNING_HI_DeviceNotReady(); - return; - } - - const struct device* dev = this->m_devices[faceIdx]; - if (!device_is_ready(dev)) { - this->log_WARNING_HI_DeviceNotReady(); - return; - } - - drv2605_haptic_config(dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&this->rom); -} - -void MagnetorquerManager ::START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) { - // Validate face index (0..5) - if (faceIdx >= 6) { - this->log_WARNING_HI_DeviceNotReady(); - return; - } - - const struct device* dev = this->m_devices[faceIdx]; - if (!device_is_ready(dev)) { - this->log_WARNING_HI_DeviceNotReady(); - return; - } - - struct drv2605_rom_data rom2 = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {50, 0, 0, 0, 0, 0, 0, 0}}; - drv2605_haptic_config(dev, DRV2605_HAPTICS_SOURCE_ROM, (union drv2605_config_data*)&rom2); -} - -} // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp deleted file mode 100644 index 222f9bb0..00000000 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.fpp +++ /dev/null @@ -1,59 +0,0 @@ -module Drv { - @ Component for F Prime FSW framework. - passive component MagnetorquerManager { - - @ Event for reporting DRV2605 not ready error - event DeviceNotReady() severity warning high format "DRV2605 device not ready" throttle 5 - - @ Start DRV2605 playback on a device with effect #47 on a specific face - @ faceIdx: index of the face to actuate (valid range: 0..5) - sync command START_PLAYBACK_TEST(faceIdx: U8) - - @ Start DRV2605 playback on a device with effect #50 on a specific face - @ faceIdx: index of the face to actuate (valid range: 0..5) - sync command START_PLAYBACK_TEST2(faceIdx: U8) - - # @ Example telemetry counter - # telemetry ExampleCounter: U64 - - # @ Example event - # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" - - # @ Example port: receiving calls from the rate group - # sync input port run: Svc.Sched - - # @ Example parameter - # param PARAMETER_NAME: U32 - - ############################################################################### - # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # - ############################################################################### - @ Port for requesting the current time - time get port timeCaller - - @ Port for sending command registrations - command reg port cmdRegOut - - @ Port for receiving commands - command recv port cmdIn - - @ Port for sending command responses - command resp port cmdResponseOut - - @ Port for sending textual representation of events - text event port logTextOut - - @ Port for sending events to downlink - event port logOut - - @ Port for sending telemetry channels to downlink - telemetry port tlmOut - - @ Port to return the value of a parameter - param get port prmGetOut - - @Port to set the value of a parameter - param set port prmSetOut - - } -} diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp deleted file mode 100644 index 2be93a64..00000000 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// ====================================================================== -// \title MagnetorquerManager.hpp -// \author aychar -// \brief hpp file for MagnetorquerManager component implementation class -// ====================================================================== - -#ifndef Drv_MagnetorquerManager_HPP -#define Drv_MagnetorquerManager_HPP - -#include "FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManagerComponentAc.hpp" -#include -#include -#include -#include - -namespace Drv { - -class MagnetorquerManager final : public MagnetorquerManagerComponentBase { - public: - // ---------------------------------------------------------------------- - // Component construction and destruction - // ---------------------------------------------------------------------- - - //! Construct MagnetorquerManager object - MagnetorquerManager(const char* const compName //!< The component name - ); - - //! Destroy MagnetorquerManager object - ~MagnetorquerManager(); - - //! Configure the DRV2605 device - // Accept an array of six pointers to const device objects. The pointers themselves are const - // to match callers that provide const device* const* types. - void configure(const struct device* const devices[6]); - - private: - //! Zephyr device to store initialized DRV2605 - const struct device* m_devices[6]; - struct drv2605_rom_data rom = {.library = DRV2605_LIBRARY_TS2200_A, .seq_regs = {47, 0, 0, 0, 0, 0, 0, 0}}; - - // Command handlers updated to accept a face index (0..5) - void START_PLAYBACK_TEST_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) override; - void START_PLAYBACK_TEST2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U8 faceIdx) override; -}; - -} // namespace Drv - -#endif diff --git a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md b/FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md deleted file mode 100644 index b94fdaf3..00000000 --- a/FprimeZephyrReference/Components/Drv/MagnetorquerManager/docs/sdd.md +++ /dev/null @@ -1,66 +0,0 @@ -# Drv::MagnetorquerManager - -Component for F Prime FSW framework. - -## Usage Examples -Add usage examples here - -### Diagrams -Add diagrams here - -### Typical Usage -And the typical usage of the component here - -## Class Diagram -Add a class diagram here - -## Port Descriptions -| Name | Description | -|---|---| -|---|---| - -## Component States -Add component states in the chart below -| Name | Description | -|---|---| -|---|---| - -## Sequence Diagrams -Add sequence diagrams here - -## Parameters -| Name | Description | -|---|---| -|---|---| - -## Commands -| Name | Description | -|---|---| -|---|---| - -## Events -| Name | Description | -|---|---| -|---|---| - -## Telemetry -| Name | Description | -|---|---| -|---|---| - -## Unit Tests -Add unit test descriptions in the chart below -| Name | Description | Output | Coverage | -|---|---|---|---| -|---|---|---|---| - -## Requirements -Add requirements in the chart below -| Name | Description | Validation | -|---|---|---| -|---|---|---| - -## Change Log -| Date | Description | -|---|---| -|---| Initial Draft | diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 223d2472..0130fd31 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -7,7 +7,6 @@ #include -#include #include #include @@ -40,9 +39,6 @@ int main(int argc, char* argv[]) { k_sleep(K_MSEC(3000)); Os::init(); - // NOTE: Load switches are now powered on during early boot (SYS_INIT) - // before sensor initialization. See proves_board_power_init() above. - // Object for communicating state to the topology ReferenceDeployment::TopologyState inputs; inputs.ina219SysDevice = ina219Sys; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 1b6f161c..f54f2eda 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -12,7 +12,6 @@ #include #include -#include static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios); static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire0), gpios); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 7f8c23ed..d342eef1 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -24,7 +24,6 @@ // Include autocoded FPP constants #include "FprimeZephyrReference/ReferenceDeployment/Top/FppConstantsAc.hpp" #include -#include #include #include @@ -70,15 +69,19 @@ namespace ReferenceDeployment { * autocoder. The contents are entirely up to the definition of the project. This deployment uses subtopologies. */ struct TopologyState { - // FC devices - const device* ina219SysDevice; //!< device path for battery board ina219 - const device* ina219SolDevice; //!< device path for solar panel ina219 - const device* uartDevice; //!< UART device path for communication - const device* loraDevice; //!< LoRa device path for communication - const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope - const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer - const device* rtcDevice; //!< RTC device path - const device* mcp23017; //!< MCP23017 GPIO expander device path + const device* uartDevice; //!< UART device path for communication + const device* loraDevice; //!< LoRa device path for communication + + U32 baudRate; //!< Baud rate for UART communication + CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore + ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds + FileHandling::SubtopologyState fileHandling; //!< Subtopology state for FileHandling + const device* ina219SysDevice; //!< device path for battery board ina219 + const device* ina219SolDevice; //!< device path for solar panel ina219 + const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope + const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer + const device* rtcDevice; //!< RTC device path + const device* mcp23017; //!< MCP23017 GPIO expander device path // Face devices // - Temperature sensors @@ -93,11 +96,6 @@ struct TopologyState { const device* battCell2TempDevice; //!< TMP112 device for battery cell 2 const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 - - U32 baudRate; //!< Baud rate for UART communication - CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore - ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds - FileHandling::SubtopologyState fileHandling; //!< Subtopology state for FileHandling }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index f8d24569..43e76c52 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -283,5 +283,6 @@ module ReferenceDeployment { modeManager.loadSwitchTurnOff[6] -> payloadPowerLoadSwitch.turnOff modeManager.loadSwitchTurnOff[7] -> payloadBatteryLoadSwitch.turnOff } + } } From 058b6076a8a7997c6cef2597125ca02fb9ae55e6 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 26 Nov 2025 20:25:54 -0600 Subject: [PATCH 29/68] Building with Michael certified device tree --- .../ThermalManager/ThermalManager.cpp | 7 - .../ThermalManager/ThermalManager.fpp | 12 -- .../ReferenceDeployment/Main.cpp | 4 - .../Top/ReferenceDeploymentPackets.fppi | 4 - .../Top/ReferenceDeploymentTopology.cpp | 2 - .../Top/ReferenceDeploymentTopologyDefs.hpp | 2 - .../ReferenceDeployment/Top/instances.fpp | 14 +- .../ReferenceDeployment/Top/topology.fpp | 4 - .../proves_flight_control_board_v5.dtsi | 128 ++++++++++++------ 9 files changed, 92 insertions(+), 85 deletions(-) diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 8d38f6f7..64705c5f 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -37,16 +37,9 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { F64 face3Temp = this->face3TempGet_out(0); this->tlmWrite_Face3Temperature(face3Temp); - F64 face4Temp = this->face4TempGet_out(0); - this->tlmWrite_Face4Temperature(face4Temp); - F64 face5Temp = this->face5TempGet_out(0); this->tlmWrite_Face5Temperature(face5Temp); - // Top sensor - F64 topTemp = this->topTempGet_out(0); - this->tlmWrite_TopTemperature(topTemp); - // Battery cell sensors (4 sensors) F64 battCell1Temp = this->battCell1TempGet_out(0); this->tlmWrite_BattCell1Temperature(battCell1Temp); diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index b2fae677..70473096 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -17,15 +17,9 @@ module Components { @ Port for face 3 temperature sensor output port face3TempGet: Drv.AmbientTemperatureGet - @ Port for face 4 temperature sensor - output port face4TempGet: Drv.AmbientTemperatureGet - @ Port for face 5 temperature sensor output port face5TempGet: Drv.AmbientTemperatureGet - @ Port for top temperature sensor - output port topTempGet: Drv.AmbientTemperatureGet - @ Port for battery cell 1 temperature sensor output port battCell1TempGet: Drv.AmbientTemperatureGet @@ -53,15 +47,9 @@ module Components { @ Face 3 temperature in degrees Celsius telemetry Face3Temperature: F64 - @ Face 4 temperature in degrees Celsius - telemetry Face4Temperature: F64 - @ Face 5 temperature in degrees Celsius telemetry Face5Temperature: F64 - @ Top temperature in degrees Celsius - telemetry TopTemperature: F64 - @ Battery cell 1 temperature in degrees Celsius telemetry BattCell1Temperature: F64 diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 0130fd31..644f602c 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -23,9 +23,7 @@ const struct device* face0_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sen const struct device* face1_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); const struct device* face2_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face2_temp_sens)); const struct device* face3_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face3_temp_sens)); -const struct device* face4_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face4_temp_sens)); const struct device* face5_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face5_temp_sens)); -const struct device* top_temp_sens = DEVICE_DT_GET(DT_NODELABEL(top_temp_sens)); const struct device* batt_cell1_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell1_temp_sens)); const struct device* batt_cell2_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell2_temp_sens)); const struct device* batt_cell3_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell3_temp_sens)); @@ -56,9 +54,7 @@ int main(int argc, char* argv[]) { inputs.face1TempDevice = face1_temp_sens; inputs.face2TempDevice = face2_temp_sens; inputs.face3TempDevice = face3_temp_sens; - inputs.face4TempDevice = face4_temp_sens; inputs.face5TempDevice = face5_temp_sens; - inputs.topTempDevice = top_temp_sens; inputs.battCell1TempDevice = batt_cell1_temp_sens; inputs.battCell2TempDevice = batt_cell2_temp_sens; inputs.battCell3TempDevice = batt_cell3_temp_sens; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 529b0a9a..5fb5ecaf 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -99,9 +99,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.thermalManager.Face1Temperature ReferenceDeployment.thermalManager.Face2Temperature ReferenceDeployment.thermalManager.Face3Temperature - ReferenceDeployment.thermalManager.Face4Temperature ReferenceDeployment.thermalManager.Face5Temperature - ReferenceDeployment.thermalManager.TopTemperature ReferenceDeployment.thermalManager.BattCell1Temperature ReferenceDeployment.thermalManager.BattCell2Temperature ReferenceDeployment.thermalManager.BattCell3Temperature @@ -115,9 +113,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112Face1Manager.AmbientTemperature ReferenceDeployment.tmp112Face2Manager.AmbientTemperature ReferenceDeployment.tmp112Face3Manager.AmbientTemperature - ReferenceDeployment.tmp112Face4Manager.AmbientTemperature ReferenceDeployment.tmp112Face5Manager.AmbientTemperature - ReferenceDeployment.tmp112TopManager.AmbientTemperature ReferenceDeployment.tmp112BattCell1Manager.AmbientTemperature ReferenceDeployment.tmp112BattCell2Manager.AmbientTemperature ReferenceDeployment.tmp112BattCell3Manager.AmbientTemperature diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index f54f2eda..0fbac5dd 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -124,9 +124,7 @@ void setupTopology(const TopologyState& state) { tmp112Face1Manager.configure(state.face1TempDevice); tmp112Face2Manager.configure(state.face2TempDevice); tmp112Face3Manager.configure(state.face3TempDevice); - tmp112Face4Manager.configure(state.face4TempDevice); tmp112Face5Manager.configure(state.face5TempDevice); - tmp112TopManager.configure(state.topTempDevice); tmp112BattCell1Manager.configure(state.battCell1TempDevice); tmp112BattCell2Manager.configure(state.battCell2TempDevice); tmp112BattCell3Manager.configure(state.battCell3TempDevice); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index d342eef1..38546486 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -89,9 +89,7 @@ struct TopologyState { const device* face1TempDevice; //!< TMP112 device for cube face 1 const device* face2TempDevice; //!< TMP112 device for cube face 2 const device* face3TempDevice; //!< TMP112 device for cube face 3 - const device* face4TempDevice; //!< TMP112 device for cube face 4 const device* face5TempDevice; //!< TMP112 device for cube face 5 - const device* topTempDevice; //!< TMP112 device for cube top const device* battCell1TempDevice; //!< TMP112 device for battery cell 1 const device* battCell2TempDevice; //!< TMP112 device for battery cell 2 const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index da37b33b..e1bf3065 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -152,18 +152,14 @@ module ReferenceDeployment { instance tmp112Face3Manager: Drv.TMP112Manager base id 0x10045000 - instance tmp112Face4Manager: Drv.TMP112Manager base id 0x10046000 + instance tmp112Face5Manager: Drv.TMP112Manager base id 0x10046000 - instance tmp112Face5Manager: Drv.TMP112Manager base id 0x10047000 + instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x10047000 - instance tmp112TopManager: Drv.TMP112Manager base id 0x10048000 + instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x10048000 - instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x10049000 + instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x10049000 - instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x1004A000 - - instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x1004B000 - - instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x1004C000 + instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x1004A000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 43e76c52..873b3d0c 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -71,9 +71,7 @@ module ReferenceDeployment { instance tmp112Face1Manager instance tmp112Face2Manager instance tmp112Face3Manager - instance tmp112Face4Manager instance tmp112Face5Manager - instance tmp112TopManager instance tmp112BattCell1Manager instance tmp112BattCell2Manager instance tmp112BattCell3Manager @@ -247,9 +245,7 @@ module ReferenceDeployment { thermalManager.face1TempGet -> tmp112Face1Manager.ambientTemperatureGet thermalManager.face2TempGet -> tmp112Face2Manager.ambientTemperatureGet thermalManager.face3TempGet -> tmp112Face3Manager.ambientTemperatureGet - thermalManager.face4TempGet -> tmp112Face4Manager.ambientTemperatureGet thermalManager.face5TempGet -> tmp112Face5Manager.ambientTemperatureGet - thermalManager.topTempGet -> tmp112TopManager.ambientTemperatureGet thermalManager.battCell1TempGet -> tmp112BattCell1Manager.ambientTemperatureGet thermalManager.battCell2TempGet -> tmp112BattCell2Manager.ambientTemperatureGet thermalManager.battCell3TempGet -> tmp112BattCell3Manager.ambientTemperatureGet diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 7ed83a58..d8d39c61 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -146,16 +146,27 @@ zephyr_udc0: &usbd { label = "TCA9548A"; reset-gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; - i2c_mux@0 { + mux_channel_0: i2c_mux@0 { compatible = "ti,tca9548a-channel"; - label = "face0_i2c"; + label = "mux_channel_0"; reg = <0>; #address-cells = <1>; #size-cells = <0>; + face0_temp_sens: tmp112@48 { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + label = "FACE0_TMP112"; + zephyr,deferred-init; + }; + + face0_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; + status = "okay"; + label = "FACE0_VEML6031"; + zephyr,deferred-init; }; face0_drv2605: drv2605@5a { @@ -163,23 +174,36 @@ zephyr_udc0: &usbd { status = "okay"; reg = <0x5a>; label = "FACE0_DRV2605"; + zephyr,deferred-init; actuator-mode = "LRA"; loop-gain = "HIGH"; feedback-brake-factor = "2X"; }; + }; - i2c_mux@1 { + mux_channel_1: i2c_mux@1 { compatible = "ti,tca9548a-channel"; - label = "face1_i2c"; + label = "mux_channel_1"; reg = <1>; #address-cells = <1>; #size-cells = <0>; + face1_temp_sens: tmp112@48 { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + label = "FACE1_TMP112"; + zephyr,deferred-init; + }; + + face1_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; + status = "okay"; + label = "FACE1_VEML6031"; + zephyr,deferred-init; }; face1_drv2605: drv2605@5a { @@ -187,23 +211,36 @@ zephyr_udc0: &usbd { status = "okay"; reg = <0x5a>; label = "FACE1_DRV2605"; + zephyr,deferred-init; actuator-mode = "LRA"; loop-gain = "HIGH"; feedback-brake-factor = "2X"; }; + }; - i2c_mux@2 { + mux_channel_2: i2c_mux@2 { compatible = "ti,tca9548a-channel"; - label = "face2_i2c"; + label = "mux_channel_2"; reg = <2>; #address-cells = <1>; #size-cells = <0>; + face2_temp_sens: tmp112@48 { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + label = "FACE2_TMP112"; + zephyr,deferred-init; + }; + + face2_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; + status = "okay"; + label = "FACE2_VEML6031"; + zephyr,deferred-init; }; face2_drv2605: drv2605@5a { @@ -211,23 +248,36 @@ zephyr_udc0: &usbd { status = "okay"; reg = <0x5a>; label = "FACE2_DRV2605"; + zephyr,deferred-init; actuator-mode = "LRA"; loop-gain = "HIGH"; feedback-brake-factor = "2X"; }; + }; - i2c_mux@3 { + mux_channel_3: i2c_mux@3 { compatible = "ti,tca9548a-channel"; - label = "face3_i2c"; + label = "mux_channel_3"; reg = <3>; #address-cells = <1>; #size-cells = <0>; + face3_temp_sens: tmp112@48 { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + label = "FACE3_TMP112"; + zephyr,deferred-init; + }; + + face3_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; + status = "okay"; + label = "FACE3_VEML6031"; + zephyr,deferred-init; }; face3_drv2605: drv2605@5a { @@ -235,17 +285,20 @@ zephyr_udc0: &usbd { status = "okay"; reg = <0x5a>; label = "FACE3_DRV2605"; + zephyr,deferred-init; actuator-mode = "LRA"; loop-gain = "HIGH"; feedback-brake-factor = "2X"; }; + }; - i2c_mux@4 { + // Battery + mux_channel_4: i2c_mux@4 { compatible = "ti,tca9548a-channel"; - label = "battery_i2c"; - reg = <4>; + label = "mux_channel_4"; + reg = <7>; #address-cells = <1>; #size-cells = <0>; batt_cell1_temp_sens: tmp112@48 { @@ -270,40 +323,28 @@ zephyr_udc0: &usbd { }; }; - i2c_mux@5 { + // Z- Face + mux_channel_5: i2c_mux@5 { compatible = "ti,tca9548a-channel"; - label = "face4_i2c"; - reg = <5>; + label = "mux_channel_5"; + reg = <4>; #address-cells = <1>; #size-cells = <0>; - face4_temp_sens: tmp112@48 { + + face5_temp_sens: tmp112@48 { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + label = "FACE5_TMP112"; + zephyr,deferred-init; }; - face4_drv2605: drv2605@5a { - compatible = "ti,drv2605"; - status = "okay"; - reg = <0x5a>; - label = "FACE4_DRV2605"; - - actuator-mode = "LRA"; - loop-gain = "HIGH"; - feedback-brake-factor = "2X"; - }; - }; - - i2c_mux@6 { - compatible = "ti,tca9548a-channel"; - label = "face5_i2c"; - reg = <6>; - #address-cells = <1>; - #size-cells = <0>; - face5_temp_sens: tmp112@48 { - compatible = "ti,tmp112"; - reg = <0x48>; + face5_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; status = "okay"; + label = "FACE5_VEML6031"; + zephyr,deferred-init; }; face5_drv2605: drv2605@5a { @@ -311,23 +352,28 @@ zephyr_udc0: &usbd { status = "okay"; reg = <0x5a>; label = "FACE5_DRV2605"; + zephyr,deferred-init; actuator-mode = "LRA"; loop-gain = "HIGH"; feedback-brake-factor = "2X"; }; + }; - i2c_mux@7 { + // Top is always powered so no deferred init needed + mux_channel_7: i2c_mux@7 { compatible = "ti,tca9548a-channel"; - label = "top_i2c"; + label = "mux_channel_7"; reg = <7>; #address-cells = <1>; #size-cells = <0>; - top_temp_sens: tmp112@48 { - compatible = "ti,tmp112"; - reg = <0x48>; + // TODO add top cap temp sensor (it's not a TMP112) + face7_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; status = "okay"; + label = "FACE7_VEML6031"; }; }; }; From 47ef8b6b07194da86aebdc10e72fc3b45a0b8c3c Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 26 Nov 2025 21:52:22 -0600 Subject: [PATCH 30/68] Return success conditions and attempt init every time --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 17 ++++- .../Drv/Tmp112Manager/TMP112Manager.fpp | 16 ++-- .../Drv/Tmp112Manager/TMP112Manager.hpp | 15 +++- .../ThermalManager/ThermalManager.cpp | 74 +++++++++++------- .../ThermalManager/ThermalManager.fpp | 75 +++++++++---------- .../Top/ReferenceDeploymentPackets.fppi | 28 +++---- .../ReferenceDeployment/Top/topology.fpp | 35 ++++++--- 7 files changed, 154 insertions(+), 106 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index a1de6596..545e6435 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -31,7 +31,20 @@ void TMP112Manager::configure(const struct device* dev) { // Handler implementations for typed input ports // ---------------------------------------------------------------------- -F64 TMP112Manager ::ambientTemperatureGet_handler(FwIndexType portNum) { +void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { + int ret = device_init(this->m_dev); + if (ret != 0 && ret != -EALREADY) { + // Emit an error? or ignore because face is off? Talk to load manager to see if face is on before erroring? + this->log_WARNING_HI_DeviceInitFailed(ret); + condition = Fw::Success::FAILURE; + return; + } + + this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + condition = Fw::Success::SUCCESS; +} + +F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", this->m_dev->name, this->m_dev); @@ -55,7 +68,7 @@ F64 TMP112Manager ::ambientTemperatureGet_handler(FwIndexType portNum) { return 0; } - this->tlmWrite_AmbientTemperature(sensor_value_to_double(&temp)); + this->tlmWrite_Temperature(sensor_value_to_double(&temp)); return sensor_value_to_double(&temp); } diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index 4eac8887..a4b7da31 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -1,22 +1,28 @@ module Drv { - port AmbientTemperatureGet -> F64 + port temperatureGet -> F64 } module Drv { @ Manager for TMP112 device passive component TMP112Manager { # Ports - @ Port to read the ambient temperature in degrees Celsius - sync input port ambientTemperatureGet: AmbientTemperatureGet + @ Port to initialize the TMP112 device + sync input port init: Fw.SuccessCondition + + @ Port to read the temperature in degrees Celsius + sync input port temperatureGet: temperatureGet # Telemetry channels - @ Telemetry channel for ambient temperature in degrees Celsius - telemetry AmbientTemperature: F64 + @ Telemetry channel for temperature in degrees Celsius + telemetry Temperature: F64 @ Event for reporting TMP112 not ready error event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 + @ Event for reporting TMP112 initialization failure + event DeviceInitFailed(ret: U8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 + ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # ############################################################################### diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index 8721762a..5c373850 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -38,11 +38,18 @@ class TMP112Manager final : public TMP112ManagerComponentBase { // Handler implementations for typed input ports // ---------------------------------------------------------------------- - //! Handler implementation for ambientTemperatureGet + //! Handler implementation for init //! - //! Port to read the ambient temperature in degrees Celsius - F64 ambientTemperatureGet_handler(FwIndexType portNum //!< The port number - ) override; + //! Port to initialize the TMP112 device + void init_handler(FwIndexType portNum, //!< The port number + Fw::Success& condition //!< Condition success/failure + ) override; + + //! Handler implementation for temperatureGet + //! + //! Port to read the temperature in degrees Celsius + F64 temperatureGet_handler(FwIndexType portNum //!< The port number + ) override; // ---------------------------------------------------------------------- // Member variables diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 64705c5f..5d574bc8 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -22,36 +22,54 @@ ThermalManager::~ThermalManager() {} // ---------------------------------------------------------------------- void ThermalManager::run_handler(FwIndexType portNum, U32 context) { - // Read all 11 temperature sensors and write telemetry - - // Cube face sensors (6 sensors) - F64 face0Temp = this->face0TempGet_out(0); - this->tlmWrite_Face0Temperature(face0Temp); - - F64 face1Temp = this->face1TempGet_out(0); - this->tlmWrite_Face1Temperature(face1Temp); - - F64 face2Temp = this->face2TempGet_out(0); - this->tlmWrite_Face2Temperature(face2Temp); - - F64 face3Temp = this->face3TempGet_out(0); - this->tlmWrite_Face3Temperature(face3Temp); - - F64 face5Temp = this->face5TempGet_out(0); - this->tlmWrite_Face5Temperature(face5Temp); + // Cube face sensors (5 sensors) + Fw::Success condition; + + this->face0Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face0TempGet_out(0); + } + + this->face1Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face1TempGet_out(0); + } + + this->face2Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face2TempGet_out(0); + } + + this->face3Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face3TempGet_out(0); + } + + this->face5Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face5TempGet_out(0); + } // Battery cell sensors (4 sensors) - F64 battCell1Temp = this->battCell1TempGet_out(0); - this->tlmWrite_BattCell1Temperature(battCell1Temp); - - F64 battCell2Temp = this->battCell2TempGet_out(0); - this->tlmWrite_BattCell2Temperature(battCell2Temp); - - F64 battCell3Temp = this->battCell3TempGet_out(0); - this->tlmWrite_BattCell3Temperature(battCell3Temp); - - F64 battCell4Temp = this->battCell4TempGet_out(0); - this->tlmWrite_BattCell4Temperature(battCell4Temp); + this->battCell1Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->battCell1TempGet_out(0); + } + + this->battCell2Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->battCell2TempGet_out(0); + } + + this->battCell3Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->battCell3TempGet_out(0); + } + + this->battCell4Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->battCell4TempGet_out(0); + } } } // namespace Components diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 70473096..aac090a1 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -5,62 +5,59 @@ module Components { sync input port run: Svc.Sched # Output ports to TMP112Manager instances + @ Port for face 0 temperature sensor initialization + output port face0Init: Fw.SuccessCondition + @ Port for face 0 temperature sensor - output port face0TempGet: Drv.AmbientTemperatureGet + output port face0TempGet: Drv.temperatureGet - @ Port for face 1 temperature sensor - output port face1TempGet: Drv.AmbientTemperatureGet + @ Port for face 1 temperature sensor initialization + output port face1Init: Fw.SuccessCondition - @ Port for face 2 temperature sensor - output port face2TempGet: Drv.AmbientTemperatureGet - - @ Port for face 3 temperature sensor - output port face3TempGet: Drv.AmbientTemperatureGet + @ Port for face 1 temperature sensor + output port face1TempGet: Drv.temperatureGet - @ Port for face 5 temperature sensor - output port face5TempGet: Drv.AmbientTemperatureGet + @ Port for face 2 temperature sensor initialization + output port face2Init: Fw.SuccessCondition - @ Port for battery cell 1 temperature sensor - output port battCell1TempGet: Drv.AmbientTemperatureGet + @ Port for face 2 temperature sensor + output port face2TempGet: Drv.temperatureGet - @ Port for battery cell 2 temperature sensor - output port battCell2TempGet: Drv.AmbientTemperatureGet + @ Port for face 3 temperature sensor initialization + output port face3Init: Fw.SuccessCondition - @ Port for battery cell 3 temperature sensor - output port battCell3TempGet: Drv.AmbientTemperatureGet + @ Port for face 3 temperature sensor + output port face3TempGet: Drv.temperatureGet - @ Port for battery cell 4 temperature sensor - output port battCell4TempGet: Drv.AmbientTemperatureGet + @ Port for face 5 temperature sensor initialization + output port face5Init: Fw.SuccessCondition - ############################################################################### - # Telemetry Channels # - ############################################################################### - @ Face 0 temperature in degrees Celsius - telemetry Face0Temperature: F64 + @ Port for face 5 temperature sensor + output port face5TempGet: Drv.temperatureGet - @ Face 1 temperature in degrees Celsius - telemetry Face1Temperature: F64 + @ Port for battery cell 1 temperature sensor initialization + output port battCell1Init: Fw.SuccessCondition - @ Face 2 temperature in degrees Celsius - telemetry Face2Temperature: F64 + @ Port for battery cell 1 temperature sensor + output port battCell1TempGet: Drv.temperatureGet - @ Face 3 temperature in degrees Celsius - telemetry Face3Temperature: F64 + @ Port for battery cell 2 temperature sensor initialization + output port battCell2Init: Fw.SuccessCondition - @ Face 5 temperature in degrees Celsius - telemetry Face5Temperature: F64 + @ Port for battery cell 2 temperature sensor + output port battCell2TempGet: Drv.temperatureGet - @ Battery cell 1 temperature in degrees Celsius - telemetry BattCell1Temperature: F64 + @ Port for battery cell 3 temperature sensor initialization + output port battCell3Init: Fw.SuccessCondition - @ Battery cell 2 temperature in degrees Celsius - telemetry BattCell2Temperature: F64 + @ Port for battery cell 3 temperature sensor + output port battCell3TempGet: Drv.temperatureGet - @ Battery cell 3 temperature in degrees Celsius - telemetry BattCell3Temperature: F64 + @ Port for battery cell 4 temperature sensor initialization + output port battCell4Init: Fw.SuccessCondition - @ Battery cell 4 temperature in degrees Celsius - telemetry BattCell4Temperature: F64 + @ Port for battery cell 4 temperature sensor + output port battCell4TempGet: Drv.temperatureGet ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 5fb5ecaf..70f11255 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -95,29 +95,19 @@ telemetry packets ReferenceDeploymentPackets { } packet Thermal id 12 group 4 { - ReferenceDeployment.thermalManager.Face0Temperature - ReferenceDeployment.thermalManager.Face1Temperature - ReferenceDeployment.thermalManager.Face2Temperature - ReferenceDeployment.thermalManager.Face3Temperature - ReferenceDeployment.thermalManager.Face5Temperature - ReferenceDeployment.thermalManager.BattCell1Temperature - ReferenceDeployment.thermalManager.BattCell2Temperature - ReferenceDeployment.thermalManager.BattCell3Temperature - ReferenceDeployment.thermalManager.BattCell4Temperature + ReferenceDeployment.tmp112Face0Manager.Temperature + ReferenceDeployment.tmp112Face1Manager.Temperature + ReferenceDeployment.tmp112Face2Manager.Temperature + ReferenceDeployment.tmp112Face3Manager.Temperature + ReferenceDeployment.tmp112Face5Manager.Temperature + ReferenceDeployment.tmp112BattCell1Manager.Temperature + ReferenceDeployment.tmp112BattCell2Manager.Temperature + ReferenceDeployment.tmp112BattCell3Manager.Temperature + ReferenceDeployment.tmp112BattCell4Manager.Temperature } } omit { CdhCore.cmdDisp.CommandErrors - # TMP112Manager channels are aggregated through ThermalManager - ReferenceDeployment.tmp112Face0Manager.AmbientTemperature - ReferenceDeployment.tmp112Face1Manager.AmbientTemperature - ReferenceDeployment.tmp112Face2Manager.AmbientTemperature - ReferenceDeployment.tmp112Face3Manager.AmbientTemperature - ReferenceDeployment.tmp112Face5Manager.AmbientTemperature - ReferenceDeployment.tmp112BattCell1Manager.AmbientTemperature - ReferenceDeployment.tmp112BattCell2Manager.AmbientTemperature - ReferenceDeployment.tmp112BattCell3Manager.AmbientTemperature - ReferenceDeployment.tmp112BattCell4Manager.AmbientTemperature # Only has one library, no custom versions CdhCore.version.LibraryVersion02 CdhCore.version.LibraryVersion03 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 873b3d0c..d3b24051 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -241,15 +241,32 @@ module ReferenceDeployment { } connections thermalMonitor { - thermalManager.face0TempGet -> tmp112Face0Manager.ambientTemperatureGet - thermalManager.face1TempGet -> tmp112Face1Manager.ambientTemperatureGet - thermalManager.face2TempGet -> tmp112Face2Manager.ambientTemperatureGet - thermalManager.face3TempGet -> tmp112Face3Manager.ambientTemperatureGet - thermalManager.face5TempGet -> tmp112Face5Manager.ambientTemperatureGet - thermalManager.battCell1TempGet -> tmp112BattCell1Manager.ambientTemperatureGet - thermalManager.battCell2TempGet -> tmp112BattCell2Manager.ambientTemperatureGet - thermalManager.battCell3TempGet -> tmp112BattCell3Manager.ambientTemperatureGet - thermalManager.battCell4TempGet -> tmp112BattCell4Manager.ambientTemperatureGet + thermalManager.face0Init -> tmp112Face0Manager.init + thermalManager.face0TempGet -> tmp112Face0Manager.temperatureGet + + thermalManager.face1Init -> tmp112Face1Manager.init + thermalManager.face1TempGet -> tmp112Face1Manager.temperatureGet + + thermalManager.face2Init -> tmp112Face2Manager.init + thermalManager.face2TempGet -> tmp112Face2Manager.temperatureGet + + thermalManager.face3Init -> tmp112Face3Manager.init + thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet + + thermalManager.face5Init -> tmp112Face5Manager.init + thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet + + thermalManager.battCell1Init -> tmp112BattCell1Manager.init + thermalManager.battCell1TempGet -> tmp112BattCell1Manager.temperatureGet + + thermalManager.battCell2Init -> tmp112BattCell2Manager.init + thermalManager.battCell2TempGet -> tmp112BattCell2Manager.temperatureGet + + thermalManager.battCell3Init -> tmp112BattCell3Manager.init + thermalManager.battCell3TempGet -> tmp112BattCell3Manager.temperatureGet + + thermalManager.battCell4Init -> tmp112BattCell4Manager.init + thermalManager.battCell4TempGet -> tmp112BattCell4Manager.temperatureGet } connections ModeManager { From 6cf3048df6f0fa398ea2b7d8579f20f645197e36 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Thu, 27 Nov 2025 23:53:15 -0600 Subject: [PATCH 31/68] GenericDeviceMonitor for tca and mux channels --- .../Components/CMakeLists.txt | 1 + .../Drv/Tmp112Manager/TMP112Manager.cpp | 20 +++++- .../Drv/Tmp112Manager/TMP112Manager.fpp | 12 +++- .../GenericDeviceMonitor/CMakeLists.txt | 36 ++++++++++ .../GenericDeviceMonitor.cpp | 45 +++++++++++++ .../GenericDeviceMonitor.fpp | 38 +++++++++++ .../GenericDeviceMonitor.hpp | 65 ++++++++++++++++++ .../GenericDeviceMonitor/docs/sdd.md | 66 +++++++++++++++++++ .../Components/LoadSwitch/LoadSwitch.cpp | 6 ++ .../Components/LoadSwitch/LoadSwitch.fpp | 36 ++++------ .../Components/LoadSwitch/LoadSwitch.hpp | 6 ++ .../ThermalManager/ThermalManager.cpp | 40 ++++++----- .../ThermalManager/ThermalManager.fpp | 15 +++++ .../ReferenceDeployment/Main.cpp | 41 ++++++------ .../Top/ReferenceDeploymentPackets.fppi | 13 +++- .../Top/ReferenceDeploymentTopology.cpp | 8 +++ .../Top/ReferenceDeploymentTopologyDefs.hpp | 9 ++- .../ReferenceDeployment/Top/instances.fpp | 36 +++++++--- .../ReferenceDeployment/Top/topology.fpp | 40 ++++++++++- .../project/config/AcConstants.fpp | 2 +- prj.conf | 1 + 21 files changed, 459 insertions(+), 77 deletions(-) create mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp create mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp create mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp create mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index 57a704f8..face4e63 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -8,6 +8,7 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComDelay/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Drv/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FsSpace/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ModeManager/") diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 545e6435..620d2fa8 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -33,14 +33,28 @@ void TMP112Manager::configure(const struct device* dev) { void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { int ret = device_init(this->m_dev); - if (ret != 0 && ret != -EALREADY) { + // do i need to start the mux first? + // if (ret != 0 && ret != -EALREADY) { + // if (ret == -EALREADY) { + // // Device already initialized - treat as success + // this->log_WARNING_HI_DeviceAlreadyInitialized(); + // return; + // } + if (ret != 0) { // Emit an error? or ignore because face is off? Talk to load manager to see if face is on before erroring? this->log_WARNING_HI_DeviceInitFailed(ret); condition = Fw::Success::FAILURE; + + // Even after a failure to init, the device will stay in an initialized state + // so we need to deinit to allow future init attempts + int deinit_ret = device_deinit(this->m_dev); // TODO: Check output? + if (deinit_ret != 0) { + this->log_WARNING_HI_DeviceDeinitFailed(deinit_ret); + } return; } - this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + // this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); condition = Fw::Success::SUCCESS; } @@ -50,7 +64,7 @@ F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", this->m_dev->name, this->m_dev); return 0; } - this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); + // this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); struct sensor_value temp; diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index a4b7da31..1f592adf 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -18,10 +18,18 @@ module Drv { telemetry Temperature: F64 @ Event for reporting TMP112 not ready error - event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 + event DeviceNotReady() severity warning high format "TMP112 device not ready" + # event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 @ Event for reporting TMP112 initialization failure - event DeviceInitFailed(ret: U8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 + event DeviceInitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" + # event DeviceInitFailed(ret: U8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 + + @ Event for reporting TMP112 deinitialization failure + event DeviceDeinitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" + + # TODO: REMOVE ME + # event DeviceAlreadyInitialized() severity warning high format "TMP112 device already initialized" ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt b/FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt new file mode 100644 index 00000000..731a72e3 --- /dev/null +++ b/FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/GenericDeviceMonitorTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/GenericDeviceMonitorTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp new file mode 100644 index 00000000..17bca66e --- /dev/null +++ b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp @@ -0,0 +1,45 @@ +// ====================================================================== +// \title GenericDeviceMonitor.cpp +// \author nate +// \brief cpp file for GenericDeviceMonitor component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp" + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +GenericDeviceMonitor ::GenericDeviceMonitor(const char* const compName) : GenericDeviceMonitorComponentBase(compName) {} + +GenericDeviceMonitor ::~GenericDeviceMonitor() {} + +// ---------------------------------------------------------------------- +// Helper methods +// ---------------------------------------------------------------------- + +void GenericDeviceMonitor::configure(const struct device* dev) { + this->m_dev = dev; +} + +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +Fw::Health GenericDeviceMonitor ::healthGet_handler(FwIndexType portNum) { + return device_is_ready(this->m_dev) ? Fw::Health::HEALTHY : Fw::Health::FAILED; +} + +void GenericDeviceMonitor ::run_handler(FwIndexType portNum, U32 context) { + if (!device_is_ready(this->m_dev)) { + this->tlmWrite_Healthy(Fw::Health::FAILED); + this->log_WARNING_LO_DeviceNotReady(); + return; + } + + this->tlmWrite_Healthy(Fw::Health::HEALTHY); +} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp new file mode 100644 index 00000000..e5da4abc --- /dev/null +++ b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp @@ -0,0 +1,38 @@ +module Components { + port HealthGet -> Fw.Health +} + +module Components { + @ Generic Device Health Reporter + @ Use for devices which only need to report simple health status and have no interactivity + passive component GenericDeviceMonitor { + + @ Port receiving calls from the rate group + sync input port run: Svc.Sched + + @ Port receiving calls to request device health + sync input port healthGet: HealthGet + + @ Telemetry showing device health + telemetry Healthy: Fw.Health + + @ Event indicating device not ready + event DeviceNotReady() severity warning low id 0 format "Device not ready" throttle 5 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + } +} diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp new file mode 100644 index 00000000..ea0d741f --- /dev/null +++ b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp @@ -0,0 +1,65 @@ +// ====================================================================== +// \title GenericDeviceMonitor.hpp +// \author nate +// \brief hpp file for GenericDeviceMonitor component implementation class +// ====================================================================== + +#ifndef Components_GenericDeviceMonitor_HPP +#define Components_GenericDeviceMonitor_HPP + +#include "FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitorComponentAc.hpp" +#include + +namespace Components { + +class GenericDeviceMonitor final : public GenericDeviceMonitorComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct GenericDeviceMonitor object + GenericDeviceMonitor(const char* const compName //!< The component name + ); + + //! Destroy GenericDeviceMonitor object + ~GenericDeviceMonitor(); + + public: + // ---------------------------------------------------------------------- + // Public helper methods + // ---------------------------------------------------------------------- + + //! Configure the zephyr mux channel device + void configure(const struct device* dev); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for healthGet + //! + //! Port receiving calls to request device health + Fw::Health healthGet_handler(FwIndexType portNum //!< The port number + ) override; + + //! Handler implementation for run + //! + //! Port receiving calls from the rate group + void run_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; + + private: + // ---------------------------------------------------------------------- + // Private member variables + // ---------------------------------------------------------------------- + + //! Zephyr device stores the initialized mux channel + const struct device* m_dev; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md b/FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md new file mode 100644 index 00000000..fb0ea3d4 --- /dev/null +++ b/FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md @@ -0,0 +1,66 @@ +# Components::GenericDeviceMonitor + +Mux Channel Health Reporter + +## Usage Examples +Add usage examples here + +### Diagrams +Add diagrams here + +### Typical Usage +And the typical usage of the component here + +## Class Diagram +Add a class diagram here + +## Port Descriptions +| Name | Description | +|---|---| +|---|---| + +## Component States +Add component states in the chart below +| Name | Description | +|---|---| +|---|---| + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|---|---| +|---|---| + +## Commands +| Name | Description | +|---|---| +|---|---| + +## Events +| Name | Description | +|---|---| +|---|---| + +## Telemetry +| Name | Description | +|---|---| +|---|---| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|---|---|---| +|---|---|---| + +## Change Log +| Date | Description | +|---|---| +|---| Initial Draft | diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 002d8b6e..e86e4fba 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -28,6 +28,12 @@ void LoadSwitch ::Reset_handler(FwIndexType portNum) { this->setLoadSwitchState(Fw::On::ON); } +Fw::On LoadSwitch ::loadSwitchStateGet_handler(FwIndexType portNum) { + Fw::Logic state; + this->gpioGet_out(0, state); + return state ? Fw::On::ON : Fw::On::OFF; +} + void LoadSwitch ::turnOn_handler(FwIndexType portNum) { this->setLoadSwitchState(Fw::On::ON); } diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 33540ad0..7d0dedc8 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -1,38 +1,30 @@ +module Components { + port loadSwitchState -> Fw.On +} + module Components { @ A generic load switch for controlling power to components passive component LoadSwitch { - # One async command/port is required for active components - # This should be overridden by the developers with a useful command/port - - ############################################################################## - #### Uncomment the following examples to start customizing your component #### - ############################################################################## - - # @ Example async command - # async command COMMAND_NAME(param_name: U32) + @ Command to turn the load switch on sync command TURN_ON() + + @ Command to turn the load switch off sync command TURN_OFF() - # @ Example telemetry counter - # telemetry ExampleCounter: U64 + @ Telemetry channel for load switch state telemetry IsOn: Fw.On - # @ Example event - # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + @ Event for reporting load switch state change event StatusChanged($state: Fw.On) severity activity high id 1 format "Load switch state changed to {}" - # @ Example port: receiving calls from the rate group - # sync input port run: Svc.Sched - #output port Status: Drv.GpioRead - #We will not be putting a Drv.GpioRead port here, we are using the Gpio Driver component which has this already! - @ Port sending calls to the GPIO driver output port gpioSet: Drv.GpioWrite + @ Port sending calls to the GPIO driver to read state + output port gpioGet: Drv.GpioRead - # Input that will be used by other components if they want to force a reset - # (off and on again) of the load switch + @ Input port to reset the load switch (called by other components) sync input port Reset: Fw.Signal @ Input port to turn on the load switch (called by other components) @@ -41,8 +33,8 @@ module Components { @ Input port to turn off the load switch (called by other components) sync input port turnOff: Fw.Signal - # @ Example parameter - # param PARAMETER_NAME: U32 + @ Input port to get the state of the load switch (called by other components) + sync input port loadSwitchStateGet: loadSwitchState ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 7e2862e2..d24ddb10 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -51,6 +51,12 @@ class LoadSwitch final : public LoadSwitchComponentBase { void Reset_handler(FwIndexType portNum //!< The port number ) override; + //! Handler implementation for loadSwitchStateGet + //! + //! Input port to get the state of the load switch (called by other components) + Fw::On loadSwitchStateGet_handler(FwIndexType portNum //!< The port number + ) override; + //! Handler implementation for turnOn void turnOn_handler(FwIndexType portNum //!< The port number ) override; diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 5d574bc8..85f5d842 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -25,29 +25,39 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { // Cube face sensors (5 sensors) Fw::Success condition; - this->face0Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face0TempGet_out(0); + if (this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face0Init_out(0, condition); // If init fails, try deinit? + if (condition == Fw::Success::SUCCESS) { + this->face0TempGet_out(0); + } } - this->face1Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face1TempGet_out(0); + if (this->face1LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face1Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face1TempGet_out(0); + } } - this->face2Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face2TempGet_out(0); + if (this->face2LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face2Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face2TempGet_out(0); + } } - this->face3Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face3TempGet_out(0); + if (this->face3LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face3Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face3TempGet_out(0); + } } - this->face5Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face5TempGet_out(0); + if (this->face5LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face5Init_out(0, condition); + if (condition == Fw::Success::SUCCESS) { + this->face5TempGet_out(0); + } } // Battery cell sensors (4 sensors) diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index aac090a1..364d8ea5 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -5,30 +5,45 @@ module Components { sync input port run: Svc.Sched # Output ports to TMP112Manager instances + @ Port to return the state of the load switch for face 0 + output port face0LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 0 temperature sensor initialization output port face0Init: Fw.SuccessCondition @ Port for face 0 temperature sensor output port face0TempGet: Drv.temperatureGet + @ Port for face 1 load switch state + output port face1LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 1 temperature sensor initialization output port face1Init: Fw.SuccessCondition @ Port for face 1 temperature sensor output port face1TempGet: Drv.temperatureGet + @ Port for face 2 load switch state + output port face2LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 2 temperature sensor initialization output port face2Init: Fw.SuccessCondition @ Port for face 2 temperature sensor output port face2TempGet: Drv.temperatureGet + @ Port for face 3 load switch state + output port face3LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 3 temperature sensor initialization output port face3Init: Fw.SuccessCondition @ Port for face 3 temperature sensor output port face3TempGet: Drv.temperatureGet + @ Port for face 5 load switch state + output port face5LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 5 temperature sensor initialization output port face5Init: Fw.SuccessCondition diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 644f602c..6c93a555 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -18,7 +18,14 @@ const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0)); const struct device* lsm6dso = DEVICE_DT_GET(DT_NODELABEL(lsm6dso0)); const struct device* lis2mdl = DEVICE_DT_GET(DT_NODELABEL(lis2mdl0)); const struct device* rtc = DEVICE_DT_GET(DT_NODELABEL(rtc0)); -const struct device* mcp23017 = DEVICE_DT_GET(DT_NODELABEL(mcp23017)); +const struct device* tca9548a = DEVICE_DT_GET(DT_NODELABEL(tca9548a)); +const struct device* mux_channel_0 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_0)); +const struct device* mux_channel_1 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_1)); +const struct device* mux_channel_2 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_2)); +const struct device* mux_channel_3 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_3)); +const struct device* mux_channel_4 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_4)); +const struct device* mux_channel_5 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_5)); +const struct device* mux_channel_7 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_7)); const struct device* face0_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sens)); const struct device* face1_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); const struct device* face2_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face2_temp_sens)); @@ -39,6 +46,8 @@ int main(int argc, char* argv[]) { // Object for communicating state to the topology ReferenceDeployment::TopologyState inputs; + + // Flight Control Board device bindings inputs.ina219SysDevice = ina219Sys; inputs.ina219SolDevice = ina219Sol; inputs.loraDevice = lora; @@ -46,9 +55,16 @@ int main(int argc, char* argv[]) { inputs.lsm6dsoDevice = lsm6dso; inputs.lis2mdlDevice = lis2mdl; inputs.rtcDevice = rtc; - inputs.mcp23017 = mcp23017; - inputs.baudRate = 115200; + inputs.tca9548aDevice = tca9548a; + inputs.muxChannel0Device = mux_channel_0; + inputs.muxChannel1Device = mux_channel_1; + inputs.muxChannel2Device = mux_channel_2; + inputs.muxChannel3Device = mux_channel_3; + inputs.muxChannel4Device = mux_channel_4; + inputs.muxChannel5Device = mux_channel_5; + inputs.muxChannel7Device = mux_channel_7; + // Face Board device bindings // TMP112 temperature sensor devices inputs.face0TempDevice = face0_temp_sens; inputs.face1TempDevice = face1_temp_sens; @@ -60,24 +76,7 @@ int main(int argc, char* argv[]) { inputs.battCell3TempDevice = batt_cell3_temp_sens; inputs.battCell4TempDevice = batt_cell4_temp_sens; - // Diagnostic: Check which TMP112 sensors are ready - // printk("\n=== TMP112 Sensor Ready Status ===\n"); - // const struct device* sensors[] = { - // inputs.face0TempDevice, inputs.face1TempDevice, - // inputs.face2TempDevice, inputs.face3TempDevice, - // inputs.face4TempDevice, inputs.face5TempDevice, - // inputs.topTempDevice, - // inputs.battCell1TempDevice, inputs.battCell2TempDevice, - // inputs.battCell3TempDevice, inputs.battCell4TempDevice - // }; - // const char* names[] = {"face0", "face1", "face2", "face3", - // "face4", "face5", "top", - // "batt1", "batt2", "batt3", "batt4"}; - // for(int i=0; i<11; i++) { - // int ready = device_is_ready(sensors[i]); - // printk(" %s: %s (ptr: %p)\n", names[i], ready ? "READY" : "NOT READY", sensors[i]); - // } - // printk("==================================\n\n"); + inputs.baudRate = 115200; // Setup, cycle, and teardown topology ReferenceDeployment::setupTopology(inputs); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 70f11255..0b1695b2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -94,7 +94,18 @@ telemetry packets ReferenceDeploymentPackets { } - packet Thermal id 12 group 4 { + packet TcaMonitor id 12 group 4 { + ReferenceDeployment.tcaMonitor.Healthy + ReferenceDeployment.muxChannel0Monitor.Healthy + ReferenceDeployment.muxChannel1Monitor.Healthy + ReferenceDeployment.muxChannel2Monitor.Healthy + ReferenceDeployment.muxChannel3Monitor.Healthy + ReferenceDeployment.muxChannel4Monitor.Healthy + ReferenceDeployment.muxChannel5Monitor.Healthy + ReferenceDeployment.muxChannel7Monitor.Healthy + } + + packet Thermal id 13 group 4 { ReferenceDeployment.tmp112Face0Manager.Temperature ReferenceDeployment.tmp112Face1Manager.Temperature ReferenceDeployment.tmp112Face2Manager.Temperature diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 0fbac5dd..b043e002 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -118,6 +118,14 @@ void setupTopology(const TopologyState& state) { lis2mdlManager.configure(state.lis2mdlDevice); ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); + tcaMonitor.configure(state.tca9548aDevice); + muxChannel0Monitor.configure(state.muxChannel0Device); + muxChannel1Monitor.configure(state.muxChannel1Device); + muxChannel2Monitor.configure(state.muxChannel2Device); + muxChannel3Monitor.configure(state.muxChannel3Device); + muxChannel4Monitor.configure(state.muxChannel4Device); + muxChannel5Monitor.configure(state.muxChannel5Device); + muxChannel7Monitor.configure(state.muxChannel7Device); // Configure all 11 TMP112 temperature sensor managers tmp112Face0Manager.configure(state.face0TempDevice); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 38546486..70464434 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -81,7 +81,14 @@ struct TopologyState { const device* lsm6dsoDevice; //!< LSM6DSO device path for accelerometer/gyroscope const device* lis2mdlDevice; //!< LIS2MDL device path for magnetometer const device* rtcDevice; //!< RTC device path - const device* mcp23017; //!< MCP23017 GPIO expander device path + const device* tca9548aDevice; //!< TCA9548A I2C multiplexer device + const device* muxChannel0Device; //!< Multiplexer channel 0 device + const device* muxChannel1Device; //!< Multiplexer channel 1 device + const device* muxChannel2Device; //!< Multiplexer channel 2 device + const device* muxChannel3Device; //!< Multiplexer channel 3 device + const device* muxChannel4Device; //!< Multiplexer channel 4 device + const device* muxChannel5Device; //!< Multiplexer channel 5 device + const device* muxChannel7Device; //!< Multiplexer channel 7 device // Face devices // - Temperature sensors diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index e1bf3065..f787b005 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -142,24 +142,40 @@ module ReferenceDeployment { instance startupManager: Components.StartupManager base id 0x1003F000 - instance thermalManager: Components.ThermalManager base id 0x10041000 + instance tcaMonitor: Components.GenericDeviceMonitor base id 0x10041000 - instance tmp112Face0Manager: Drv.TMP112Manager base id 0x10042000 + instance muxChannel0Monitor: Components.GenericDeviceMonitor base id 0x10042000 - instance tmp112Face1Manager: Drv.TMP112Manager base id 0x10043000 + instance muxChannel1Monitor: Components.GenericDeviceMonitor base id 0x10043000 - instance tmp112Face2Manager: Drv.TMP112Manager base id 0x10044000 + instance muxChannel2Monitor: Components.GenericDeviceMonitor base id 0x10044000 - instance tmp112Face3Manager: Drv.TMP112Manager base id 0x10045000 + instance muxChannel3Monitor: Components.GenericDeviceMonitor base id 0x10045000 - instance tmp112Face5Manager: Drv.TMP112Manager base id 0x10046000 + instance muxChannel4Monitor: Components.GenericDeviceMonitor base id 0x10046000 - instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x10047000 + instance muxChannel5Monitor: Components.GenericDeviceMonitor base id 0x10047000 - instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x10048000 + instance muxChannel7Monitor: Components.GenericDeviceMonitor base id 0x10048000 - instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x10049000 + instance thermalManager: Components.ThermalManager base id 0x10049000 - instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x1004A000 + instance tmp112Face0Manager: Drv.TMP112Manager base id 0x1004A000 + + instance tmp112Face1Manager: Drv.TMP112Manager base id 0x1004B000 + + instance tmp112Face2Manager: Drv.TMP112Manager base id 0x1004C000 + + instance tmp112Face3Manager: Drv.TMP112Manager base id 0x1004D000 + + instance tmp112Face5Manager: Drv.TMP112Manager base id 0x1004E000 + + instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x1004F000 + + instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x10050000 + + instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x10051000 + + instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10052000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index d3b24051..c746db37 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -66,6 +66,16 @@ module ReferenceDeployment { instance powerMonitor instance ina219SysManager instance ina219SolManager + instance tcaMonitor + instance muxChannel0Monitor + instance muxChannel1Monitor + instance muxChannel2Monitor + instance muxChannel3Monitor + instance muxChannel4Monitor + instance muxChannel5Monitor + instance muxChannel7Monitor + + # Face Board Instances instance thermalManager instance tmp112Face0Manager instance tmp112Face1Manager @@ -183,7 +193,15 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run - rateGroup1Hz.RateGroupMemberOut[14] -> thermalManager.run + rateGroup1Hz.RateGroupMemberOut[14] -> tcaMonitor.run + rateGroup1Hz.RateGroupMemberOut[15] -> muxChannel0Monitor.run + rateGroup1Hz.RateGroupMemberOut[16] -> muxChannel1Monitor.run + rateGroup1Hz.RateGroupMemberOut[17] -> muxChannel2Monitor.run + rateGroup1Hz.RateGroupMemberOut[18] -> muxChannel3Monitor.run + rateGroup1Hz.RateGroupMemberOut[19] -> muxChannel4Monitor.run + rateGroup1Hz.RateGroupMemberOut[20] -> muxChannel5Monitor.run + rateGroup1Hz.RateGroupMemberOut[21] -> muxChannel7Monitor.run + rateGroup1Hz.RateGroupMemberOut[22] -> thermalManager.run } @@ -194,13 +212,28 @@ module ReferenceDeployment { connections LoadSwitches { face4LoadSwitch.gpioSet -> gpioface4LS.gpioWrite + face4LoadSwitch.gpioGet -> gpioface4LS.gpioRead + face0LoadSwitch.gpioSet -> gpioface0LS.gpioWrite + face0LoadSwitch.gpioGet -> gpioface0LS.gpioRead + face1LoadSwitch.gpioSet -> gpioface1LS.gpioWrite + face1LoadSwitch.gpioGet -> gpioface1LS.gpioRead + face2LoadSwitch.gpioSet -> gpioface2LS.gpioWrite + face2LoadSwitch.gpioGet -> gpioface2LS.gpioRead + face3LoadSwitch.gpioSet -> gpioface3LS.gpioWrite + face3LoadSwitch.gpioGet -> gpioface3LS.gpioRead + face5LoadSwitch.gpioSet -> gpioface5LS.gpioWrite + face5LoadSwitch.gpioGet -> gpioface5LS.gpioRead + payloadPowerLoadSwitch.gpioSet -> gpioPayloadPowerLS.gpioWrite + payloadPowerLoadSwitch.gpioGet -> gpioPayloadPowerLS.gpioRead + payloadBatteryLoadSwitch.gpioSet -> gpioPayloadBatteryLS.gpioWrite + payloadBatteryLoadSwitch.gpioGet -> gpioPayloadBatteryLS.gpioRead } connections BurnwireGpio { @@ -241,18 +274,23 @@ module ReferenceDeployment { } connections thermalMonitor { + thermalManager.face0LoadSwitchStateGet -> face0LoadSwitch.loadSwitchStateGet thermalManager.face0Init -> tmp112Face0Manager.init thermalManager.face0TempGet -> tmp112Face0Manager.temperatureGet + thermalManager.face1LoadSwitchStateGet -> face1LoadSwitch.loadSwitchStateGet thermalManager.face1Init -> tmp112Face1Manager.init thermalManager.face1TempGet -> tmp112Face1Manager.temperatureGet + thermalManager.face2LoadSwitchStateGet -> face2LoadSwitch.loadSwitchStateGet thermalManager.face2Init -> tmp112Face2Manager.init thermalManager.face2TempGet -> tmp112Face2Manager.temperatureGet + thermalManager.face3LoadSwitchStateGet -> face3LoadSwitch.loadSwitchStateGet thermalManager.face3Init -> tmp112Face3Manager.init thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet + thermalManager.face5LoadSwitchStateGet -> face5LoadSwitch.loadSwitchStateGet thermalManager.face5Init -> tmp112Face5Manager.init thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 8eeefb4b..38f32886 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 15 +constant ActiveRateGroupOutputPorts = 23 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 diff --git a/prj.conf b/prj.conf index 9c463cec..d0bf5b51 100644 --- a/prj.conf +++ b/prj.conf @@ -34,6 +34,7 @@ CONFIG_I2C_TCA954X=y # Mux must initialize AFTER I2C bus (16) and GPIO (11) but BEFORE sensors (90) CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=70 CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=71 +CONFIG_DEVICE_DEINIT_SUPPORT=y CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y From 2e3fe4ed48e3ab034a30b95998146686342eced1 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 00:14:07 -0600 Subject: [PATCH 32/68] Detect mux channel state in thermal manager --- .../Components/LoadSwitch/LoadSwitch.cpp | 1 + .../Components/LoadSwitch/LoadSwitch.hpp | 4 +++ .../ThermalManager/ThermalManager.cpp | 25 +++++++++++++---- .../ThermalManager/ThermalManager.fpp | 27 +++++++++++++++++++ .../ReferenceDeployment/Top/topology.fpp | 8 ++++++ 5 files changed, 60 insertions(+), 5 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index e86e4fba..00d7abca 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -29,6 +29,7 @@ void LoadSwitch ::Reset_handler(FwIndexType portNum) { } Fw::On LoadSwitch ::loadSwitchStateGet_handler(FwIndexType portNum) { + // TODO(nateinaction): Delay reporting state change until power has normalized Fw::Logic state; this->gpioGet_out(0, state); return state ? Fw::On::ON : Fw::On::OFF; diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index d24ddb10..9bae3923 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -72,6 +72,10 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Set the load switch state (common implementation for commands and ports) void setLoadSwitchState(Fw::On state //!< The desired state (ON or OFF) ); + + // ---------------------------------------------------------------------- + // Private member variables + // ---------------------------------------------------------------------- }; } // namespace Components diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 85f5d842..4c89823f 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -25,41 +25,56 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { // Cube face sensors (5 sensors) Fw::Success condition; - if (this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { + // If the TCA is not healthy, skip reading sensors + if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { + return; + } + + if (this->muxChannel0HealthGet_out(0) == Fw::Health::HEALTHY && + this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face0Init_out(0, condition); // If init fails, try deinit? if (condition == Fw::Success::SUCCESS) { this->face0TempGet_out(0); } } - if (this->face1LoadSwitchStateGet_out(0) == Fw::On::ON) { + if (this->muxChannel1HealthGet_out(0) == Fw::Health::HEALTHY && + this->face1LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face1Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face1TempGet_out(0); } } - if (this->face2LoadSwitchStateGet_out(0) == Fw::On::ON) { + if (this->muxChannel2HealthGet_out(0) == Fw::Health::HEALTHY && + this->face2LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face2Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face2TempGet_out(0); } } - if (this->face3LoadSwitchStateGet_out(0) == Fw::On::ON) { + if (this->muxChannel3HealthGet_out(0) == Fw::Health::HEALTHY && + this->face3LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face3Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face3TempGet_out(0); } } - if (this->face5LoadSwitchStateGet_out(0) == Fw::On::ON) { + if (this->muxChannel5HealthGet_out(0) == Fw::Health::HEALTHY && + this->face5LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face5Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face5TempGet_out(0); } } + // If mux channel 4 is not healthy, skip battery cell sensors + if (this->muxChannel4HealthGet_out(0) == Fw::Health::HEALTHY) { + return; + } + // Battery cell sensors (4 sensors) this->battCell1Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 364d8ea5..424cb5a9 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -5,6 +5,14 @@ module Components { sync input port run: Svc.Sched # Output ports to TMP112Manager instances + @ Port to return the state of the TCA + output port tcaHealthGet: Components.HealthGet + + # XY Boards + + @ Port to return the state of mux channel 0 + output port muxChannel0HealthGet: Components.HealthGet + @ Port to return the state of the load switch for face 0 output port face0LoadSwitchStateGet: Components.loadSwitchState @@ -14,6 +22,9 @@ module Components { @ Port for face 0 temperature sensor output port face0TempGet: Drv.temperatureGet + @ Port to return the state of mux channel 1 + output port muxChannel1HealthGet: Components.HealthGet + @ Port for face 1 load switch state output port face1LoadSwitchStateGet: Components.loadSwitchState @@ -23,6 +34,9 @@ module Components { @ Port for face 1 temperature sensor output port face1TempGet: Drv.temperatureGet + @ Port to return the state of mux channel 2 + output port muxChannel2HealthGet: Components.HealthGet + @ Port for face 2 load switch state output port face2LoadSwitchStateGet: Components.loadSwitchState @@ -32,6 +46,9 @@ module Components { @ Port for face 2 temperature sensor output port face2TempGet: Drv.temperatureGet + @ Port to return the state of mux channel 3 + output port muxChannel3HealthGet: Components.HealthGet + @ Port for face 3 load switch state output port face3LoadSwitchStateGet: Components.loadSwitchState @@ -41,6 +58,11 @@ module Components { @ Port for face 3 temperature sensor output port face3TempGet: Drv.temperatureGet + # Z- Board + + @ Port to return the state of mux channel 5 + output port muxChannel5HealthGet: Components.HealthGet + @ Port for face 5 load switch state output port face5LoadSwitchStateGet: Components.loadSwitchState @@ -50,6 +72,11 @@ module Components { @ Port for face 5 temperature sensor output port face5TempGet: Drv.temperatureGet + # Battery Cell + + @ Port to return the state of mux channel 4 + output port muxChannel4HealthGet: Components.HealthGet + @ Port for battery cell 1 temperature sensor initialization output port battCell1Init: Fw.SuccessCondition diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index c746db37..e648f171 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -274,26 +274,34 @@ module ReferenceDeployment { } connections thermalMonitor { + thermalManager.tcaHealthGet -> tcaMonitor.healthGet + + thermalManager.muxChannel0HealthGet -> muxChannel0Monitor.healthGet thermalManager.face0LoadSwitchStateGet -> face0LoadSwitch.loadSwitchStateGet thermalManager.face0Init -> tmp112Face0Manager.init thermalManager.face0TempGet -> tmp112Face0Manager.temperatureGet + thermalManager.muxChannel1HealthGet -> muxChannel1Monitor.healthGet thermalManager.face1LoadSwitchStateGet -> face1LoadSwitch.loadSwitchStateGet thermalManager.face1Init -> tmp112Face1Manager.init thermalManager.face1TempGet -> tmp112Face1Manager.temperatureGet + thermalManager.muxChannel2HealthGet -> muxChannel2Monitor.healthGet thermalManager.face2LoadSwitchStateGet -> face2LoadSwitch.loadSwitchStateGet thermalManager.face2Init -> tmp112Face2Manager.init thermalManager.face2TempGet -> tmp112Face2Manager.temperatureGet + thermalManager.muxChannel3HealthGet -> muxChannel3Monitor.healthGet thermalManager.face3LoadSwitchStateGet -> face3LoadSwitch.loadSwitchStateGet thermalManager.face3Init -> tmp112Face3Manager.init thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet + thermalManager.muxChannel5HealthGet -> muxChannel5Monitor.healthGet thermalManager.face5LoadSwitchStateGet -> face5LoadSwitch.loadSwitchStateGet thermalManager.face5Init -> tmp112Face5Manager.init thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet + thermalManager.muxChannel4HealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell1Init -> tmp112BattCell1Manager.init thermalManager.battCell1TempGet -> tmp112BattCell1Manager.temperatureGet From 105d7904a22be64bfe9d3400629772f8c1ca5293 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 01:16:12 -0600 Subject: [PATCH 33/68] Rate group cycle constantly slipping, resetting board --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 6 ++-- .../Drv/Tmp112Manager/TMP112Manager.fpp | 10 +++---- .../Components/LoadSwitch/LoadSwitch.cpp | 28 +++++++++++++++---- .../Components/LoadSwitch/LoadSwitch.hpp | 4 +++ .../ThermalManager/ThermalManager.cpp | 2 +- .../Top/ReferenceDeploymentPackets.fppi | 2 ++ .../Top/ReferenceDeploymentTopology.cpp | 7 +++-- .../Top/ReferenceDeploymentTopologyDefs.hpp | 3 ++ .../ReferenceDeployment/Top/instances.fpp | 5 ++++ .../ReferenceDeployment/Top/topology.fpp | 25 ++++++++++------- .../project/config/AcConstants.fpp | 2 +- 11 files changed, 68 insertions(+), 26 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 620d2fa8..ba3a7414 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -50,11 +50,13 @@ void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { int deinit_ret = device_deinit(this->m_dev); // TODO: Check output? if (deinit_ret != 0) { this->log_WARNING_HI_DeviceDeinitFailed(deinit_ret); + return; } + this->log_WARNING_HI_DeviceDeinitFailed_ThrottleClear(); return; } - // this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); condition = Fw::Success::SUCCESS; } @@ -64,7 +66,7 @@ F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", this->m_dev->name, this->m_dev); return 0; } - // this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); + this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); struct sensor_value temp; diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index 1f592adf..ff449e9b 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -18,15 +18,15 @@ module Drv { telemetry Temperature: F64 @ Event for reporting TMP112 not ready error - event DeviceNotReady() severity warning high format "TMP112 device not ready" - # event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 + # event DeviceNotReady() severity warning high format "TMP112 device not ready" + event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 @ Event for reporting TMP112 initialization failure - event DeviceInitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" - # event DeviceInitFailed(ret: U8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 + # event DeviceInitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" + event DeviceInitFailed(ret: U8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 @ Event for reporting TMP112 deinitialization failure - event DeviceDeinitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" + event DeviceDeinitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 # TODO: REMOVE ME # event DeviceAlreadyInitialized() severity warning high format "TMP112 device already initialized" diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 00d7abca..c65511a4 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -29,10 +29,7 @@ void LoadSwitch ::Reset_handler(FwIndexType portNum) { } Fw::On LoadSwitch ::loadSwitchStateGet_handler(FwIndexType portNum) { - // TODO(nateinaction): Delay reporting state change until power has normalized - Fw::Logic state; - this->gpioGet_out(0, state); - return state ? Fw::On::ON : Fw::On::OFF; + return this->getLoadSwitchState() && this->getTime() > this->m_on_timeout ? Fw::On::ON : Fw::On::OFF; } void LoadSwitch ::turnOn_handler(FwIndexType portNum) { @@ -62,10 +59,31 @@ void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { // ---------------------------------------------------------------------- void LoadSwitch ::setLoadSwitchState(Fw::On state) { - Fw::Logic gpioValue = (state == Fw::On::ON) ? Fw::Logic::HIGH : Fw::Logic::LOW; + if (this->getLoadSwitchState() == state) { + // No change, exit early + return; + } + + Fw::Logic gpioValue = Fw::Logic::LOW; + if (state == Fw::On::ON) { + gpioValue = Fw::Logic::HIGH; + this->m_on_timeout = this->getTime(); + // Start timeout timer for 1 second + // This delay is to allow power to stabilize after turning on the load switch + // TODO(nateinaction): Take delay duration as a parameter + // TODO(nateinaction): Is there a non-sleep way to determine if load switched board is ready? + this->m_on_timeout.add(1, 0); + } + this->gpioSet_out(0, gpioValue); this->log_ACTIVITY_HI_StatusChanged(state); this->tlmWrite_IsOn(state); } +Fw::On LoadSwitch ::getLoadSwitchState() { + Fw::Logic state; + this->gpioGet_out(0, state); + return state ? Fw::On::ON : Fw::On::OFF; +} + } // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 9bae3923..2a9f1990 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -73,9 +73,13 @@ class LoadSwitch final : public LoadSwitchComponentBase { void setLoadSwitchState(Fw::On state //!< The desired state (ON or OFF) ); + //! Get current load switch state + Fw::On getLoadSwitchState(); //muxChannel0HealthGet_out(0) == Fw::Health::HEALTHY && this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face0Init_out(0, condition); // If init fails, try deinit? + this->face0Init_out(0, condition); // TODO(nateinaction): If init fails, try deinit? if (condition == Fw::Success::SUCCESS) { this->face0TempGet_out(0); } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 0b1695b2..dc15ce06 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -9,6 +9,7 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.HiBuffs ReferenceDeployment.rateGroup10Hz.RgMaxTime ReferenceDeployment.rateGroup1Hz.RgMaxTime + # ReferenceDeployment.rateGroup1_6Hz.RgMaxTime ReferenceDeployment.startupManager.BootCount ReferenceDeployment.startupManager.QuiescenceEndTime ReferenceDeployment.modeManager.CurrentMode @@ -23,6 +24,7 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.EmptyBuffs ReferenceDeployment.rateGroup10Hz.RgCycleSlips ReferenceDeployment.rateGroup1Hz.RgCycleSlips + # ReferenceDeployment.rateGroup1_6Hz.RgCycleSlips } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index b043e002..3522bad4 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -42,14 +42,16 @@ constexpr FwSizeType getRateGroupPeriod(const FwSizeType hz) { // The reference topology divides the incoming clock signal (1Hz) into sub-signals: 1Hz, 1/2Hz, and 1/4Hz with 0 offset Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{ // Array of divider objects - {getRateGroupPeriod(10), 0}, // 10Hz - {getRateGroupPeriod(1), 0}, // 1Hz + {getRateGroupPeriod(10), 0}, // 10Hz = 100ms + {getRateGroupPeriod(1), 0}, // 1Hz = 1s + {6000, 0} // 1/6 Hz = 6s }}; // Rate groups may supply a context token to each of the attached children whose purpose is set by the project. The // reference topology sets each token to zero as these contexts are unused in this project. U32 rateGroup10HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGroupPeriod(10)}; U32 rateGroup1HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGroupPeriod(1)}; +U32 rateGroup1_6HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {6000}; /** * \brief configure/setup components in project-specific way @@ -65,6 +67,7 @@ void configureTopology() { // Rate groups require context arrays. rateGroup10Hz.configure(rateGroup10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup10HzContext)); rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); + // rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); cmdSeq.allocateBuffer(0, mallocator, 5 * 1024); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 70464434..e78289a7 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -53,6 +53,9 @@ enum { WARN = 3, FATAL = 5 }; namespace ReferenceDeployment_rateGroup1Hz { enum { WARN = 3, FATAL = 5 }; } +namespace ReferenceDeployment_rateGroup1_6Hz { +enum { WARN = 3, FATAL = 5 }; +} namespace ReferenceDeployment_cmdSeq { enum { WARN = 3, FATAL = 5 }; } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index f787b005..b5719bd8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,6 +37,11 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 3 + # instance rateGroup1_6Hz: Svc.ActiveRateGroup base id 0x10003000 \ + # queue size Default.QUEUE_SIZE \ + # stack size Default.STACK_SIZE \ + # priority 4 + instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \ queue size Default.QUEUE_SIZE * 2 \ stack size Default.STACK_SIZE \ diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index e648f171..c5904832 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -7,6 +7,7 @@ module ReferenceDeployment { enum Ports_RateGroups { rateGroup10Hz rateGroup1Hz + rateGroup1_6Hz } topology ReferenceDeployment { @@ -24,6 +25,7 @@ module ReferenceDeployment { # ---------------------------------------------------------------------- instance rateGroup10Hz instance rateGroup1Hz + # instance rateGroup1_6Hz instance rateGroupDriver instance timer instance lora @@ -177,7 +179,7 @@ module ReferenceDeployment { rateGroup10Hz.RateGroupMemberOut[3] -> FileHandling.fileManager.schedIn rateGroup10Hz.RateGroupMemberOut[4] -> cmdSeq.schedIn - # Slow rate (1Hz) rate group + # Medium rate (1Hz) rate group rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1Hz] -> rateGroup1Hz.CycleIn rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run @@ -193,15 +195,18 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run - rateGroup1Hz.RateGroupMemberOut[14] -> tcaMonitor.run - rateGroup1Hz.RateGroupMemberOut[15] -> muxChannel0Monitor.run - rateGroup1Hz.RateGroupMemberOut[16] -> muxChannel1Monitor.run - rateGroup1Hz.RateGroupMemberOut[17] -> muxChannel2Monitor.run - rateGroup1Hz.RateGroupMemberOut[18] -> muxChannel3Monitor.run - rateGroup1Hz.RateGroupMemberOut[19] -> muxChannel4Monitor.run - rateGroup1Hz.RateGroupMemberOut[20] -> muxChannel5Monitor.run - rateGroup1Hz.RateGroupMemberOut[21] -> muxChannel7Monitor.run - rateGroup1Hz.RateGroupMemberOut[22] -> thermalManager.run + + # Slow rate (1/6 Hz) rate group + # rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn + # rateGroup1_6Hz.RateGroupMemberOut[0] -> tcaMonitor.run + # rateGroup1_6Hz.RateGroupMemberOut[1] -> muxChannel0Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[2] -> muxChannel1Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[3] -> muxChannel2Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[4] -> muxChannel3Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[5] -> muxChannel4Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[6] -> muxChannel5Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[7] -> muxChannel7Monitor.run + # rateGroup1_6Hz.RateGroupMemberOut[8] -> thermalManager.run } diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 38f32886..8eeefb4b 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 23 +constant ActiveRateGroupOutputPorts = 15 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 From 27fdc9b22a0f541709f3e6e22f314cdb73a16af8 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 03:40:59 -0600 Subject: [PATCH 34/68] Seeing i/o error --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 32 +++++++------------ .../Drv/Tmp112Manager/TMP112Manager.fpp | 9 +----- .../Drv/Tmp112Manager/TMP112Manager.hpp | 3 ++ .../ReferenceDeployment/Top/topology.fpp | 22 ++++++------- .../project/config/AcConstants.fpp | 2 +- 5 files changed, 28 insertions(+), 40 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index ba3a7414..5556b364 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -32,31 +32,23 @@ void TMP112Manager::configure(const struct device* dev) { // ---------------------------------------------------------------------- void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { + // TODO(nateinaction): I could check TCA, MUX, LoadSwitch here. + // If I don't want to call init over and over again, I can store state in the component. + + // Reset the device initialization state to allow device_init to run again. + if (this->m_dev && this->m_dev->state) { + this->m_dev->state->initialized = false; + } + int ret = device_init(this->m_dev); - // do i need to start the mux first? - // if (ret != 0 && ret != -EALREADY) { - // if (ret == -EALREADY) { - // // Device already initialized - treat as success - // this->log_WARNING_HI_DeviceAlreadyInitialized(); - // return; - // } - if (ret != 0) { - // Emit an error? or ignore because face is off? Talk to load manager to see if face is on before erroring? - this->log_WARNING_HI_DeviceInitFailed(ret); + if (ret < 0) { condition = Fw::Success::FAILURE; - - // Even after a failure to init, the device will stay in an initialized state - // so we need to deinit to allow future init attempts - int deinit_ret = device_deinit(this->m_dev); // TODO: Check output? - if (deinit_ret != 0) { - this->log_WARNING_HI_DeviceDeinitFailed(deinit_ret); - return; - } - this->log_WARNING_HI_DeviceDeinitFailed_ThrottleClear(); + this->log_WARNING_HI_DeviceInitFailed(ret); return; } - this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + + // this->m_initialized = true; // This cannot be used until it can be set false when the load switch is turned off. condition = Fw::Success::SUCCESS; } diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index ff449e9b..0f70c4fc 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -22,14 +22,7 @@ module Drv { event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 @ Event for reporting TMP112 initialization failure - # event DeviceInitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" - event DeviceInitFailed(ret: U8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 - - @ Event for reporting TMP112 deinitialization failure - event DeviceDeinitFailed(ret: I8) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 - - # TODO: REMOVE ME - # event DeviceAlreadyInitialized() severity warning high format "TMP112 device already initialized" + event DeviceInitFailed(ret: I32) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index 5c373850..c5c2afab 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -57,6 +57,9 @@ class TMP112Manager final : public TMP112ManagerComponentBase { //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; + + //! Initialization state + bool m_initialized = false; }; } // namespace Drv diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index c5904832..7522abb8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -192,21 +192,21 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run rateGroup1Hz.RateGroupMemberOut[10] -> FileHandling.fileDownlink.Run - rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run - rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run + rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run # doubles (20ms) rate group max time + # rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run # Causing rate group to slip? rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run + rateGroup1Hz.RateGroupMemberOut[14] -> tcaMonitor.run + rateGroup1Hz.RateGroupMemberOut[15] -> muxChannel0Monitor.run + rateGroup1Hz.RateGroupMemberOut[16] -> muxChannel1Monitor.run + rateGroup1Hz.RateGroupMemberOut[17] -> muxChannel2Monitor.run + rateGroup1Hz.RateGroupMemberOut[18] -> muxChannel3Monitor.run + rateGroup1Hz.RateGroupMemberOut[19] -> muxChannel4Monitor.run + rateGroup1Hz.RateGroupMemberOut[20] -> muxChannel5Monitor.run + rateGroup1Hz.RateGroupMemberOut[21] -> muxChannel7Monitor.run + rateGroup1Hz.RateGroupMemberOut[22] -> thermalManager.run # Slow rate (1/6 Hz) rate group # rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn - # rateGroup1_6Hz.RateGroupMemberOut[0] -> tcaMonitor.run - # rateGroup1_6Hz.RateGroupMemberOut[1] -> muxChannel0Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[2] -> muxChannel1Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[3] -> muxChannel2Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[4] -> muxChannel3Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[5] -> muxChannel4Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[6] -> muxChannel5Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[7] -> muxChannel7Monitor.run - # rateGroup1_6Hz.RateGroupMemberOut[8] -> thermalManager.run } diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 8eeefb4b..38f32886 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 15 +constant ActiveRateGroupOutputPorts = 23 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 From ee24b13df83b9c4fca1e286a8763d3c3dc3378a4 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 10:55:55 -0600 Subject: [PATCH 35/68] sleepy nighttime thoughts --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 31 +++++++++-------- .../Drv/Tmp112Manager/TMP112Manager.fpp | 33 +++++++++++++++++++ .../Drv/Tmp112Manager/TMP112Manager.hpp | 13 +++++--- .../Components/LoadSwitch/LoadSwitch.fpp | 4 +-- .../ThermalManager/ThermalManager.cpp | 8 ++++- .../ThermalManager/ThermalManager.fpp | 10 +++--- 6 files changed, 71 insertions(+), 28 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 5556b364..74fd1fac 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -32,30 +32,31 @@ void TMP112Manager::configure(const struct device* dev) { // ---------------------------------------------------------------------- void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { - // TODO(nateinaction): I could check TCA, MUX, LoadSwitch here. - // If I don't want to call init over and over again, I can store state in the component. - - // Reset the device initialization state to allow device_init to run again. - if (this->m_dev && this->m_dev->state) { - this->m_dev->state->initialized = false; + int rc = device_init(this->m_dev); + if (rc < 0) { + condition = Fw::Success::FAILURE; + this->log_WARNING_HI_DeviceInitFailed(rc); } + this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + + condition = Fw::Success::SUCCESS; +} - int ret = device_init(this->m_dev); - if (ret < 0) { +void TMP112Manager ::deinit_handler(FwIndexType portNum, Fw::Success& condition) { + if (!this->m_dev || !this->m_dev->state) { condition = Fw::Success::FAILURE; - this->log_WARNING_HI_DeviceInitFailed(ret); + this->log_WARNING_HI_DeviceDeinitFailed(); return; } - this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); - // this->m_initialized = true; // This cannot be used until it can be set false when the load switch is turned off. + this->m_dev->state->initialized = false; + condition = Fw::Success::SUCCESS; } F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); - printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", this->m_dev->name, this->m_dev); return 0; } this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); @@ -64,15 +65,13 @@ F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); if (rc != 0) { - // Sensor fetch failed - return 0 to indicate error - printk("[TMP112Manager] sensor_sample_fetch_chan failed for %s: rc=%d\n", this->m_dev->name, rc); + this->log_WARNING_HI_SensorFetchFailed(rc); return 0; } rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); if (rc != 0) { - // Channel get failed - return 0 to indicate error - printk("[TMP112Manager] sensor_channel_get failed for %s: rc=%d\n", this->m_dev->name, rc); + this->log_WARNING_HI_SensorChannelGetFailed(rc); return 0; } diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index 0f70c4fc..c696634e 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -6,12 +6,29 @@ module Drv { @ Manager for TMP112 device passive component TMP112Manager { # Ports + # TODO(nateinaction): Load Switch output ports to initialize/deinitialize based on load switch state!!! + # NO, it's not a 1-1 mapping because multiple sensors can be on one load switch + @ Port to initialize the TMP112 device sync input port init: Fw.SuccessCondition + @ Port to deinitialize the TMP112 device + sync input port deinit: Fw.SuccessCondition + @ Port to read the temperature in degrees Celsius sync input port temperatureGet: temperatureGet + # TODO(nateinaction): I like the way this looks but not all tmp112 sensors will be on tca/mux or load switches + # Example: battery and top cap temp sensors is not load switched but face temp sensors are + @ Port to return the state of the TCA + output port tcaHealthGet: Components.HealthGet + + @ Port to return the state of mux channel + output port muxChannelHealthGet: Components.HealthGet + + @ Port to return the state of the load switch + output port loadSwitchStateGet: Components.loadSwitchStateGet + # Telemetry channels @ Telemetry channel for temperature in degrees Celsius @@ -24,6 +41,22 @@ module Drv { @ Event for reporting TMP112 initialization failure event DeviceInitFailed(ret: I32) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 + @ Event for reporting TMP112 sensor fetch failure + event SensorFetchFailed(ret: I32) severity warning high format "TMP112 sensor fetch failed with return code: {}" throttle 5 + + @ Event for reporting TMP112 sensor channel get failure + event SensorChannelGetFailed(ret: I32) severity warning high format "TMP112 sensor channel get failed with return code: {}" throttle 5 + + @ Event for reporting TMP112 deinitialization failure + event DeviceDeinitFailed() severity warning high format "TMP112 deinitialization failed" throttle 5 + + @ Event for reporting TMP112 sensor fetch failure + event SensorFetchFailed(ret: I32) severity warning high format "TMP112 sensor fetch failed with return code: {}" throttle 5 + + @ Event for reporting TMP112 sensor channel get failure + event SensorChannelGetFailed(ret: I32) severity warning high format "TMP112 sensor channel get failed with return code: {}" throttle 5 + + ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # ############################################################################### diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index c5c2afab..ecdf77d3 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -45,21 +45,26 @@ class TMP112Manager final : public TMP112ManagerComponentBase { Fw::Success& condition //!< Condition success/failure ) override; + //! Handler implementation for deinit + //! + //! Port to deinitialize the TMP112 device + void deinit_handler(FwIndexType portNum, //!< The port number + Fw::Success& condition //!< Condition success/failure + ) override; + //! Handler implementation for temperatureGet //! //! Port to read the temperature in degrees Celsius F64 temperatureGet_handler(FwIndexType portNum //!< The port number ) override; + private: // ---------------------------------------------------------------------- - // Member variables + // Private member variables // ---------------------------------------------------------------------- //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; - - //! Initialization state - bool m_initialized = false; }; } // namespace Drv diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 7d0dedc8..5a488252 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -1,5 +1,5 @@ module Components { - port loadSwitchState -> Fw.On + port loadSwitchStateGet -> Fw.On } module Components { @@ -34,7 +34,7 @@ module Components { sync input port turnOff: Fw.Signal @ Input port to get the state of the load switch (called by other components) - sync input port loadSwitchStateGet: loadSwitchState + sync input port loadSwitchStateGet: loadSwitchStateGet ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 961c143d..798e0751 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -25,6 +25,12 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { // Cube face sensors (5 sensors) Fw::Success condition; + // ?? + // TODO(nateinaction): muxTempSensor.tempGet (checks tca and mux channel healths) -> loadSwitchTempSensor.tempGet + // (checks load switch state) -> tmp112Manager.temperatureGet + // -> tmp112Manager.temperatureGet + // ?? + // If the TCA is not healthy, skip reading sensors if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { return; @@ -32,7 +38,7 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { if (this->muxChannel0HealthGet_out(0) == Fw::Health::HEALTHY && this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face0Init_out(0, condition); // TODO(nateinaction): If init fails, try deinit? + this->face0Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face0TempGet_out(0); } diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 424cb5a9..39680e77 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -14,7 +14,7 @@ module Components { output port muxChannel0HealthGet: Components.HealthGet @ Port to return the state of the load switch for face 0 - output port face0LoadSwitchStateGet: Components.loadSwitchState + output port face0LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 0 temperature sensor initialization output port face0Init: Fw.SuccessCondition @@ -26,7 +26,7 @@ module Components { output port muxChannel1HealthGet: Components.HealthGet @ Port for face 1 load switch state - output port face1LoadSwitchStateGet: Components.loadSwitchState + output port face1LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 1 temperature sensor initialization output port face1Init: Fw.SuccessCondition @@ -38,7 +38,7 @@ module Components { output port muxChannel2HealthGet: Components.HealthGet @ Port for face 2 load switch state - output port face2LoadSwitchStateGet: Components.loadSwitchState + output port face2LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 2 temperature sensor initialization output port face2Init: Fw.SuccessCondition @@ -50,7 +50,7 @@ module Components { output port muxChannel3HealthGet: Components.HealthGet @ Port for face 3 load switch state - output port face3LoadSwitchStateGet: Components.loadSwitchState + output port face3LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 3 temperature sensor initialization output port face3Init: Fw.SuccessCondition @@ -64,7 +64,7 @@ module Components { output port muxChannel5HealthGet: Components.HealthGet @ Port for face 5 load switch state - output port face5LoadSwitchStateGet: Components.loadSwitchState + output port face5LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 5 temperature sensor initialization output port face5Init: Fw.SuccessCondition From 5923d5e9abda6957eb68d04c2973dcebcb32cf90 Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Fri, 28 Nov 2025 09:51:52 -0800 Subject: [PATCH 36/68] Updated DTSI Mux Regs --- .../proves_flight_control_board_v5.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index d8d39c61..865c1c03 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -298,7 +298,7 @@ zephyr_udc0: &usbd { mux_channel_4: i2c_mux@4 { compatible = "ti,tca9548a-channel"; label = "mux_channel_4"; - reg = <7>; + reg = <4>; #address-cells = <1>; #size-cells = <0>; batt_cell1_temp_sens: tmp112@48 { @@ -327,7 +327,7 @@ zephyr_udc0: &usbd { mux_channel_5: i2c_mux@5 { compatible = "ti,tca9548a-channel"; label = "mux_channel_5"; - reg = <4>; + reg = <5>; #address-cells = <1>; #size-cells = <0>; From 845f4388a7bed8b130b3688ed8da84afd0319a99 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 14:23:21 -0600 Subject: [PATCH 37/68] Revert "sleepy nighttime thoughts" This reverts commit ee24b13df83b9c4fca1e286a8763d3c3dc3378a4. --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 31 ++++++++--------- .../Drv/Tmp112Manager/TMP112Manager.fpp | 33 ------------------- .../Drv/Tmp112Manager/TMP112Manager.hpp | 13 +++----- .../Components/LoadSwitch/LoadSwitch.fpp | 4 +-- .../ThermalManager/ThermalManager.cpp | 8 +---- .../ThermalManager/ThermalManager.fpp | 10 +++--- 6 files changed, 28 insertions(+), 71 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 74fd1fac..5556b364 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -32,31 +32,30 @@ void TMP112Manager::configure(const struct device* dev) { // ---------------------------------------------------------------------- void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { - int rc = device_init(this->m_dev); - if (rc < 0) { - condition = Fw::Success::FAILURE; - this->log_WARNING_HI_DeviceInitFailed(rc); - } - this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + // TODO(nateinaction): I could check TCA, MUX, LoadSwitch here. + // If I don't want to call init over and over again, I can store state in the component. - condition = Fw::Success::SUCCESS; -} + // Reset the device initialization state to allow device_init to run again. + if (this->m_dev && this->m_dev->state) { + this->m_dev->state->initialized = false; + } -void TMP112Manager ::deinit_handler(FwIndexType portNum, Fw::Success& condition) { - if (!this->m_dev || !this->m_dev->state) { + int ret = device_init(this->m_dev); + if (ret < 0) { condition = Fw::Success::FAILURE; - this->log_WARNING_HI_DeviceDeinitFailed(); + this->log_WARNING_HI_DeviceInitFailed(ret); return; } + this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); - this->m_dev->state->initialized = false; - + // this->m_initialized = true; // This cannot be used until it can be set false when the load switch is turned off. condition = Fw::Success::SUCCESS; } F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); + printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", this->m_dev->name, this->m_dev); return 0; } this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); @@ -65,13 +64,15 @@ F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); if (rc != 0) { - this->log_WARNING_HI_SensorFetchFailed(rc); + // Sensor fetch failed - return 0 to indicate error + printk("[TMP112Manager] sensor_sample_fetch_chan failed for %s: rc=%d\n", this->m_dev->name, rc); return 0; } rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); if (rc != 0) { - this->log_WARNING_HI_SensorChannelGetFailed(rc); + // Channel get failed - return 0 to indicate error + printk("[TMP112Manager] sensor_channel_get failed for %s: rc=%d\n", this->m_dev->name, rc); return 0; } diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index c696634e..0f70c4fc 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -6,29 +6,12 @@ module Drv { @ Manager for TMP112 device passive component TMP112Manager { # Ports - # TODO(nateinaction): Load Switch output ports to initialize/deinitialize based on load switch state!!! - # NO, it's not a 1-1 mapping because multiple sensors can be on one load switch - @ Port to initialize the TMP112 device sync input port init: Fw.SuccessCondition - @ Port to deinitialize the TMP112 device - sync input port deinit: Fw.SuccessCondition - @ Port to read the temperature in degrees Celsius sync input port temperatureGet: temperatureGet - # TODO(nateinaction): I like the way this looks but not all tmp112 sensors will be on tca/mux or load switches - # Example: battery and top cap temp sensors is not load switched but face temp sensors are - @ Port to return the state of the TCA - output port tcaHealthGet: Components.HealthGet - - @ Port to return the state of mux channel - output port muxChannelHealthGet: Components.HealthGet - - @ Port to return the state of the load switch - output port loadSwitchStateGet: Components.loadSwitchStateGet - # Telemetry channels @ Telemetry channel for temperature in degrees Celsius @@ -41,22 +24,6 @@ module Drv { @ Event for reporting TMP112 initialization failure event DeviceInitFailed(ret: I32) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 - @ Event for reporting TMP112 sensor fetch failure - event SensorFetchFailed(ret: I32) severity warning high format "TMP112 sensor fetch failed with return code: {}" throttle 5 - - @ Event for reporting TMP112 sensor channel get failure - event SensorChannelGetFailed(ret: I32) severity warning high format "TMP112 sensor channel get failed with return code: {}" throttle 5 - - @ Event for reporting TMP112 deinitialization failure - event DeviceDeinitFailed() severity warning high format "TMP112 deinitialization failed" throttle 5 - - @ Event for reporting TMP112 sensor fetch failure - event SensorFetchFailed(ret: I32) severity warning high format "TMP112 sensor fetch failed with return code: {}" throttle 5 - - @ Event for reporting TMP112 sensor channel get failure - event SensorChannelGetFailed(ret: I32) severity warning high format "TMP112 sensor channel get failed with return code: {}" throttle 5 - - ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # ############################################################################### diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index ecdf77d3..c5c2afab 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -45,26 +45,21 @@ class TMP112Manager final : public TMP112ManagerComponentBase { Fw::Success& condition //!< Condition success/failure ) override; - //! Handler implementation for deinit - //! - //! Port to deinitialize the TMP112 device - void deinit_handler(FwIndexType portNum, //!< The port number - Fw::Success& condition //!< Condition success/failure - ) override; - //! Handler implementation for temperatureGet //! //! Port to read the temperature in degrees Celsius F64 temperatureGet_handler(FwIndexType portNum //!< The port number ) override; - private: // ---------------------------------------------------------------------- - // Private member variables + // Member variables // ---------------------------------------------------------------------- //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; + + //! Initialization state + bool m_initialized = false; }; } // namespace Drv diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 5a488252..7d0dedc8 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -1,5 +1,5 @@ module Components { - port loadSwitchStateGet -> Fw.On + port loadSwitchState -> Fw.On } module Components { @@ -34,7 +34,7 @@ module Components { sync input port turnOff: Fw.Signal @ Input port to get the state of the load switch (called by other components) - sync input port loadSwitchStateGet: loadSwitchStateGet + sync input port loadSwitchStateGet: loadSwitchState ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 798e0751..961c143d 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -25,12 +25,6 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { // Cube face sensors (5 sensors) Fw::Success condition; - // ?? - // TODO(nateinaction): muxTempSensor.tempGet (checks tca and mux channel healths) -> loadSwitchTempSensor.tempGet - // (checks load switch state) -> tmp112Manager.temperatureGet - // -> tmp112Manager.temperatureGet - // ?? - // If the TCA is not healthy, skip reading sensors if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { return; @@ -38,7 +32,7 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { if (this->muxChannel0HealthGet_out(0) == Fw::Health::HEALTHY && this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face0Init_out(0, condition); + this->face0Init_out(0, condition); // TODO(nateinaction): If init fails, try deinit? if (condition == Fw::Success::SUCCESS) { this->face0TempGet_out(0); } diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 39680e77..424cb5a9 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -14,7 +14,7 @@ module Components { output port muxChannel0HealthGet: Components.HealthGet @ Port to return the state of the load switch for face 0 - output port face0LoadSwitchStateGet: Components.loadSwitchStateGet + output port face0LoadSwitchStateGet: Components.loadSwitchState @ Port for face 0 temperature sensor initialization output port face0Init: Fw.SuccessCondition @@ -26,7 +26,7 @@ module Components { output port muxChannel1HealthGet: Components.HealthGet @ Port for face 1 load switch state - output port face1LoadSwitchStateGet: Components.loadSwitchStateGet + output port face1LoadSwitchStateGet: Components.loadSwitchState @ Port for face 1 temperature sensor initialization output port face1Init: Fw.SuccessCondition @@ -38,7 +38,7 @@ module Components { output port muxChannel2HealthGet: Components.HealthGet @ Port for face 2 load switch state - output port face2LoadSwitchStateGet: Components.loadSwitchStateGet + output port face2LoadSwitchStateGet: Components.loadSwitchState @ Port for face 2 temperature sensor initialization output port face2Init: Fw.SuccessCondition @@ -50,7 +50,7 @@ module Components { output port muxChannel3HealthGet: Components.HealthGet @ Port for face 3 load switch state - output port face3LoadSwitchStateGet: Components.loadSwitchStateGet + output port face3LoadSwitchStateGet: Components.loadSwitchState @ Port for face 3 temperature sensor initialization output port face3Init: Fw.SuccessCondition @@ -64,7 +64,7 @@ module Components { output port muxChannel5HealthGet: Components.HealthGet @ Port for face 5 load switch state - output port face5LoadSwitchStateGet: Components.loadSwitchStateGet + output port face5LoadSwitchStateGet: Components.loadSwitchState @ Port for face 5 temperature sensor initialization output port face5Init: Fw.SuccessCondition From c3119fe44f3496814bedeaa5e168f4668b6b63b7 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 14:28:25 -0600 Subject: [PATCH 38/68] All faces working --- FprimeZephyrReference/ComCcsdsUart/ComCcsds.fpp | 3 +-- .../Components/ThermalManager/ThermalManager.cpp | 4 ++-- .../Components/ThermalManager/ThermalManager.fpp | 4 ++-- .../ReferenceDeployment/Top/instances.fpp | 2 +- .../ReferenceDeployment/Top/topology.fpp | 8 ++++---- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/FprimeZephyrReference/ComCcsdsUart/ComCcsds.fpp b/FprimeZephyrReference/ComCcsdsUart/ComCcsds.fpp index d051335a..3b174800 100644 --- a/FprimeZephyrReference/ComCcsdsUart/ComCcsds.fpp +++ b/FprimeZephyrReference/ComCcsdsUart/ComCcsds.fpp @@ -44,8 +44,7 @@ module ComCcsdsUart { instance aggregator: Svc.ComAggregator base id ComCcsdsConfig.BASE_ID_UART + 0x06000 \ queue size ComCcsdsConfig.QueueSizes.aggregator \ - stack size ComCcsdsConfig.StackSizes.aggregator \ - priority ComCcsdsConfig.Priorities.aggregator + stack size ComCcsdsConfig.StackSizes.aggregator # ---------------------------------------------------------------------- # Passive Components diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 961c143d..72388bf6 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -63,7 +63,7 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { } if (this->muxChannel5HealthGet_out(0) == Fw::Health::HEALTHY && - this->face5LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face4LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face5Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face5TempGet_out(0); @@ -71,7 +71,7 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { } // If mux channel 4 is not healthy, skip battery cell sensors - if (this->muxChannel4HealthGet_out(0) == Fw::Health::HEALTHY) { + if (this->muxChannel4HealthGet_out(0) != Fw::Health::HEALTHY) { return; } diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 424cb5a9..06a3c07f 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -63,8 +63,8 @@ module Components { @ Port to return the state of mux channel 5 output port muxChannel5HealthGet: Components.HealthGet - @ Port for face 5 load switch state - output port face5LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 4 load switch state + output port face4LoadSwitchStateGet: Components.loadSwitchState @ Port for face 5 temperature sensor initialization output port face5Init: Fw.SuccessCondition diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index b5719bd8..26d9ca8a 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -173,7 +173,7 @@ module ReferenceDeployment { instance tmp112Face3Manager: Drv.TMP112Manager base id 0x1004D000 - instance tmp112Face5Manager: Drv.TMP112Manager base id 0x1004E000 + instance tmp112Face4Manager: Drv.TMP112Manager base id 0x1004E000 instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x1004F000 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 7522abb8..27cd6cd8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -83,7 +83,7 @@ module ReferenceDeployment { instance tmp112Face1Manager instance tmp112Face2Manager instance tmp112Face3Manager - instance tmp112Face5Manager + instance tmp112Face4Manager instance tmp112BattCell1Manager instance tmp112BattCell2Manager instance tmp112BattCell3Manager @@ -302,9 +302,9 @@ module ReferenceDeployment { thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet thermalManager.muxChannel5HealthGet -> muxChannel5Monitor.healthGet - thermalManager.face5LoadSwitchStateGet -> face5LoadSwitch.loadSwitchStateGet - thermalManager.face5Init -> tmp112Face5Manager.init - thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet + thermalManager.face4LoadSwitchStateGet -> face4LoadSwitch.loadSwitchStateGet + thermalManager.face5Init -> tmp112Face4Manager.init + thermalManager.face5TempGet -> tmp112Face4Manager.temperatureGet thermalManager.muxChannel4HealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell1Init -> tmp112BattCell1Manager.init From 88af688694d6fb2fd6848475c36a0b8ebddce541 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Fri, 28 Nov 2025 15:47:55 -0600 Subject: [PATCH 39/68] Add mux 6 --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 34 +++++++---- .../Drv/Tmp112Manager/TMP112Manager.fpp | 12 ++++ .../Drv/Tmp112Manager/TMP112Manager.hpp | 1 + .../Components/LoadSwitch/LoadSwitch.fpp | 4 +- .../ThermalManager/ThermalManager.cpp | 2 +- .../ThermalManager/ThermalManager.fpp | 12 ++-- .../ReferenceDeployment/Main.cpp | 2 + .../Top/ReferenceDeploymentPackets.fppi | 1 + .../Top/ReferenceDeploymentTopologyDefs.hpp | 1 + .../ReferenceDeployment/Top/instances.fpp | 24 ++++---- .../ReferenceDeployment/Top/topology.fpp | 9 +-- .../proves_flight_control_board_v5.dtsi | 60 +++++++++++++++---- 12 files changed, 114 insertions(+), 48 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 5556b364..597a5599 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -32,18 +32,27 @@ void TMP112Manager::configure(const struct device* dev) { // ---------------------------------------------------------------------- void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { - // TODO(nateinaction): I could check TCA, MUX, LoadSwitch here. - // If I don't want to call init over and over again, I can store state in the component. + if (!this->m_dev) { + condition = Fw::Success::FAILURE; + this->log_WARNING_HI_DeviceNil(); + return; + } + this->log_WARNING_HI_DeviceNil_ThrottleClear(); - // Reset the device initialization state to allow device_init to run again. - if (this->m_dev && this->m_dev->state) { - this->m_dev->state->initialized = false; + if (!this->m_dev->state) { + condition = Fw::Success::FAILURE; + this->log_WARNING_HI_DeviceStateNil(); + return; } + this->log_WARNING_HI_DeviceStateNil_ThrottleClear(); + + // Reset the device initialization state to allow device_init to run again. + this->m_dev->state->initialized = false; - int ret = device_init(this->m_dev); - if (ret < 0) { + int rc = device_init(this->m_dev); + if (rc < 0) { condition = Fw::Success::FAILURE; - this->log_WARNING_HI_DeviceInitFailed(ret); + this->log_WARNING_HI_DeviceInitFailed(rc); return; } this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); @@ -55,7 +64,6 @@ void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); - printk("[TMP112Manager] Device not ready: %s (ptr: %p)\n", this->m_dev->name, this->m_dev); return 0; } this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); @@ -64,17 +72,17 @@ F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); if (rc != 0) { - // Sensor fetch failed - return 0 to indicate error - printk("[TMP112Manager] sensor_sample_fetch_chan failed for %s: rc=%d\n", this->m_dev->name, rc); + this->log_WARNING_HI_SensorSampleFetchFailed(rc); return 0; } + this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); if (rc != 0) { - // Channel get failed - return 0 to indicate error - printk("[TMP112Manager] sensor_channel_get failed for %s: rc=%d\n", this->m_dev->name, rc); + this->log_WARNING_HI_SensorChannelGetFailed(rc); return 0; } + this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); this->tlmWrite_Temperature(sensor_value_to_double(&temp)); diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index 0f70c4fc..0cea2663 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -24,6 +24,18 @@ module Drv { @ Event for reporting TMP112 initialization failure event DeviceInitFailed(ret: I32) severity warning high format "TMP112 initialization failed with return code: {}" throttle 5 + @ Event for reporting TMP112 nil device error + event DeviceNil() severity warning high format "TMP112 device is nil" throttle 5 + + @ Event for reporting TMP112 nil state error + event DeviceStateNil() severity warning high format "TMP112 device state is nil" throttle 5 + + @ Event for reporting TMP112 sensor fetch failure + event SensorSampleFetchFailed(ret: I32) severity warning high format "TMP112 sensor fetch failed with return code: {}" throttle 5 + + @ Event for reporting TMP112 sensor channel get failure + event SensorChannelGetFailed(ret: I32) severity warning high format "TMP112 sensor channel get failed with return code: {}" throttle 5 + ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # ############################################################################### diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index c5c2afab..59e8e34f 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -41,6 +41,7 @@ class TMP112Manager final : public TMP112ManagerComponentBase { //! Handler implementation for init //! //! Port to initialize the TMP112 device + //! Must be called and complete successfully at least one time before temperature can be read void init_handler(FwIndexType portNum, //!< The port number Fw::Success& condition //!< Condition success/failure ) override; diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 7d0dedc8..5a488252 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -1,5 +1,5 @@ module Components { - port loadSwitchState -> Fw.On + port loadSwitchStateGet -> Fw.On } module Components { @@ -34,7 +34,7 @@ module Components { sync input port turnOff: Fw.Signal @ Input port to get the state of the load switch (called by other components) - sync input port loadSwitchStateGet: loadSwitchState + sync input port loadSwitchStateGet: loadSwitchStateGet ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 72388bf6..1ed66346 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -63,7 +63,7 @@ void ThermalManager::run_handler(FwIndexType portNum, U32 context) { } if (this->muxChannel5HealthGet_out(0) == Fw::Health::HEALTHY && - this->face4LoadSwitchStateGet_out(0) == Fw::On::ON) { + this->face5LoadSwitchStateGet_out(0) == Fw::On::ON) { this->face5Init_out(0, condition); if (condition == Fw::Success::SUCCESS) { this->face5TempGet_out(0); diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 06a3c07f..39680e77 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -14,7 +14,7 @@ module Components { output port muxChannel0HealthGet: Components.HealthGet @ Port to return the state of the load switch for face 0 - output port face0LoadSwitchStateGet: Components.loadSwitchState + output port face0LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 0 temperature sensor initialization output port face0Init: Fw.SuccessCondition @@ -26,7 +26,7 @@ module Components { output port muxChannel1HealthGet: Components.HealthGet @ Port for face 1 load switch state - output port face1LoadSwitchStateGet: Components.loadSwitchState + output port face1LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 1 temperature sensor initialization output port face1Init: Fw.SuccessCondition @@ -38,7 +38,7 @@ module Components { output port muxChannel2HealthGet: Components.HealthGet @ Port for face 2 load switch state - output port face2LoadSwitchStateGet: Components.loadSwitchState + output port face2LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 2 temperature sensor initialization output port face2Init: Fw.SuccessCondition @@ -50,7 +50,7 @@ module Components { output port muxChannel3HealthGet: Components.HealthGet @ Port for face 3 load switch state - output port face3LoadSwitchStateGet: Components.loadSwitchState + output port face3LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 3 temperature sensor initialization output port face3Init: Fw.SuccessCondition @@ -63,8 +63,8 @@ module Components { @ Port to return the state of mux channel 5 output port muxChannel5HealthGet: Components.HealthGet - @ Port for face 4 load switch state - output port face4LoadSwitchStateGet: Components.loadSwitchState + @ Port for face 5 load switch state + output port face5LoadSwitchStateGet: Components.loadSwitchStateGet @ Port for face 5 temperature sensor initialization output port face5Init: Fw.SuccessCondition diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 6c93a555..1ee482e0 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -25,6 +25,7 @@ const struct device* mux_channel_2 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_2)); const struct device* mux_channel_3 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_3)); const struct device* mux_channel_4 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_4)); const struct device* mux_channel_5 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_5)); +const struct device* mux_channel_6 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_6)); const struct device* mux_channel_7 = DEVICE_DT_GET(DT_NODELABEL(mux_channel_7)); const struct device* face0_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face0_temp_sens)); const struct device* face1_temp_sens = DEVICE_DT_GET(DT_NODELABEL(face1_temp_sens)); @@ -62,6 +63,7 @@ int main(int argc, char* argv[]) { inputs.muxChannel3Device = mux_channel_3; inputs.muxChannel4Device = mux_channel_4; inputs.muxChannel5Device = mux_channel_5; + inputs.muxChannel6Device = mux_channel_6; inputs.muxChannel7Device = mux_channel_7; // Face Board device bindings diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index dc15ce06..816d7a5a 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -104,6 +104,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.muxChannel3Monitor.Healthy ReferenceDeployment.muxChannel4Monitor.Healthy ReferenceDeployment.muxChannel5Monitor.Healthy + ReferenceDeployment.muxChannel6Monitor.Healthy ReferenceDeployment.muxChannel7Monitor.Healthy } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index e78289a7..d8031df0 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -91,6 +91,7 @@ struct TopologyState { const device* muxChannel3Device; //!< Multiplexer channel 3 device const device* muxChannel4Device; //!< Multiplexer channel 4 device const device* muxChannel5Device; //!< Multiplexer channel 5 device + const device* muxChannel6Device; //!< Multiplexer channel 5 device const device* muxChannel7Device; //!< Multiplexer channel 7 device // Face devices diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 26d9ca8a..7b22f7ae 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -161,26 +161,28 @@ module ReferenceDeployment { instance muxChannel5Monitor: Components.GenericDeviceMonitor base id 0x10047000 - instance muxChannel7Monitor: Components.GenericDeviceMonitor base id 0x10048000 + instance muxChannel6Monitor: Components.GenericDeviceMonitor base id 0x10048000 - instance thermalManager: Components.ThermalManager base id 0x10049000 + instance muxChannel7Monitor: Components.GenericDeviceMonitor base id 0x10049000 - instance tmp112Face0Manager: Drv.TMP112Manager base id 0x1004A000 + instance thermalManager: Components.ThermalManager base id 0x1004A000 - instance tmp112Face1Manager: Drv.TMP112Manager base id 0x1004B000 + instance tmp112Face0Manager: Drv.TMP112Manager base id 0x1004B000 - instance tmp112Face2Manager: Drv.TMP112Manager base id 0x1004C000 + instance tmp112Face1Manager: Drv.TMP112Manager base id 0x1004C000 - instance tmp112Face3Manager: Drv.TMP112Manager base id 0x1004D000 + instance tmp112Face2Manager: Drv.TMP112Manager base id 0x1004D000 - instance tmp112Face4Manager: Drv.TMP112Manager base id 0x1004E000 + instance tmp112Face3Manager: Drv.TMP112Manager base id 0x1004E000 - instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x1004F000 + instance tmp112Face5Manager: Drv.TMP112Manager base id 0x1004F000 - instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x10050000 + instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x10050000 - instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x10051000 + instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x10051000 - instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10052000 + instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x10052000 + + instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10053000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 27cd6cd8..0d8c4f02 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -75,6 +75,7 @@ module ReferenceDeployment { instance muxChannel3Monitor instance muxChannel4Monitor instance muxChannel5Monitor + instance muxChannel6Monitor instance muxChannel7Monitor # Face Board Instances @@ -83,7 +84,7 @@ module ReferenceDeployment { instance tmp112Face1Manager instance tmp112Face2Manager instance tmp112Face3Manager - instance tmp112Face4Manager + instance tmp112Face5Manager instance tmp112BattCell1Manager instance tmp112BattCell2Manager instance tmp112BattCell3Manager @@ -302,9 +303,9 @@ module ReferenceDeployment { thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet thermalManager.muxChannel5HealthGet -> muxChannel5Monitor.healthGet - thermalManager.face4LoadSwitchStateGet -> face4LoadSwitch.loadSwitchStateGet - thermalManager.face5Init -> tmp112Face4Manager.init - thermalManager.face5TempGet -> tmp112Face4Manager.temperatureGet + thermalManager.face5LoadSwitchStateGet -> face5LoadSwitch.loadSwitchStateGet + thermalManager.face5Init -> tmp112Face5Manager.init + thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet thermalManager.muxChannel4HealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell1Init -> tmp112BattCell1Manager.init diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 865c1c03..4a3b310a 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -323,7 +323,7 @@ zephyr_udc0: &usbd { }; }; - // Z- Face + // Z- Face x1 mux_channel_5: i2c_mux@5 { compatible = "ti,tca9548a-channel"; label = "mux_channel_5"; @@ -361,6 +361,44 @@ zephyr_udc0: &usbd { }; + // Z- Face x2 + mux_channel_6: i2c_mux@6 { + compatible = "ti,tca9548a-channel"; + label = "mux_channel_6"; + reg = <6>; + #address-cells = <1>; + #size-cells = <0>; + + face6_temp_sens: tmp112@48 { + compatible = "ti,tmp112"; + reg = <0x48>; + status = "okay"; + label = "FACE5_TMP112"; + zephyr,deferred-init; + }; + + face6_light_sens: light@29 { + compatible = "vishay,veml6031"; + reg = <0x29>; + status = "okay"; + label = "FACE5_VEML6031"; + zephyr,deferred-init; + }; + + face6_drv2605: drv2605@5a { + compatible = "ti,drv2605"; + status = "okay"; + reg = <0x5a>; + label = "FACE5_DRV2605"; + zephyr,deferred-init; + + actuator-mode = "LRA"; + loop-gain = "HIGH"; + feedback-brake-factor = "2X"; + }; + + }; + // Top is always powered so no deferred init needed mux_channel_7: i2c_mux@7 { compatible = "ti,tca9548a-channel"; @@ -428,19 +466,19 @@ zephyr_udc0: &usbd { * 5: RF2_IO1 (GPA5) * 6: RF2_IO0 (GPA6) * 7: RF2_IO3 (GPA7) - * 8: FACE4_ENABLE (GPB0) + * 8: FACE5_ENABLE (GPB5) * 9: FACE0_ENABLE (GPB1) * 10: FACE1_ENABLE (GPB2) * 11: FACE2_ENABLE (GPB3) * 12: FACE3_ENABLE (GPB4) - * 13: FACE5_ENABLE (GPB5) + * 13: FACE4_ENABLE (GPB0) * 14: READONLY (GPB6) * 15: CHARGE (GPB7) */ gpio-line-names = "ENABLE_HEATER", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3", - "FACE4_ENABLE", "FACE0_ENABLE", "FACE1_ENABLE", "FACE2_ENABLE", - "FACE3_ENABLE", "FACE5_ENABLE", "READONLY", "CHARGE"; + "FACE5_ENABLE", "FACE0_ENABLE", "FACE1_ENABLE", "FACE2_ENABLE", + "FACE3_ENABLE", "FACE4_ENABLE", "READONLY", "CHARGE"; reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; @@ -455,10 +493,10 @@ zephyr_udc0: &usbd { gpio_outputs { compatible = "gpio-leds"; // Using gpio-leds as a convenient container - face4_enable: face4-enable { + face5_enable: face5-enable { - gpios = <&mcp23017 8 GPIO_ACTIVE_HIGH>; // GPB0 - label = "FACE4_ENABLE"; + gpios = <&mcp23017 8 GPIO_ACTIVE_HIGH>; // GPB5 + label = "FACE5_ENABLE"; }; face0_enable: face0-enable { @@ -485,10 +523,10 @@ zephyr_udc0: &usbd { label = "FACE3_ENABLE"; }; - face5_enable: face5-enable { + face4_enable: face4-enable { - gpios = <&mcp23017 13 GPIO_ACTIVE_HIGH>; // GPB5 - label = "FACE5_ENABLE"; + gpios = <&mcp23017 13 GPIO_ACTIVE_HIGH>; // GPB0 + label = "FACE4_ENABLE"; }; enable_heater: enable-heater { From 65f2a4c03c21262ed2cefad0e9e14a4cc63cc695 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sat, 29 Nov 2025 15:19:07 -0600 Subject: [PATCH 40/68] Starting light sensor --- .codespell-ignore-words.txt | 1 + .../Components/Drv/CMakeLists.txt | 1 + .../Drv/Velm6031Manager/CMakeLists.txt | 36 ++++ .../Drv/Velm6031Manager/Velm6031Manager.cpp | 156 ++++++++++++++++++ .../Drv/Velm6031Manager/Velm6031Manager.fpp | 103 ++++++++++++ .../Drv/Velm6031Manager/Velm6031Manager.hpp | 70 ++++++++ .../Drv/Velm6031Manager/docs/sdd.md | 66 ++++++++ .../Components/LoadSwitch/LoadSwitch.hpp | 2 + .../ReferenceDeployment/Main.cpp | 15 ++ .../Top/ReferenceDeploymentTopology.cpp | 9 + .../Top/ReferenceDeploymentTopologyDefs.hpp | 8 + .../ReferenceDeployment/Top/instances.fpp | 14 ++ ...ht_control_board_v5c_rp2350a_m33_defconfig | 1 + 13 files changed, 482 insertions(+) create mode 100644 FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp create mode 100644 FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp create mode 100644 FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp create mode 100644 FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md diff --git a/.codespell-ignore-words.txt b/.codespell-ignore-words.txt index 3d64f1a1..41db8f22 100644 --- a/.codespell-ignore-words.txt +++ b/.codespell-ignore-words.txt @@ -1,3 +1,4 @@ +ALS comIn Ines rsource diff --git a/FprimeZephyrReference/Components/Drv/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/CMakeLists.txt index d55d258b..6f1b9ec8 100644 --- a/FprimeZephyrReference/Components/Drv/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/CMakeLists.txt @@ -4,3 +4,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RtcManager") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager/") diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt new file mode 100644 index 00000000..99e460de --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Velm6031ManagerTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Velm6031ManagerTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp new file mode 100644 index 00000000..ae79e013 --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp @@ -0,0 +1,156 @@ +// ====================================================================== +// \title Velm6031Manager.cpp +// \brief cpp file for Velm6031Manager component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/Velm6031Manager/Velm6031Manager.hpp" + +#include +#include +#include +#include + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +Velm6031Manager ::Velm6031Manager(const char* const compName) : Velm6031ManagerComponentBase(compName) {} + +Velm6031Manager ::~Velm6031Manager() {} + +void Velm6031Manager ::configure(const struct device* dev) { + this->m_dev = dev; +} + +void Velm6031Manager ::ReadData() { // const struct device *dev, + // Return integer + int ret; + + // Sensor value structs for reading data + struct sensor_value light; + struct sensor_value als_raw; + struct sensor_value ir_raw; + struct sensor_value sen; + + sen.val2 = 0; + + Fw::ParamValid valid; + sen.val1 = 5; // pass in saying that the parameter is valid + + // Setting the integration time attribute for the light sensor + + if (!(this->m_attributes_set)) { + ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_IT, &sen); + if (ret) { + Fw::LogStringArg errMsg("Failed to set it attribute"); + this->log_WARNING_HI_Velm6031ManagerError(errMsg); + } + + // Set the sensor attribute for div4 + sen.val1 = paramGet_DIV4(valid); + + ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_DIV4, &sen); + if (ret) { + Fw::LogStringArg errMsg("Failed to set div4 attribute"); + this->log_WARNING_HI_Velm6031ManagerError(errMsg); + } + + // Set the sensor attribute for the gain + sen.val1 = 0; + ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_GAIN, &sen); + if (ret) { + Fw::LogStringArg errMsg("Failed to set gain attribute ret"); + this->log_WARNING_HI_Velm6031ManagerError(errMsg); + } + + this->m_attributes_set = true; + } + + // Get the rate + ret = sensor_sample_fetch(this->m_dev); + if ((ret < 0) && (ret != -E2BIG)) { + Fw::LogStringArg errMsg("sample update error"); + this->log_WARNING_HI_Velm6031ManagerError(errMsg); + this->log_WARNING_HI_Velm6031ManagerErrorInt(ret); + } + + // Get the light data + sensor_channel_get(this->m_dev, (enum sensor_channel)SENSOR_CHAN_LIGHT, &light); + + // Get the raw ALS + sensor_channel_get(this->m_dev, (enum sensor_channel)SENSOR_CHAN_VEML6031_ALS_RAW_COUNTS, &als_raw); + + // Get the raw IR + sensor_channel_get(this->m_dev, (enum sensor_channel)SENSOR_CHAN_VEML6031_IR_RAW_COUNTS, &ir_raw); + + this->m_RawLightData = sensor_value_to_double(&light); + this->m_ALSLightData = sensor_value_to_double(&als_raw); + this->m_IRLightData = sensor_value_to_double(&ir_raw); +} + +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +void Velm6031Manager ::run_handler(FwIndexType portNum, U32 context) { + Fw::Logic state; + this->gpioRead_out(portNum, state); + if (state == Fw::Logic::HIGH) { // port call to the gpio driver, pass in a specific pin # + this->ReadData(); + this->tlmWrite_RawLightData(this->m_RawLightData); + this->tlmWrite_IRLightData(this->m_IRLightData); + this->tlmWrite_ALSLightData(this->m_ALSLightData); + } else { + if (this->m_device_init == true) { + this->m_device_init = false; + } + if (state == Fw::Logic::LOW && this->m_attributes_set == true) { + this->m_attributes_set = false; + } + } +} + +void Velm6031Manager::init_handler(FwIndexType portNum) { + const struct device* mux = DEVICE_DT_GET(DT_NODELABEL(tca9548a)); + const struct device* channel = DEVICE_DT_GET(DT_NODELABEL(face0_i2c)); + const struct device* sensor = DEVICE_DT_GET(DT_NODELABEL(face0_light_sens)); + + if (!mux || !channel || !sensor) { + this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Device DT_NODELABEL missing")); + return; + } + + int ret = device_init(mux); + if (ret < 0) { + this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("TCA9548A init failed")); + return; + } + k_sleep(K_MSEC(30)); + + ret = device_init(channel); + if (ret < 0) { + this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Mux channel init failed")); + return; + } + k_sleep(K_MSEC(30)); + + ret = device_init(sensor); + if (ret < 0) { + this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor init failed")); + // Continue anyway - might still work + } + k_sleep(K_MSEC(50)); + + if (!device_is_ready(sensor)) { + this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor not ready after timeout")); + } + + this->m_dev = sensor; + this->m_device_init = true; + + this->log_ACTIVITY_LO_Velm6031ManagerConfigured(); +} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp new file mode 100644 index 00000000..38a04d3a --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp @@ -0,0 +1,103 @@ +module Components { + @ Component for reading light sensor data + port InitPort + + passive component Velm6031Manager { + + #### Parameters #### + @ Parameter for setting the gain of the light senors + param GAIN: U32 default 1 + + @ Parameter for setting the integration time of the light sensors + param INTEGRATION_TIME: U32 default 100 + + @ Parameter for setting the div4 mode of the light sensors + param DIV4: U32 default 0 + + #### Telemetry #### + @ Telemetry for the raw light sensor data + telemetry RawLightData: F32 + + @ Telemetry for the IR light sensor data + telemetry IRLightData: F32 + + @ Telemetry for the ALS light sensor data + telemetry ALSLightData: F32 + + #### Ports #### + + @ Port for polling the light sensor data - called by rate group + sync input port run: Svc.Sched + + @ Port for reading gpio status + output port gpioRead: Drv.GpioRead + + @ Port to tell us when to init the device + sync input port init: InitPort + + #### Events #### + + @ Event for light sensor errors + event Velm6031ManagerError(log: string) severity warning high format "Light Sensor Error: {}" + + event Velm6031ManagerErrorInt(log: U32) severity warning high format "Light Sensor Error: {}" + + @ Event for light sensor configuration + event Velm6031ManagerConfigured() severity activity low format "Light Sensor Configured" + + event Velm6031ManagerRead() severity activity low format "Values Read from the Light Sensor" + + + + + ############################################################################## + #### Uncomment the following examples to start customizing your component #### + ############################################################################## + + # @ Example async command + # async command COMMAND_NAME(param_name: U32) + + # @ Example telemetry counter + # telemetry ExampleCounter: U64 + + # @ Example event + # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + + # @ Example port: receiving calls from the rate group + # sync input port run: Svc.Sched + + # @ Example parameter + # param PARAMETER_NAME: U32 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending command registrations + command reg port cmdRegOut + + @ Port for receiving commands + command recv port cmdIn + + @ Port for sending command responses + command resp port cmdResponseOut + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + @ Port to return the value of a parameter + param get port prmGetOut + + @Port to set the value of a parameter + param set port prmSetOut + + } +} diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp new file mode 100644 index 00000000..8cad2eda --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp @@ -0,0 +1,70 @@ +// ====================================================================== +// \title Velm6031Manager.hpp +// \brief hpp file for Velm6031Manager component implementation class +// ====================================================================== + +#ifndef Components_Velm6031Manager_HPP +#define Components_Velm6031Manager_HPP + +#include + +#include "FprimeZephyrReference/Components/Velm6031Manager/Velm6031ManagerComponentAc.hpp" +#include +#include +#include +#include +#include +#include +#include + +namespace Components { + +class Velm6031Manager final : public Velm6031ManagerComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct Velm6031Manager object + Velm6031Manager(const char* const compName //!< The component name + ); + + //! Destroy Velm6031Manager object + ~Velm6031Manager(); + + void ReadData(); + + void configure(const struct device* dev); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for run + //! + //! Port for polling the light sensor data - called by rate group + void run_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; + + void init_handler(FwIndexType portNum); + + F32 m_RawLightData; + + F32 m_IRLightData; + + F32 m_ALSLightData; + + bool m_configured = false; + + bool m_attributes_set = false; + + bool m_device_init = false; + + const struct device* m_dev; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md b/FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md new file mode 100644 index 00000000..2f35f91e --- /dev/null +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md @@ -0,0 +1,66 @@ +# Components::Velm6031Manager + +Component for reading light sensor data + +## Usage Examples +Add usage examples here + +### Diagrams +Add diagrams here + +### Typical Usage +And the typical usage of the component here + +## Class Diagram +Add a class diagram here + +## Port Descriptions +| Name | Description | +|---|---| +|---|---| + +## Component States +Add component states in the chart below +| Name | Description | +|---|---| +|---|---| + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|---|---| +|---|---| + +## Commands +| Name | Description | +|---|---| +|---|---| + +## Events +| Name | Description | +|---|---| +|---|---| + +## Telemetry +| Name | Description | +|---|---| +|---|---| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|---|---|---| +|---|---|---| + +## Change Log +| Date | Description | +|---|---| +|---| Initial Draft | diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 2a9f1990..837d0cfa 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -54,6 +54,8 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Handler implementation for loadSwitchStateGet //! //! Input port to get the state of the load switch (called by other components) + //! We need to wait for power to normalize after turning on the load switch + //! so we check the current time against a timeout Fw::On loadSwitchStateGet_handler(FwIndexType portNum //!< The port number ) override; diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 1ee482e0..16b871ce 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -36,6 +36,13 @@ const struct device* batt_cell1_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell const struct device* batt_cell2_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell2_temp_sens)); const struct device* batt_cell3_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell3_temp_sens)); const struct device* batt_cell4_temp_sens = DEVICE_DT_GET(DT_NODELABEL(batt_cell4_temp_sens)); +const struct device* face0_light_sens = DEVICE_DT_GET(DT_NODELABEL(face0_light_sens)); +const struct device* face1_light_sens = DEVICE_DT_GET(DT_NODELABEL(face1_light_sens)); +const struct device* face2_light_sens = DEVICE_DT_GET(DT_NODELABEL(face2_light_sens)); +const struct device* face3_light_sens = DEVICE_DT_GET(DT_NODELABEL(face3_light_sens)); +const struct device* face5_light_sens = DEVICE_DT_GET(DT_NODELABEL(face5_light_sens)); +const struct device* face6_light_sens = DEVICE_DT_GET(DT_NODELABEL(face6_light_sens)); +const struct device* face7_light_sens = DEVICE_DT_GET(DT_NODELABEL(face7_light_sens)); int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// @@ -77,6 +84,14 @@ int main(int argc, char* argv[]) { inputs.battCell2TempDevice = batt_cell2_temp_sens; inputs.battCell3TempDevice = batt_cell3_temp_sens; inputs.battCell4TempDevice = batt_cell4_temp_sens; + // Light sensor devices + inputs.face0LightDevice = face0_light_sens; + inputs.face1LightDevice = face1_light_sens; + inputs.face2LightDevice = face2_light_sens; + inputs.face3LightDevice = face3_light_sens; + inputs.face5LightDevice = face5_light_sens; + inputs.face6LightDevice = face6_light_sens; + inputs.face7LightDevice = face7_light_sens; inputs.baudRate = 115200; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 3522bad4..fb86d6ee 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -140,6 +140,15 @@ void setupTopology(const TopologyState& state) { tmp112BattCell2Manager.configure(state.battCell2TempDevice); tmp112BattCell3Manager.configure(state.battCell3TempDevice); tmp112BattCell4Manager.configure(state.battCell4TempDevice); + + // Configure all 7 VELM6031 light sensor managers + velm6031Face0Manager.configure(state.face0LightDevice); + velm6031Face1Manager.configure(state.face1LightDevice); + velm6031Face2Manager.configure(state.face2LightDevice); + velm6031Face3Manager.configure(state.face3LightDevice); + velm6031Face5Manager.configure(state.face5LightDevice); + velm6031Face6Manager.configure(state.face6LightDevice); + velm6031Face7Manager.configure(state.face7LightDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index d8031df0..19d72cea 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -105,6 +105,14 @@ struct TopologyState { const device* battCell2TempDevice; //!< TMP112 device for battery cell 2 const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 + // - Light sensors + const device* face0LightDevice; //!< Light sensor device for cube face 0 + const device* face1LightDevice; //!< Light sensor device for cube face 1 + const device* face2LightDevice; //!< Light sensor device for cube face 2 + const device* face3LightDevice; //!< Light sensor device for cube face 3 + const device* face5LightDevice; //!< Light sensor device for cube face 5 + const device* face6LightDevice; //!< Light sensor device for cube face 6 + const device* face7LightDevice; //!< Light sensor device for cube face 7 }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 7b22f7ae..ebc2e188 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -185,4 +185,18 @@ module ReferenceDeployment { instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10053000 + instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 + + instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 + + instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 + + instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 + + instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 + + instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 + + instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 + } diff --git a/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig b/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig index 2b429e95..7a5b0c34 100644 --- a/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig +++ b/boards/bronco_space/proves_flight_control_board_v5c/proves_flight_control_board_v5c_rp2350a_m33_defconfig @@ -26,6 +26,7 @@ CONFIG_LSM6DSO_ENABLE_TEMP=y CONFIG_LIS2MDL=y CONFIG_INA219=y CONFIG_TMP112=y +CONFIG_VEML6031=y # Radio CONFIG_LORA=y From 97475a61fd43fcd5dfb8fbc0d19f4a0c3715c48e Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sat, 29 Nov 2025 15:39:03 -0600 Subject: [PATCH 41/68] Remove I2C debug lines from prj.conf --- prj.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/prj.conf b/prj.conf index d0bf5b51..d54b91ee 100644 --- a/prj.conf +++ b/prj.conf @@ -34,7 +34,6 @@ CONFIG_I2C_TCA954X=y # Mux must initialize AFTER I2C bus (16) and GPIO (11) but BEFORE sensors (90) CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=70 CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=71 -CONFIG_DEVICE_DEINIT_SUPPORT=y CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y @@ -57,8 +56,6 @@ CONFIG_SENSOR=y # Enable detailed logging for I2C and sensor debugging CONFIG_LOG=y CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_I2C_LOG_LEVEL_DBG=y -CONFIG_SENSOR_LOG_LEVEL_DBG=y CONFIG_CBPRINTF_FP_SUPPORT=y From 496ec12359ca5067ca59eb9758ccc60e4e47b382 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 17:28:46 -0600 Subject: [PATCH 42/68] Saving progress --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 2 + .../Drv/Tmp112Manager/TMP112Manager.fpp | 10 ++ .../Drv/Tmp112Manager/TMP112Manager.hpp | 9 ++ .../Drv/Velm6031Manager/Velm6031Manager.cpp | 99 +++++++++---------- .../Drv/Velm6031Manager/Velm6031Manager.fpp | 2 +- .../Drv/Velm6031Manager/Velm6031Manager.hpp | 6 +- .../Components/LoadSwitch/LoadSwitch.fpp | 3 + .../Top/ReferenceDeploymentPackets.fppi | 24 +++++ .../ReferenceDeployment/Top/topology.fpp | 7 ++ .../project/config/AcConstants.fpp | 2 +- 10 files changed, 108 insertions(+), 56 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 597a5599..579fb41d 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -32,6 +32,8 @@ void TMP112Manager::configure(const struct device* dev) { // ---------------------------------------------------------------------- void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { + // if () + if (!this->m_dev) { condition = Fw::Success::FAILURE; this->log_WARNING_HI_DeviceNil(); diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index 0cea2663..d9709d34 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -1,5 +1,6 @@ module Drv { port temperatureGet -> F64 + port initialized -> bool } module Drv { @@ -12,6 +13,15 @@ module Drv { @ Port to read the temperature in degrees Celsius sync input port temperatureGet: temperatureGet + @ Output port to check device TCA health + output port getTCAHealth: Components.HealthGet + + @ Output port to check device MUX health + output port getMUXHealth: Components.HealthGet + + @ Output port to get load switch state + output port getLoadSwitchState: Components.loadSwitchStateGet + # Telemetry channels @ Telemetry channel for temperature in degrees Celsius diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index 59e8e34f..0e44b15b 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -59,6 +59,15 @@ class TMP112Manager final : public TMP112ManagerComponentBase { //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; + //! TCA health state + Fw::Health tca_state = Fw::Health::FAILED; + + //! MUX health state + Fw::Health mux_state = Fw::Health::FAILED; + + //! Load switch state + Fw::On load_switch_state = Fw::On::OFF; + //! Initialization state bool m_initialized = false; }; diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp index ae79e013..da5e1428 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp @@ -3,14 +3,14 @@ // \brief cpp file for Velm6031Manager component implementation class // ====================================================================== -#include "FprimeZephyrReference/Components/Velm6031Manager/Velm6031Manager.hpp" +#include "FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp" #include #include #include #include -namespace Components { +namespace Drv { // ---------------------------------------------------------------------- // Component construction and destruction @@ -45,16 +45,16 @@ void Velm6031Manager ::ReadData() { // const struct device *dev, ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_IT, &sen); if (ret) { Fw::LogStringArg errMsg("Failed to set it attribute"); - this->log_WARNING_HI_Velm6031ManagerError(errMsg); + // this->log_WARNING_HI_Velm6031ManagerError(errMsg); } // Set the sensor attribute for div4 - sen.val1 = paramGet_DIV4(valid); + // sen.val1 = paramGet_DIV4(valid); ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_DIV4, &sen); if (ret) { Fw::LogStringArg errMsg("Failed to set div4 attribute"); - this->log_WARNING_HI_Velm6031ManagerError(errMsg); + // this->log_WARNING_HI_Velm6031ManagerError(errMsg); } // Set the sensor attribute for the gain @@ -62,7 +62,7 @@ void Velm6031Manager ::ReadData() { // const struct device *dev, ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_GAIN, &sen); if (ret) { Fw::LogStringArg errMsg("Failed to set gain attribute ret"); - this->log_WARNING_HI_Velm6031ManagerError(errMsg); + // this->log_WARNING_HI_Velm6031ManagerError(errMsg); } this->m_attributes_set = true; @@ -72,8 +72,8 @@ void Velm6031Manager ::ReadData() { // const struct device *dev, ret = sensor_sample_fetch(this->m_dev); if ((ret < 0) && (ret != -E2BIG)) { Fw::LogStringArg errMsg("sample update error"); - this->log_WARNING_HI_Velm6031ManagerError(errMsg); - this->log_WARNING_HI_Velm6031ManagerErrorInt(ret); + // this->log_WARNING_HI_Velm6031ManagerError(errMsg); + // this->log_WARNING_HI_Velm6031ManagerErrorInt(ret); } // Get the light data @@ -96,12 +96,12 @@ void Velm6031Manager ::ReadData() { // const struct device *dev, void Velm6031Manager ::run_handler(FwIndexType portNum, U32 context) { Fw::Logic state; - this->gpioRead_out(portNum, state); + // this->gpioRead_out(portNum, state); if (state == Fw::Logic::HIGH) { // port call to the gpio driver, pass in a specific pin # this->ReadData(); - this->tlmWrite_RawLightData(this->m_RawLightData); - this->tlmWrite_IRLightData(this->m_IRLightData); - this->tlmWrite_ALSLightData(this->m_ALSLightData); + // this->tlmWrite_RawLightData(this->m_RawLightData); + // this->tlmWrite_IRLightData(this->m_IRLightData); + // this->tlmWrite_ALSLightData(this->m_ALSLightData); } else { if (this->m_device_init == true) { this->m_device_init = false; @@ -113,44 +113,41 @@ void Velm6031Manager ::run_handler(FwIndexType portNum, U32 context) { } void Velm6031Manager::init_handler(FwIndexType portNum) { - const struct device* mux = DEVICE_DT_GET(DT_NODELABEL(tca9548a)); - const struct device* channel = DEVICE_DT_GET(DT_NODELABEL(face0_i2c)); - const struct device* sensor = DEVICE_DT_GET(DT_NODELABEL(face0_light_sens)); - - if (!mux || !channel || !sensor) { - this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Device DT_NODELABEL missing")); - return; - } - - int ret = device_init(mux); - if (ret < 0) { - this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("TCA9548A init failed")); - return; - } - k_sleep(K_MSEC(30)); - - ret = device_init(channel); - if (ret < 0) { - this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Mux channel init failed")); - return; - } - k_sleep(K_MSEC(30)); - - ret = device_init(sensor); - if (ret < 0) { - this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor init failed")); - // Continue anyway - might still work - } - k_sleep(K_MSEC(50)); - - if (!device_is_ready(sensor)) { - this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor not ready after timeout")); - } - - this->m_dev = sensor; - this->m_device_init = true; - - this->log_ACTIVITY_LO_Velm6031ManagerConfigured(); + // const struct device* mux = DEVICE_DT_GET(DT_NODELABEL(tca9548a)); + // const struct device* channel = DEVICE_DT_GET(DT_NODELABEL(face0_i2c)); + // const struct device* sensor = DEVICE_DT_GET(DT_NODELABEL(face0_light_sens)); + + // if (!mux || !channel || !sensor) { + // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Device DT_NODELABEL missing")); + // return; + // } + + // int ret = device_init(mux); + // if (ret < 0) { + // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("TCA9548A init failed")); + // return; + // } + + // ret = device_init(channel); + // if (ret < 0) { + // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Mux channel init failed")); + // return; + // } + + // ret = device_init(sensor); + // if (ret < 0) { + // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor init failed")); + // // Continue anyway - might still work + // } + + // if (!device_is_ready(sensor)) { + // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor not ready after timeout")); + // } + + // this->m_dev = sensor; + // this->m_device_init = true; + + // this->log_ACTIVITY_LO_Velm6031ManagerConfigured(); } -} // namespace Components +} // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp index 38a04d3a..5ee1e61d 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp @@ -1,4 +1,4 @@ -module Components { +module Drv { @ Component for reading light sensor data port InitPort diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp index 8cad2eda..8e33e60e 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp @@ -8,7 +8,7 @@ #include -#include "FprimeZephyrReference/Components/Velm6031Manager/Velm6031ManagerComponentAc.hpp" +#include "FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031ManagerComponentAc.hpp" #include #include #include @@ -17,7 +17,7 @@ #include #include -namespace Components { +namespace Drv { class Velm6031Manager final : public Velm6031ManagerComponentBase { public: @@ -65,6 +65,6 @@ class Velm6031Manager final : public Velm6031ManagerComponentBase { const struct device* m_dev; }; -} // namespace Components +} // namespace Drv #endif diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 5a488252..d12315e3 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -24,6 +24,9 @@ module Components { @ Port sending calls to the GPIO driver to read state output port gpioGet: Drv.GpioRead + @ Port to indicate a change in load switch state + output port loadSwitchStateChanged: Components.loadSwitchStateGet + @ Input port to reset the load switch (called by other components) sync input port Reset: Fw.Signal diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 816d7a5a..5da15f16 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -120,6 +120,30 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112BattCell4Manager.Temperature } + packet LightSensor id 14 group 4 { + ReferenceDeployment.velm6031Face0Manager.RawLightData + ReferenceDeployment.velm6031Face1Manager.RawLightData + ReferenceDeployment.velm6031Face2Manager.RawLightData + ReferenceDeployment.velm6031Face3Manager.RawLightData + ReferenceDeployment.velm6031Face5Manager.RawLightData + ReferenceDeployment.velm6031Face6Manager.RawLightData + ReferenceDeployment.velm6031Face7Manager.RawLightData + ReferenceDeployment.velm6031Face0Manager.IRLightData + ReferenceDeployment.velm6031Face1Manager.IRLightData + ReferenceDeployment.velm6031Face2Manager.IRLightData + ReferenceDeployment.velm6031Face3Manager.IRLightData + ReferenceDeployment.velm6031Face5Manager.IRLightData + ReferenceDeployment.velm6031Face6Manager.IRLightData + ReferenceDeployment.velm6031Face7Manager.IRLightData + ReferenceDeployment.velm6031Face0Manager.ALSLightData + ReferenceDeployment.velm6031Face1Manager.ALSLightData + ReferenceDeployment.velm6031Face2Manager.ALSLightData + ReferenceDeployment.velm6031Face3Manager.ALSLightData + ReferenceDeployment.velm6031Face5Manager.ALSLightData + ReferenceDeployment.velm6031Face6Manager.ALSLightData + ReferenceDeployment.velm6031Face7Manager.ALSLightData + } + } omit { CdhCore.cmdDisp.CommandErrors # Only has one library, no custom versions diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 0d8c4f02..60e30d6f 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -91,6 +91,13 @@ module ReferenceDeployment { instance tmp112BattCell4Manager instance resetManager instance modeManager + instance velm6031Face0Manager + instance velm6031Face1Manager + instance velm6031Face2Manager + instance velm6031Face3Manager + instance velm6031Face5Manager + instance velm6031Face6Manager + instance velm6031Face7Manager # ---------------------------------------------------------------------- diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 38f32886..45302ea6 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -13,7 +13,7 @@ constant PassiveRateGroupOutputPorts = 10 constant RateGroupDriverRateGroupPorts = 3 @ Used for command and registration ports -constant CmdDispatcherComponentCommandPorts = 30 +constant CmdDispatcherComponentCommandPorts = 36 @ Used for uplink/sequencer buffer/response ports constant CmdDispatcherSequencePorts = 5 From c52a18d1a0f510ac44e334643737173dd89d0fb7 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 22:10:39 -0600 Subject: [PATCH 43/68] It's building... --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 129 +++++++++++++----- .../Drv/Tmp112Manager/TMP112Manager.fpp | 25 ++-- .../Drv/Tmp112Manager/TMP112Manager.hpp | 47 +++++-- .../Components/LoadSwitch/LoadSwitch.cpp | 28 +--- .../Components/LoadSwitch/LoadSwitch.fpp | 9 +- .../Components/LoadSwitch/LoadSwitch.hpp | 21 --- .../ThermalManager/ThermalManager.cpp | 82 ++--------- .../ReferenceDeployment/Top/topology.fpp | 47 +++---- 8 files changed, 189 insertions(+), 199 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 579fb41d..e53c0864 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -31,64 +31,127 @@ void TMP112Manager::configure(const struct device* dev) { // Handler implementations for typed input ports // ---------------------------------------------------------------------- -void TMP112Manager ::init_handler(FwIndexType portNum, Fw::Success& condition) { - // if () +Fw::Success TMP112Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& loadSwitchState) { + // Store the load switch state + this->m_load_switch_state = loadSwitchState; + // If the load switch is off, deinitialize the device + if (this->m_load_switch_state == Fw::On::OFF) { + return this->deinitializeDevice(); + } + + // If the load switch is on, set the timeout + // We only consider the load switch to be fully on after a timeout period + this->m_load_switch_on_timeout = this->getTime(); + this->m_load_switch_on_timeout.add(1, 0); + + return Fw::Success::SUCCESS; +} + +F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& condition) { + condition = Fw::Success::FAILURE; + + if (!this->initializeDevice()) { + return 0; + } + + struct sensor_value val; + + int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); + if (rc != 0) { + this->log_WARNING_HI_SensorSampleFetchFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); + + rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &val); + if (rc != 0) { + this->log_WARNING_HI_SensorChannelGetFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); + + F64 temp = sensor_value_to_double(&val); + condition = Fw::Success::SUCCESS; + + this->tlmWrite_Temperature(temp); + + return temp; +} + +bool TMP112Manager ::isDeviceInitialized() { if (!this->m_dev) { - condition = Fw::Success::FAILURE; this->log_WARNING_HI_DeviceNil(); - return; + return false; } this->log_WARNING_HI_DeviceNil_ThrottleClear(); if (!this->m_dev->state) { - condition = Fw::Success::FAILURE; this->log_WARNING_HI_DeviceStateNil(); - return; + return false; } this->log_WARNING_HI_DeviceStateNil_ThrottleClear(); - // Reset the device initialization state to allow device_init to run again. - this->m_dev->state->initialized = false; + return this->m_dev->state->initialized; +} + +Fw::Success TMP112Manager ::initializeDevice() { + if (this->isDeviceInitialized()) { + if (!device_is_ready(this->m_dev)) { + this->log_WARNING_HI_DeviceNotReady(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); + return Fw::Success::SUCCESS; + } + + if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { + this->log_WARNING_HI_TcaUnhealthy(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_TcaUnhealthy_ThrottleClear(); + + if (this->muxHealthGet_out(0) != Fw::Health::HEALTHY) { + this->log_WARNING_HI_MuxUnhealthy(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_MuxUnhealthy_ThrottleClear(); + + if (!this->loadSwitchReady()) { + this->log_WARNING_HI_LoadSwitchNotReady(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_LoadSwitchNotReady_ThrottleClear(); int rc = device_init(this->m_dev); if (rc < 0) { - condition = Fw::Success::FAILURE; this->log_WARNING_HI_DeviceInitFailed(rc); - return; + return Fw::Success::FAILURE; } this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); - // this->m_initialized = true; // This cannot be used until it can be set false when the load switch is turned off. - condition = Fw::Success::SUCCESS; + return Fw::Success::SUCCESS; } -F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum) { - if (!device_is_ready(this->m_dev)) { - this->log_WARNING_HI_DeviceNotReady(); - return 0; - } - this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); - - struct sensor_value temp; - - int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); - if (rc != 0) { - this->log_WARNING_HI_SensorSampleFetchFailed(rc); - return 0; +Fw::Success TMP112Manager ::deinitializeDevice() { + if (!this->m_dev) { + this->log_WARNING_HI_DeviceNil(); + return Fw::Success::FAILURE; } - this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); + this->log_WARNING_HI_DeviceNil_ThrottleClear(); - rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); - if (rc != 0) { - this->log_WARNING_HI_SensorChannelGetFailed(rc); - return 0; + if (!this->m_dev->state) { + this->log_WARNING_HI_DeviceStateNil(); + return Fw::Success::FAILURE; } - this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); + this->log_WARNING_HI_DeviceStateNil_ThrottleClear(); - this->tlmWrite_Temperature(sensor_value_to_double(&temp)); + this->m_dev->state->initialized = false; + Fw::Success::SUCCESS; +} - return sensor_value_to_double(&temp); +bool TMP112Manager ::loadSwitchReady() { + return this->m_load_switch_state == Fw::On::ON && this->getTime() >= this->m_load_switch_on_timeout; } } // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index d9709d34..bec8547a 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -1,26 +1,22 @@ module Drv { - port temperatureGet -> F64 - port initialized -> bool + port temperatureGet(ref condition: Fw.Success) -> F64 } module Drv { @ Manager for TMP112 device passive component TMP112Manager { # Ports - @ Port to initialize the TMP112 device - sync input port init: Fw.SuccessCondition - @ Port to read the temperature in degrees Celsius sync input port temperatureGet: temperatureGet + @ Port to initialize and deinitialize the TMP112 device on load switch state change + sync input port loadSwitchStateChanged: Components.loadSwitchStateChanged + @ Output port to check device TCA health - output port getTCAHealth: Components.HealthGet + output port tcaHealthGet: Components.HealthGet @ Output port to check device MUX health - output port getMUXHealth: Components.HealthGet - - @ Output port to get load switch state - output port getLoadSwitchState: Components.loadSwitchStateGet + output port muxHealthGet: Components.HealthGet # Telemetry channels @@ -40,6 +36,15 @@ module Drv { @ Event for reporting TMP112 nil state error event DeviceStateNil() severity warning high format "TMP112 device state is nil" throttle 5 + @ Event for reporting TCA unhealthy state + event TcaUnhealthy() severity warning high format "TMP112 TCA device is unhealthy" throttle 5 + + @ Event for reporting MUX unhealthy state + event MuxUnhealthy() severity warning high format "TMP112 MUX device is unhealthy" throttle 5 + + @ Event for reporting Load Switch not ready state + event LoadSwitchNotReady() severity warning high format "TMP112 Load Switch is not ready" throttle 5 + @ Event for reporting TMP112 sensor fetch failure event SensorSampleFetchFailed(ret: I32) severity warning high format "TMP112 sensor fetch failed with return code: {}" throttle 5 diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index 0e44b15b..d182d757 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -27,7 +27,7 @@ class TMP112Manager final : public TMP112ManagerComponentBase { public: // ---------------------------------------------------------------------- - // Helper methods + // Public helper methods // ---------------------------------------------------------------------- //! Configure the TMP112 device @@ -38,38 +38,55 @@ class TMP112Manager final : public TMP112ManagerComponentBase { // Handler implementations for typed input ports // ---------------------------------------------------------------------- - //! Handler implementation for init + //! Handler implementation for loadSwitchStateChanged //! - //! Port to initialize the TMP112 device - //! Must be called and complete successfully at least one time before temperature can be read - void init_handler(FwIndexType portNum, //!< The port number - Fw::Success& condition //!< Condition success/failure - ) override; + //! Port to initialize and deinitialize the TMP112 device on load switch state change + Fw::Success loadSwitchStateChanged_handler(FwIndexType portNum, //!< The port number + const Fw::On& state) override; //! Handler implementation for temperatureGet //! //! Port to read the temperature in degrees Celsius - F64 temperatureGet_handler(FwIndexType portNum //!< The port number - ) override; + F64 temperatureGet_handler(FwIndexType portNum, //!< The port number + Fw::Success& condition) override; + private: + // ---------------------------------------------------------------------- + // Private helper methods + // ---------------------------------------------------------------------- + + //! Initialize the TMP112 device + Fw::Success initializeDevice(); + + //! Deinitialize the TMP112 device + Fw::Success deinitializeDevice(); + + //! Check if the TMP112 device is initialized + bool isDeviceInitialized(); + + //! Check if the load switch is ready (on and timeout passed) + bool loadSwitchReady(); + + private: // ---------------------------------------------------------------------- - // Member variables + // Private member variables // ---------------------------------------------------------------------- //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; //! TCA health state - Fw::Health tca_state = Fw::Health::FAILED; + Fw::Health m_tca_state = Fw::Health::FAILED; //! MUX health state - Fw::Health mux_state = Fw::Health::FAILED; + Fw::Health m_mux_state = Fw::Health::FAILED; //! Load switch state - Fw::On load_switch_state = Fw::On::OFF; + Fw::On m_load_switch_state = Fw::On::OFF; - //! Initialization state - bool m_initialized = false; + //! Load switch on timeout + //! Time when we can consider the load switch to be fully on (giving time for power to normalize) + Fw::Time m_load_switch_on_timeout; }; } // namespace Drv diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index c65511a4..8224d0be 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -22,16 +22,6 @@ LoadSwitch ::~LoadSwitch() {} // Handler implementations for typed input ports // ---------------------------------------------------------------------- -void LoadSwitch ::Reset_handler(FwIndexType portNum) { - this->setLoadSwitchState(Fw::On::OFF); - k_sleep(K_MSEC(100)); - this->setLoadSwitchState(Fw::On::ON); -} - -Fw::On LoadSwitch ::loadSwitchStateGet_handler(FwIndexType portNum) { - return this->getLoadSwitchState() && this->getTime() > this->m_on_timeout ? Fw::On::ON : Fw::On::OFF; -} - void LoadSwitch ::turnOn_handler(FwIndexType portNum) { this->setLoadSwitchState(Fw::On::ON); } @@ -59,23 +49,17 @@ void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { // ---------------------------------------------------------------------- void LoadSwitch ::setLoadSwitchState(Fw::On state) { + // Check if the state is changing if (this->getLoadSwitchState() == state) { - // No change, exit early return; } - Fw::Logic gpioValue = Fw::Logic::LOW; - if (state == Fw::On::ON) { - gpioValue = Fw::Logic::HIGH; - this->m_on_timeout = this->getTime(); - // Start timeout timer for 1 second - // This delay is to allow power to stabilize after turning on the load switch - // TODO(nateinaction): Take delay duration as a parameter - // TODO(nateinaction): Is there a non-sleep way to determine if load switched board is ready? - this->m_on_timeout.add(1, 0); - } - + // Set the load switch state + Fw::Logic gpioValue = state ? Fw::Logic::HIGH : Fw::Logic::LOW; this->gpioSet_out(0, gpioValue); + + // Inform downstream components of the state change + this->loadSwitchStateChanged_out(0, state); this->log_ACTIVITY_HI_StatusChanged(state); this->tlmWrite_IsOn(state); } diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index d12315e3..27843f80 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -1,5 +1,6 @@ module Components { port loadSwitchStateGet -> Fw.On + port loadSwitchStateChanged($state: Fw.On) -> Fw.Success } module Components { @@ -25,10 +26,7 @@ module Components { output port gpioGet: Drv.GpioRead @ Port to indicate a change in load switch state - output port loadSwitchStateChanged: Components.loadSwitchStateGet - - @ Input port to reset the load switch (called by other components) - sync input port Reset: Fw.Signal + output port loadSwitchStateChanged: loadSwitchStateChanged @ Input port to turn on the load switch (called by other components) sync input port turnOn: Fw.Signal @@ -36,9 +34,6 @@ module Components { @ Input port to turn off the load switch (called by other components) sync input port turnOff: Fw.Signal - @ Input port to get the state of the load switch (called by other components) - sync input port loadSwitchStateGet: loadSwitchStateGet - ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # ############################################################################### diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 837d0cfa..8d89265d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -43,22 +43,6 @@ class LoadSwitch final : public LoadSwitchComponentBase { U32 cmdSeq //!< The command sequence number ) override; - // ---------------------------------------------------------------------- - // Handler implementations for typed input ports - // ---------------------------------------------------------------------- - - //! Handler implementation for Reset - void Reset_handler(FwIndexType portNum //!< The port number - ) override; - - //! Handler implementation for loadSwitchStateGet - //! - //! Input port to get the state of the load switch (called by other components) - //! We need to wait for power to normalize after turning on the load switch - //! so we check the current time against a timeout - Fw::On loadSwitchStateGet_handler(FwIndexType portNum //!< The port number - ) override; - //! Handler implementation for turnOn void turnOn_handler(FwIndexType portNum //!< The port number ) override; @@ -77,11 +61,6 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Get current load switch state Fw::On getLoadSwitchState(); //tcaHealthGet_out(0) != Fw::Health::HEALTHY) { - return; - } + this->face0TempGet_out(0, condition); + this->face1TempGet_out(0, condition); + this->face2TempGet_out(0, condition); + this->face3TempGet_out(0, condition); + this->face5TempGet_out(0, condition); - if (this->muxChannel0HealthGet_out(0) == Fw::Health::HEALTHY && - this->face0LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face0Init_out(0, condition); // TODO(nateinaction): If init fails, try deinit? - if (condition == Fw::Success::SUCCESS) { - this->face0TempGet_out(0); - } - } - - if (this->muxChannel1HealthGet_out(0) == Fw::Health::HEALTHY && - this->face1LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face1Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face1TempGet_out(0); - } - } - - if (this->muxChannel2HealthGet_out(0) == Fw::Health::HEALTHY && - this->face2LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face2Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face2TempGet_out(0); - } - } - - if (this->muxChannel3HealthGet_out(0) == Fw::Health::HEALTHY && - this->face3LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face3Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face3TempGet_out(0); - } - } - - if (this->muxChannel5HealthGet_out(0) == Fw::Health::HEALTHY && - this->face5LoadSwitchStateGet_out(0) == Fw::On::ON) { - this->face5Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->face5TempGet_out(0); - } - } - - // If mux channel 4 is not healthy, skip battery cell sensors - if (this->muxChannel4HealthGet_out(0) != Fw::Health::HEALTHY) { - return; - } + // // If mux channel 4 is not healthy, skip battery cell sensors + // if (this->muxChannel4HealthGet_out(0) != Fw::Health::HEALTHY) { + // return; + // } // Battery cell sensors (4 sensors) - this->battCell1Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->battCell1TempGet_out(0); - } - - this->battCell2Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->battCell2TempGet_out(0); - } - - this->battCell3Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->battCell3TempGet_out(0); - } - - this->battCell4Init_out(0, condition); - if (condition == Fw::Success::SUCCESS) { - this->battCell4TempGet_out(0); - } + this->battCell1TempGet_out(0, condition); + this->battCell2TempGet_out(0, condition); + this->battCell3TempGet_out(0, condition); + this->battCell4TempGet_out(0, condition); } } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 60e30d6f..6ecc697b 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -229,18 +229,23 @@ module ReferenceDeployment { face0LoadSwitch.gpioSet -> gpioface0LS.gpioWrite face0LoadSwitch.gpioGet -> gpioface0LS.gpioRead + face0LoadSwitch.loadSwitchStateChanged -> tmp112Face0Manager.loadSwitchStateChanged face1LoadSwitch.gpioSet -> gpioface1LS.gpioWrite face1LoadSwitch.gpioGet -> gpioface1LS.gpioRead + face1LoadSwitch.loadSwitchStateChanged -> tmp112Face1Manager.loadSwitchStateChanged face2LoadSwitch.gpioSet -> gpioface2LS.gpioWrite face2LoadSwitch.gpioGet -> gpioface2LS.gpioRead + face2LoadSwitch.loadSwitchStateChanged -> tmp112Face2Manager.loadSwitchStateChanged face3LoadSwitch.gpioSet -> gpioface3LS.gpioWrite face3LoadSwitch.gpioGet -> gpioface3LS.gpioRead + face3LoadSwitch.loadSwitchStateChanged -> tmp112Face3Manager.loadSwitchStateChanged face5LoadSwitch.gpioSet -> gpioface5LS.gpioWrite face5LoadSwitch.gpioGet -> gpioface5LS.gpioRead + face5LoadSwitch.loadSwitchStateChanged -> tmp112Face5Manager.loadSwitchStateChanged payloadPowerLoadSwitch.gpioSet -> gpioPayloadPowerLS.gpioWrite payloadPowerLoadSwitch.gpioGet -> gpioPayloadPowerLS.gpioRead @@ -286,45 +291,41 @@ module ReferenceDeployment { powerMonitor.solPowerGet -> ina219SolManager.powerGet } - connections thermalMonitor { - thermalManager.tcaHealthGet -> tcaMonitor.healthGet - - thermalManager.muxChannel0HealthGet -> muxChannel0Monitor.healthGet - thermalManager.face0LoadSwitchStateGet -> face0LoadSwitch.loadSwitchStateGet - thermalManager.face0Init -> tmp112Face0Manager.init + connections thermalManager { + tmp112Face0Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112Face0Manager.muxHealthGet -> muxChannel0Monitor.healthGet thermalManager.face0TempGet -> tmp112Face0Manager.temperatureGet - thermalManager.muxChannel1HealthGet -> muxChannel1Monitor.healthGet - thermalManager.face1LoadSwitchStateGet -> face1LoadSwitch.loadSwitchStateGet - thermalManager.face1Init -> tmp112Face1Manager.init + tmp112Face1Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112Face1Manager.muxHealthGet -> muxChannel1Monitor.healthGet thermalManager.face1TempGet -> tmp112Face1Manager.temperatureGet - thermalManager.muxChannel2HealthGet -> muxChannel2Monitor.healthGet - thermalManager.face2LoadSwitchStateGet -> face2LoadSwitch.loadSwitchStateGet - thermalManager.face2Init -> tmp112Face2Manager.init + tmp112Face2Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112Face2Manager.muxHealthGet -> muxChannel2Monitor.healthGet thermalManager.face2TempGet -> tmp112Face2Manager.temperatureGet - thermalManager.muxChannel3HealthGet -> muxChannel3Monitor.healthGet - thermalManager.face3LoadSwitchStateGet -> face3LoadSwitch.loadSwitchStateGet - thermalManager.face3Init -> tmp112Face3Manager.init + tmp112Face3Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112Face3Manager.muxHealthGet -> muxChannel3Monitor.healthGet thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet - thermalManager.muxChannel5HealthGet -> muxChannel5Monitor.healthGet - thermalManager.face5LoadSwitchStateGet -> face5LoadSwitch.loadSwitchStateGet - thermalManager.face5Init -> tmp112Face5Manager.init + tmp112Face5Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112Face5Manager.muxHealthGet -> muxChannel5Monitor.healthGet thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet - thermalManager.muxChannel4HealthGet -> muxChannel4Monitor.healthGet - thermalManager.battCell1Init -> tmp112BattCell1Manager.init + tmp112BattCell1Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112BattCell1Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell1TempGet -> tmp112BattCell1Manager.temperatureGet - thermalManager.battCell2Init -> tmp112BattCell2Manager.init + tmp112BattCell2Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112BattCell2Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell2TempGet -> tmp112BattCell2Manager.temperatureGet - thermalManager.battCell3Init -> tmp112BattCell3Manager.init + tmp112BattCell3Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112BattCell3Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell3TempGet -> tmp112BattCell3Manager.temperatureGet - thermalManager.battCell4Init -> tmp112BattCell4Manager.init + tmp112BattCell4Manager.tcaHealthGet -> tcaMonitor.healthGet + tmp112BattCell4Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCell4TempGet -> tmp112BattCell4Manager.temperatureGet } From 8f76f8764ed1922dc099a646aaf4c086e71cdc2e Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 22:25:29 -0600 Subject: [PATCH 44/68] Defer init for all devices on mux --- .../proves_flight_control_board_v5.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 4a3b310a..11c71b5b 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -305,21 +305,25 @@ zephyr_udc0: &usbd { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + zephyr,deferred-init; }; batt_cell2_temp_sens: tmp112@49 { compatible = "ti,tmp112"; reg = <0x49>; status = "okay"; + zephyr,deferred-init; }; batt_cell3_temp_sens: tmp112@4a { compatible = "ti,tmp112"; reg = <0x4a>; status = "okay"; + zephyr,deferred-init; }; batt_cell4_temp_sens: tmp112@4b { compatible = "ti,tmp112"; reg = <0x4b>; status = "okay"; + zephyr,deferred-init; }; }; @@ -412,6 +416,7 @@ zephyr_udc0: &usbd { reg = <0x29>; status = "okay"; label = "FACE7_VEML6031"; + zephyr,deferred-init; }; }; }; From 835381007ba1f2f451d5fac15aacb6c8f7da2719 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 23:04:59 -0600 Subject: [PATCH 45/68] Defer init for all devices on mux --- .../proves_flight_control_board_v5.dtsi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 11c71b5b..9eb859c4 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -305,24 +305,28 @@ zephyr_udc0: &usbd { compatible = "ti,tmp112"; reg = <0x48>; status = "okay"; + label = "BATT_CELL1_TMP112"; zephyr,deferred-init; }; batt_cell2_temp_sens: tmp112@49 { compatible = "ti,tmp112"; reg = <0x49>; status = "okay"; + la bel = "BATT_CELL2_TMP112"; zephyr,deferred-init; }; batt_cell3_temp_sens: tmp112@4a { compatible = "ti,tmp112"; reg = <0x4a>; status = "okay"; + label = "BATT_CELL3_TMP112"; zephyr,deferred-init; }; batt_cell4_temp_sens: tmp112@4b { compatible = "ti,tmp112"; reg = <0x4b>; status = "okay"; + label = "BATT_CELL4_TMP112"; zephyr,deferred-init; }; }; @@ -403,7 +407,7 @@ zephyr_udc0: &usbd { }; - // Top is always powered so no deferred init needed + // Top cap mux_channel_7: i2c_mux@7 { compatible = "ti,tca9548a-channel"; label = "mux_channel_7"; From d4cc09825ebb9450fe9f21897a64e30ff63fa5ae Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 23:33:17 -0600 Subject: [PATCH 46/68] syncing latest from device tree branch --- ...roves_flight_control_board_v5-pinctrl.dtsi | 20 +++++++++++++++++++ .../proves_flight_control_board_v5.dtsi | 6 +++--- ...ht_control_board_v5d_rp2350a_m33_defconfig | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5-pinctrl.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5-pinctrl.dtsi index 48167dd4..ce52e817 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5-pinctrl.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5-pinctrl.dtsi @@ -11,6 +11,26 @@ input-enable; }; }; + uart0_default: uart0_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + uart1_default: uart1_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; spi1_default: spi1_default { group1 { pinmux = , ; diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 9eb859c4..6c2544d3 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -306,14 +306,14 @@ zephyr_udc0: &usbd { reg = <0x48>; status = "okay"; label = "BATT_CELL1_TMP112"; - zephyr,deferred-init; + zephyr,deferred-init; }; batt_cell2_temp_sens: tmp112@49 { compatible = "ti,tmp112"; reg = <0x49>; status = "okay"; - la bel = "BATT_CELL2_TMP112"; - zephyr,deferred-init; + label = "BATT_CELL2_TMP112"; + zephyr,deferred-init; }; batt_cell3_temp_sens: tmp112@4a { compatible = "ti,tmp112"; diff --git a/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig b/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig index 818e1062..daaf56bd 100644 --- a/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig +++ b/boards/bronco_space/proves_flight_control_board_v5d/proves_flight_control_board_v5d_rp2350a_m33_defconfig @@ -26,6 +26,7 @@ CONFIG_LSM6DSO_ENABLE_TEMP=y CONFIG_LIS2MDL=y CONFIG_INA219=y CONFIG_TMP112=y +CONFIG_VEML6031=y # Radio CONFIG_LORA=y From 7dd9052db46d443fca31e814ee6e34f19bf36725 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 23:49:05 -0600 Subject: [PATCH 47/68] latest from loadswitch branch --- .../Components/LoadSwitch/docs/sdd.md | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md index 51d9dec6..ac5053f2 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -1,18 +1,36 @@ # Components::LoadSwitch -![LoadSwitch](LoadSwitch.svg) - ## Overview The `LoadSwitch` component is an active F' component that controls a single load switch output through the `gpioSet` output port (connected to the platform's GPIO driver). It exposes two -async commands to turn the switch on and off, telemetry reporting the current state, and an -async `Reset` input which toggles the switch (off, short delay, on). +async commands to turn the switch on and off, telemetry reporting the current state. It also provides ports to control the switch and notify other components of state changes. ## Responsibility - Control the power rail for a connected peripheral by asserting/deasserting a GPIO. - Report state changes via an event and telemetry channel. +- Provide an interface for other components to control the switch and subscribe to state changes. + +## Class Diagram + +```mermaid +classDiagram + namespace Components { + class LoadSwitchComponentBase { + <> + } + class LoadSwitch { + + LoadSwitch(const char* compName) + + ~LoadSwitch() + - TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq): void + - TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq): void + - turnOn_handler(FwIndexType portNum): void + - turnOff_handler(FwIndexType portNum): void + } + } + LoadSwitchComponentBase <|-- LoadSwitch : inherits +``` ## External interface @@ -27,7 +45,7 @@ async `Reset` input which toggles the switch (off, short delay, on). | Name | Type | Description | |---|---:|---| -| IsOn | Fw.On | Current power state; written after commands and on Reset handling. | +| IsOn | Fw.On | Current power state; written after commands. Note: Reports ON only after a stabilization delay (default 1s) following the turn-on command. | ### Events @@ -35,15 +53,28 @@ async `Reset` input which toggles the switch (off, short delay, on). |---|---|---:|---| | StatusChanged | activity high | 1 | "Load switch state changed to {}" | -The component logs the `StatusChanged` event whenever the switch transitions due to a command or a Reset. +The component logs the `StatusChanged` event whenever the switch transitions due to a command. ### Ports | Port name | Direction | Port type | Notes | |---|---|---|---| | gpioSet | output | Drv.GpioWrite | Used to write the physical GPIO. Implementation always uses index 0 (`gpioSet_out(0, ...)`). | -| Reset | input (async) | Fw.Signal | Causes the component to perform a hardware reset sequence: LOW -> wait 100ms -> HIGH. | +| gpioGet | output | Drv.GpioRead | Used to read the physical GPIO state. | +| turnOn | input (sync) | Fw.Signal | Turns on the load switch. | +| turnOff | input (sync) | Fw.Signal | Turns off the load switch. | +| loadSwitchStateChanged | output | loadSwitchStateChanged | Notifies connected components when the load switch state changes | + +## Requirements +| Name | Description | Validation | +|---|---|---| +| Control via Command | The component shall allow turning the load switch on and off via ground commands `TURN_ON` and `TURN_OFF`. | Integration test | +| Control via Port | The component shall allow turning the load switch on and off via input ports `turnOn` and `turnOff`. | Verify `turnOn` and `turnOff` port calls change the GPIO state and telemetry. | +| State Telemetry | The component shall report the current state of the load switch via the `IsOn` telemetry channel. | Integration test | +| State Event | The component shall emit a `StatusChanged` event when the load switch state changes. | Verify `StatusChanged` event is emitted upon state transitions. | +| State Notification | The component shall notify connected components of state changes via the `loadSwitchStateChanged` port. | Downstream component testing | +| GPIO Control | The component shall control the physical GPIO pin corresponding to the load switch using the `gpioSet` port. | Downstream component testing | ## Change Log @@ -51,3 +82,4 @@ The component logs the `StatusChanged` event whenever the switch transitions due |---|---| | 10-22-2025 | Sarah, Kevin, and MoMata's first commit | | 11-07-2025 | Updated SDD to match implementation in `LoadSwitch.cpp/.hpp/.fpp` (commands, telemetry, event, ports, reset behavior). | +| 11-30-2025 | Removed Reset capability. Added `loadSwitchStateChanged` output port for state notifications. | From 8c8f4a8f9b767a4e267c2dc4350f827a8e897eae Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 30 Nov 2025 23:53:21 -0600 Subject: [PATCH 48/68] Running --- .../ReferenceDeployment/Main.cpp | 14 +++--- .../Top/ReferenceDeploymentPackets.fppi | 46 +++++++++---------- .../Top/ReferenceDeploymentTopology.cpp | 14 +++--- .../Top/ReferenceDeploymentTopologyDefs.hpp | 14 +++--- .../ReferenceDeployment/Top/instances.fpp | 14 +++--- .../ReferenceDeployment/Top/topology.fpp | 14 +++--- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 16b871ce..cd707337 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -85,13 +85,13 @@ int main(int argc, char* argv[]) { inputs.battCell3TempDevice = batt_cell3_temp_sens; inputs.battCell4TempDevice = batt_cell4_temp_sens; // Light sensor devices - inputs.face0LightDevice = face0_light_sens; - inputs.face1LightDevice = face1_light_sens; - inputs.face2LightDevice = face2_light_sens; - inputs.face3LightDevice = face3_light_sens; - inputs.face5LightDevice = face5_light_sens; - inputs.face6LightDevice = face6_light_sens; - inputs.face7LightDevice = face7_light_sens; + // inputs.face0LightDevice = face0_light_sens; + // inputs.face1LightDevice = face1_light_sens; + // inputs.face2LightDevice = face2_light_sens; + // inputs.face3LightDevice = face3_light_sens; + // inputs.face5LightDevice = face5_light_sens; + // inputs.face6LightDevice = face6_light_sens; + // inputs.face7LightDevice = face7_light_sens; inputs.baudRate = 115200; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 5da15f16..9088f7e0 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -120,29 +120,29 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112BattCell4Manager.Temperature } - packet LightSensor id 14 group 4 { - ReferenceDeployment.velm6031Face0Manager.RawLightData - ReferenceDeployment.velm6031Face1Manager.RawLightData - ReferenceDeployment.velm6031Face2Manager.RawLightData - ReferenceDeployment.velm6031Face3Manager.RawLightData - ReferenceDeployment.velm6031Face5Manager.RawLightData - ReferenceDeployment.velm6031Face6Manager.RawLightData - ReferenceDeployment.velm6031Face7Manager.RawLightData - ReferenceDeployment.velm6031Face0Manager.IRLightData - ReferenceDeployment.velm6031Face1Manager.IRLightData - ReferenceDeployment.velm6031Face2Manager.IRLightData - ReferenceDeployment.velm6031Face3Manager.IRLightData - ReferenceDeployment.velm6031Face5Manager.IRLightData - ReferenceDeployment.velm6031Face6Manager.IRLightData - ReferenceDeployment.velm6031Face7Manager.IRLightData - ReferenceDeployment.velm6031Face0Manager.ALSLightData - ReferenceDeployment.velm6031Face1Manager.ALSLightData - ReferenceDeployment.velm6031Face2Manager.ALSLightData - ReferenceDeployment.velm6031Face3Manager.ALSLightData - ReferenceDeployment.velm6031Face5Manager.ALSLightData - ReferenceDeployment.velm6031Face6Manager.ALSLightData - ReferenceDeployment.velm6031Face7Manager.ALSLightData - } + # packet LightSensor id 14 group 4 { + # ReferenceDeployment.velm6031Face0Manager.RawLightData + # ReferenceDeployment.velm6031Face1Manager.RawLightData + # ReferenceDeployment.velm6031Face2Manager.RawLightData + # ReferenceDeployment.velm6031Face3Manager.RawLightData + # ReferenceDeployment.velm6031Face5Manager.RawLightData + # ReferenceDeployment.velm6031Face6Manager.RawLightData + # ReferenceDeployment.velm6031Face7Manager.RawLightData + # ReferenceDeployment.velm6031Face0Manager.IRLightData + # ReferenceDeployment.velm6031Face1Manager.IRLightData + # ReferenceDeployment.velm6031Face2Manager.IRLightData + # ReferenceDeployment.velm6031Face3Manager.IRLightData + # ReferenceDeployment.velm6031Face5Manager.IRLightData + # ReferenceDeployment.velm6031Face6Manager.IRLightData + # ReferenceDeployment.velm6031Face7Manager.IRLightData + # ReferenceDeployment.velm6031Face0Manager.ALSLightData + # ReferenceDeployment.velm6031Face1Manager.ALSLightData + # ReferenceDeployment.velm6031Face2Manager.ALSLightData + # ReferenceDeployment.velm6031Face3Manager.ALSLightData + # ReferenceDeployment.velm6031Face5Manager.ALSLightData + # ReferenceDeployment.velm6031Face6Manager.ALSLightData + # ReferenceDeployment.velm6031Face7Manager.ALSLightData + # } } omit { CdhCore.cmdDisp.CommandErrors diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index fb86d6ee..1b7c61d2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -142,13 +142,13 @@ void setupTopology(const TopologyState& state) { tmp112BattCell4Manager.configure(state.battCell4TempDevice); // Configure all 7 VELM6031 light sensor managers - velm6031Face0Manager.configure(state.face0LightDevice); - velm6031Face1Manager.configure(state.face1LightDevice); - velm6031Face2Manager.configure(state.face2LightDevice); - velm6031Face3Manager.configure(state.face3LightDevice); - velm6031Face5Manager.configure(state.face5LightDevice); - velm6031Face6Manager.configure(state.face6LightDevice); - velm6031Face7Manager.configure(state.face7LightDevice); + // velm6031Face0Manager.configure(state.face0LightDevice); + // velm6031Face1Manager.configure(state.face1LightDevice); + // velm6031Face2Manager.configure(state.face2LightDevice); + // velm6031Face3Manager.configure(state.face3LightDevice); + // velm6031Face5Manager.configure(state.face5LightDevice); + // velm6031Face6Manager.configure(state.face6LightDevice); + // velm6031Face7Manager.configure(state.face7LightDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 19d72cea..64c587ca 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -106,13 +106,13 @@ struct TopologyState { const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 // - Light sensors - const device* face0LightDevice; //!< Light sensor device for cube face 0 - const device* face1LightDevice; //!< Light sensor device for cube face 1 - const device* face2LightDevice; //!< Light sensor device for cube face 2 - const device* face3LightDevice; //!< Light sensor device for cube face 3 - const device* face5LightDevice; //!< Light sensor device for cube face 5 - const device* face6LightDevice; //!< Light sensor device for cube face 6 - const device* face7LightDevice; //!< Light sensor device for cube face 7 + // const device* face0LightDevice; //!< Light sensor device for cube face 0 + // const device* face1LightDevice; //!< Light sensor device for cube face 1 + // const device* face2LightDevice; //!< Light sensor device for cube face 2 + // const device* face3LightDevice; //!< Light sensor device for cube face 3 + // const device* face5LightDevice; //!< Light sensor device for cube face 5 + // const device* face6LightDevice; //!< Light sensor device for cube face 6 + // const device* face7LightDevice; //!< Light sensor device for cube face 7 }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index ebc2e188..6ec14d5f 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -185,18 +185,18 @@ module ReferenceDeployment { instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10053000 - instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 + # instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 - instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 + # instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 - instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 + # instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 - instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 + # instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 - instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 + # instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 - instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 + # instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 - instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 + # instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 6ecc697b..4b1e9ec5 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -91,13 +91,13 @@ module ReferenceDeployment { instance tmp112BattCell4Manager instance resetManager instance modeManager - instance velm6031Face0Manager - instance velm6031Face1Manager - instance velm6031Face2Manager - instance velm6031Face3Manager - instance velm6031Face5Manager - instance velm6031Face6Manager - instance velm6031Face7Manager + # instance velm6031Face0Manager + # instance velm6031Face1Manager + # instance velm6031Face2Manager + # instance velm6031Face3Manager + # instance velm6031Face5Manager + # instance velm6031Face6Manager + # instance velm6031Face7Manager # ---------------------------------------------------------------------- From 6b8653028bc70a3507d7a573fa27f9231ad818cc Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 00:02:49 -0600 Subject: [PATCH 49/68] Revert "Running" This reverts commit 8c8f4a8f9b767a4e267c2dc4350f827a8e897eae. --- .../ReferenceDeployment/Main.cpp | 14 +++--- .../Top/ReferenceDeploymentPackets.fppi | 46 +++++++++---------- .../Top/ReferenceDeploymentTopology.cpp | 14 +++--- .../Top/ReferenceDeploymentTopologyDefs.hpp | 14 +++--- .../ReferenceDeployment/Top/instances.fpp | 14 +++--- .../ReferenceDeployment/Top/topology.fpp | 14 +++--- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index cd707337..16b871ce 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -85,13 +85,13 @@ int main(int argc, char* argv[]) { inputs.battCell3TempDevice = batt_cell3_temp_sens; inputs.battCell4TempDevice = batt_cell4_temp_sens; // Light sensor devices - // inputs.face0LightDevice = face0_light_sens; - // inputs.face1LightDevice = face1_light_sens; - // inputs.face2LightDevice = face2_light_sens; - // inputs.face3LightDevice = face3_light_sens; - // inputs.face5LightDevice = face5_light_sens; - // inputs.face6LightDevice = face6_light_sens; - // inputs.face7LightDevice = face7_light_sens; + inputs.face0LightDevice = face0_light_sens; + inputs.face1LightDevice = face1_light_sens; + inputs.face2LightDevice = face2_light_sens; + inputs.face3LightDevice = face3_light_sens; + inputs.face5LightDevice = face5_light_sens; + inputs.face6LightDevice = face6_light_sens; + inputs.face7LightDevice = face7_light_sens; inputs.baudRate = 115200; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 9088f7e0..5da15f16 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -120,29 +120,29 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112BattCell4Manager.Temperature } - # packet LightSensor id 14 group 4 { - # ReferenceDeployment.velm6031Face0Manager.RawLightData - # ReferenceDeployment.velm6031Face1Manager.RawLightData - # ReferenceDeployment.velm6031Face2Manager.RawLightData - # ReferenceDeployment.velm6031Face3Manager.RawLightData - # ReferenceDeployment.velm6031Face5Manager.RawLightData - # ReferenceDeployment.velm6031Face6Manager.RawLightData - # ReferenceDeployment.velm6031Face7Manager.RawLightData - # ReferenceDeployment.velm6031Face0Manager.IRLightData - # ReferenceDeployment.velm6031Face1Manager.IRLightData - # ReferenceDeployment.velm6031Face2Manager.IRLightData - # ReferenceDeployment.velm6031Face3Manager.IRLightData - # ReferenceDeployment.velm6031Face5Manager.IRLightData - # ReferenceDeployment.velm6031Face6Manager.IRLightData - # ReferenceDeployment.velm6031Face7Manager.IRLightData - # ReferenceDeployment.velm6031Face0Manager.ALSLightData - # ReferenceDeployment.velm6031Face1Manager.ALSLightData - # ReferenceDeployment.velm6031Face2Manager.ALSLightData - # ReferenceDeployment.velm6031Face3Manager.ALSLightData - # ReferenceDeployment.velm6031Face5Manager.ALSLightData - # ReferenceDeployment.velm6031Face6Manager.ALSLightData - # ReferenceDeployment.velm6031Face7Manager.ALSLightData - # } + packet LightSensor id 14 group 4 { + ReferenceDeployment.velm6031Face0Manager.RawLightData + ReferenceDeployment.velm6031Face1Manager.RawLightData + ReferenceDeployment.velm6031Face2Manager.RawLightData + ReferenceDeployment.velm6031Face3Manager.RawLightData + ReferenceDeployment.velm6031Face5Manager.RawLightData + ReferenceDeployment.velm6031Face6Manager.RawLightData + ReferenceDeployment.velm6031Face7Manager.RawLightData + ReferenceDeployment.velm6031Face0Manager.IRLightData + ReferenceDeployment.velm6031Face1Manager.IRLightData + ReferenceDeployment.velm6031Face2Manager.IRLightData + ReferenceDeployment.velm6031Face3Manager.IRLightData + ReferenceDeployment.velm6031Face5Manager.IRLightData + ReferenceDeployment.velm6031Face6Manager.IRLightData + ReferenceDeployment.velm6031Face7Manager.IRLightData + ReferenceDeployment.velm6031Face0Manager.ALSLightData + ReferenceDeployment.velm6031Face1Manager.ALSLightData + ReferenceDeployment.velm6031Face2Manager.ALSLightData + ReferenceDeployment.velm6031Face3Manager.ALSLightData + ReferenceDeployment.velm6031Face5Manager.ALSLightData + ReferenceDeployment.velm6031Face6Manager.ALSLightData + ReferenceDeployment.velm6031Face7Manager.ALSLightData + } } omit { CdhCore.cmdDisp.CommandErrors diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 1b7c61d2..fb86d6ee 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -142,13 +142,13 @@ void setupTopology(const TopologyState& state) { tmp112BattCell4Manager.configure(state.battCell4TempDevice); // Configure all 7 VELM6031 light sensor managers - // velm6031Face0Manager.configure(state.face0LightDevice); - // velm6031Face1Manager.configure(state.face1LightDevice); - // velm6031Face2Manager.configure(state.face2LightDevice); - // velm6031Face3Manager.configure(state.face3LightDevice); - // velm6031Face5Manager.configure(state.face5LightDevice); - // velm6031Face6Manager.configure(state.face6LightDevice); - // velm6031Face7Manager.configure(state.face7LightDevice); + velm6031Face0Manager.configure(state.face0LightDevice); + velm6031Face1Manager.configure(state.face1LightDevice); + velm6031Face2Manager.configure(state.face2LightDevice); + velm6031Face3Manager.configure(state.face3LightDevice); + velm6031Face5Manager.configure(state.face5LightDevice); + velm6031Face6Manager.configure(state.face6LightDevice); + velm6031Face7Manager.configure(state.face7LightDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 64c587ca..19d72cea 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -106,13 +106,13 @@ struct TopologyState { const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 // - Light sensors - // const device* face0LightDevice; //!< Light sensor device for cube face 0 - // const device* face1LightDevice; //!< Light sensor device for cube face 1 - // const device* face2LightDevice; //!< Light sensor device for cube face 2 - // const device* face3LightDevice; //!< Light sensor device for cube face 3 - // const device* face5LightDevice; //!< Light sensor device for cube face 5 - // const device* face6LightDevice; //!< Light sensor device for cube face 6 - // const device* face7LightDevice; //!< Light sensor device for cube face 7 + const device* face0LightDevice; //!< Light sensor device for cube face 0 + const device* face1LightDevice; //!< Light sensor device for cube face 1 + const device* face2LightDevice; //!< Light sensor device for cube face 2 + const device* face3LightDevice; //!< Light sensor device for cube face 3 + const device* face5LightDevice; //!< Light sensor device for cube face 5 + const device* face6LightDevice; //!< Light sensor device for cube face 6 + const device* face7LightDevice; //!< Light sensor device for cube face 7 }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 6ec14d5f..ebc2e188 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -185,18 +185,18 @@ module ReferenceDeployment { instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10053000 - # instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 + instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 - # instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 + instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 - # instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 + instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 - # instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 + instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 - # instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 + instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 - # instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 + instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 - # instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 + instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 4b1e9ec5..6ecc697b 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -91,13 +91,13 @@ module ReferenceDeployment { instance tmp112BattCell4Manager instance resetManager instance modeManager - # instance velm6031Face0Manager - # instance velm6031Face1Manager - # instance velm6031Face2Manager - # instance velm6031Face3Manager - # instance velm6031Face5Manager - # instance velm6031Face6Manager - # instance velm6031Face7Manager + instance velm6031Face0Manager + instance velm6031Face1Manager + instance velm6031Face2Manager + instance velm6031Face3Manager + instance velm6031Face5Manager + instance velm6031Face6Manager + instance velm6031Face7Manager # ---------------------------------------------------------------------- From 8a47a2798d1994d5785255013334da1f74082ea2 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 00:13:37 -0600 Subject: [PATCH 50/68] Reapply "Running" This reverts commit 6b8653028bc70a3507d7a573fa27f9231ad818cc. --- .../ReferenceDeployment/Main.cpp | 14 +++--- .../Top/ReferenceDeploymentPackets.fppi | 46 +++++++++---------- .../Top/ReferenceDeploymentTopology.cpp | 14 +++--- .../Top/ReferenceDeploymentTopologyDefs.hpp | 14 +++--- .../ReferenceDeployment/Top/instances.fpp | 14 +++--- .../ReferenceDeployment/Top/topology.fpp | 14 +++--- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 16b871ce..cd707337 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -85,13 +85,13 @@ int main(int argc, char* argv[]) { inputs.battCell3TempDevice = batt_cell3_temp_sens; inputs.battCell4TempDevice = batt_cell4_temp_sens; // Light sensor devices - inputs.face0LightDevice = face0_light_sens; - inputs.face1LightDevice = face1_light_sens; - inputs.face2LightDevice = face2_light_sens; - inputs.face3LightDevice = face3_light_sens; - inputs.face5LightDevice = face5_light_sens; - inputs.face6LightDevice = face6_light_sens; - inputs.face7LightDevice = face7_light_sens; + // inputs.face0LightDevice = face0_light_sens; + // inputs.face1LightDevice = face1_light_sens; + // inputs.face2LightDevice = face2_light_sens; + // inputs.face3LightDevice = face3_light_sens; + // inputs.face5LightDevice = face5_light_sens; + // inputs.face6LightDevice = face6_light_sens; + // inputs.face7LightDevice = face7_light_sens; inputs.baudRate = 115200; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 5da15f16..9088f7e0 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -120,29 +120,29 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112BattCell4Manager.Temperature } - packet LightSensor id 14 group 4 { - ReferenceDeployment.velm6031Face0Manager.RawLightData - ReferenceDeployment.velm6031Face1Manager.RawLightData - ReferenceDeployment.velm6031Face2Manager.RawLightData - ReferenceDeployment.velm6031Face3Manager.RawLightData - ReferenceDeployment.velm6031Face5Manager.RawLightData - ReferenceDeployment.velm6031Face6Manager.RawLightData - ReferenceDeployment.velm6031Face7Manager.RawLightData - ReferenceDeployment.velm6031Face0Manager.IRLightData - ReferenceDeployment.velm6031Face1Manager.IRLightData - ReferenceDeployment.velm6031Face2Manager.IRLightData - ReferenceDeployment.velm6031Face3Manager.IRLightData - ReferenceDeployment.velm6031Face5Manager.IRLightData - ReferenceDeployment.velm6031Face6Manager.IRLightData - ReferenceDeployment.velm6031Face7Manager.IRLightData - ReferenceDeployment.velm6031Face0Manager.ALSLightData - ReferenceDeployment.velm6031Face1Manager.ALSLightData - ReferenceDeployment.velm6031Face2Manager.ALSLightData - ReferenceDeployment.velm6031Face3Manager.ALSLightData - ReferenceDeployment.velm6031Face5Manager.ALSLightData - ReferenceDeployment.velm6031Face6Manager.ALSLightData - ReferenceDeployment.velm6031Face7Manager.ALSLightData - } + # packet LightSensor id 14 group 4 { + # ReferenceDeployment.velm6031Face0Manager.RawLightData + # ReferenceDeployment.velm6031Face1Manager.RawLightData + # ReferenceDeployment.velm6031Face2Manager.RawLightData + # ReferenceDeployment.velm6031Face3Manager.RawLightData + # ReferenceDeployment.velm6031Face5Manager.RawLightData + # ReferenceDeployment.velm6031Face6Manager.RawLightData + # ReferenceDeployment.velm6031Face7Manager.RawLightData + # ReferenceDeployment.velm6031Face0Manager.IRLightData + # ReferenceDeployment.velm6031Face1Manager.IRLightData + # ReferenceDeployment.velm6031Face2Manager.IRLightData + # ReferenceDeployment.velm6031Face3Manager.IRLightData + # ReferenceDeployment.velm6031Face5Manager.IRLightData + # ReferenceDeployment.velm6031Face6Manager.IRLightData + # ReferenceDeployment.velm6031Face7Manager.IRLightData + # ReferenceDeployment.velm6031Face0Manager.ALSLightData + # ReferenceDeployment.velm6031Face1Manager.ALSLightData + # ReferenceDeployment.velm6031Face2Manager.ALSLightData + # ReferenceDeployment.velm6031Face3Manager.ALSLightData + # ReferenceDeployment.velm6031Face5Manager.ALSLightData + # ReferenceDeployment.velm6031Face6Manager.ALSLightData + # ReferenceDeployment.velm6031Face7Manager.ALSLightData + # } } omit { CdhCore.cmdDisp.CommandErrors diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index fb86d6ee..1b7c61d2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -142,13 +142,13 @@ void setupTopology(const TopologyState& state) { tmp112BattCell4Manager.configure(state.battCell4TempDevice); // Configure all 7 VELM6031 light sensor managers - velm6031Face0Manager.configure(state.face0LightDevice); - velm6031Face1Manager.configure(state.face1LightDevice); - velm6031Face2Manager.configure(state.face2LightDevice); - velm6031Face3Manager.configure(state.face3LightDevice); - velm6031Face5Manager.configure(state.face5LightDevice); - velm6031Face6Manager.configure(state.face6LightDevice); - velm6031Face7Manager.configure(state.face7LightDevice); + // velm6031Face0Manager.configure(state.face0LightDevice); + // velm6031Face1Manager.configure(state.face1LightDevice); + // velm6031Face2Manager.configure(state.face2LightDevice); + // velm6031Face3Manager.configure(state.face3LightDevice); + // velm6031Face5Manager.configure(state.face5LightDevice); + // velm6031Face6Manager.configure(state.face6LightDevice); + // velm6031Face7Manager.configure(state.face7LightDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 19d72cea..64c587ca 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -106,13 +106,13 @@ struct TopologyState { const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 // - Light sensors - const device* face0LightDevice; //!< Light sensor device for cube face 0 - const device* face1LightDevice; //!< Light sensor device for cube face 1 - const device* face2LightDevice; //!< Light sensor device for cube face 2 - const device* face3LightDevice; //!< Light sensor device for cube face 3 - const device* face5LightDevice; //!< Light sensor device for cube face 5 - const device* face6LightDevice; //!< Light sensor device for cube face 6 - const device* face7LightDevice; //!< Light sensor device for cube face 7 + // const device* face0LightDevice; //!< Light sensor device for cube face 0 + // const device* face1LightDevice; //!< Light sensor device for cube face 1 + // const device* face2LightDevice; //!< Light sensor device for cube face 2 + // const device* face3LightDevice; //!< Light sensor device for cube face 3 + // const device* face5LightDevice; //!< Light sensor device for cube face 5 + // const device* face6LightDevice; //!< Light sensor device for cube face 6 + // const device* face7LightDevice; //!< Light sensor device for cube face 7 }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index ebc2e188..6ec14d5f 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -185,18 +185,18 @@ module ReferenceDeployment { instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10053000 - instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 + # instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 - instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 + # instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 - instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 + # instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 - instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 + # instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 - instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 + # instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 - instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 + # instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 - instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 + # instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 6ecc697b..4b1e9ec5 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -91,13 +91,13 @@ module ReferenceDeployment { instance tmp112BattCell4Manager instance resetManager instance modeManager - instance velm6031Face0Manager - instance velm6031Face1Manager - instance velm6031Face2Manager - instance velm6031Face3Manager - instance velm6031Face5Manager - instance velm6031Face6Manager - instance velm6031Face7Manager + # instance velm6031Face0Manager + # instance velm6031Face1Manager + # instance velm6031Face2Manager + # instance velm6031Face3Manager + # instance velm6031Face5Manager + # instance velm6031Face6Manager + # instance velm6031Face7Manager # ---------------------------------------------------------------------- From c2ffb68dc340cbebad84d7da44117f7d161a0703 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 00:13:51 -0600 Subject: [PATCH 51/68] capitalization --- .../Drv/Tmp112Manager/CMakeLists.txt | 10 ++++---- .../Drv/Tmp112Manager/TMP112Manager.cpp | 24 +++++++++---------- .../Drv/Tmp112Manager/TMP112Manager.fpp | 2 +- .../Drv/Tmp112Manager/TMP112Manager.hpp | 20 ++++++++-------- .../ThermalManager/ThermalManager.fpp | 2 +- .../ReferenceDeployment/Top/instances.fpp | 18 +++++++------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt index 744ebde3..30ae031a 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/CMakeLists.txt @@ -16,9 +16,9 @@ register_fprime_library( AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/TMP112Manager.fpp" + "${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager.fpp" SOURCES - "${CMAKE_CURRENT_LIST_DIR}/TMP112Manager.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager.cpp" # DEPENDS # MyPackage_MyOtherModule ) @@ -26,10 +26,10 @@ register_fprime_library( ### Unit Tests ### # register_fprime_ut( # AUTOCODER_INPUTS -# "${CMAKE_CURRENT_LIST_DIR}/TMP112Manager.fpp" +# "${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager.fpp" # SOURCES -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/TMP112ManagerTestMain.cpp" -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/TMP112ManagerTester.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Tmp112ManagerTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Tmp112ManagerTester.cpp" # DEPENDS # STest # For rules-based testing # UT_AUTO_HELPERS diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index e53c0864..073ec350 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -1,9 +1,9 @@ // ====================================================================== -// \title TMP112Manager.cpp -// \brief cpp file for TMP112Manager component implementation class +// \title Tmp112Manager.cpp +// \brief cpp file for Tmp112Manager component implementation class // ====================================================================== -#include "FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp" +#include "FprimeZephyrReference/Components/Drv/Tmp112Manager/Tmp112Manager.hpp" #include @@ -15,15 +15,15 @@ namespace Drv { // Component construction and destruction // ---------------------------------------------------------------------- -TMP112Manager ::TMP112Manager(const char* const compName) : TMP112ManagerComponentBase(compName) {} +Tmp112Manager ::Tmp112Manager(const char* const compName) : Tmp112ManagerComponentBase(compName) {} -TMP112Manager ::~TMP112Manager() {} +Tmp112Manager ::~Tmp112Manager() {} // ---------------------------------------------------------------------- // Helper methods // ---------------------------------------------------------------------- -void TMP112Manager::configure(const struct device* dev) { +void Tmp112Manager::configure(const struct device* dev) { this->m_dev = dev; } @@ -31,7 +31,7 @@ void TMP112Manager::configure(const struct device* dev) { // Handler implementations for typed input ports // ---------------------------------------------------------------------- -Fw::Success TMP112Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& loadSwitchState) { +Fw::Success Tmp112Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& loadSwitchState) { // Store the load switch state this->m_load_switch_state = loadSwitchState; @@ -48,7 +48,7 @@ Fw::Success TMP112Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, return Fw::Success::SUCCESS; } -F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& condition) { +F64 Tmp112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& condition) { condition = Fw::Success::FAILURE; if (!this->initializeDevice()) { @@ -79,7 +79,7 @@ F64 TMP112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& con return temp; } -bool TMP112Manager ::isDeviceInitialized() { +bool Tmp112Manager ::isDeviceInitialized() { if (!this->m_dev) { this->log_WARNING_HI_DeviceNil(); return false; @@ -95,7 +95,7 @@ bool TMP112Manager ::isDeviceInitialized() { return this->m_dev->state->initialized; } -Fw::Success TMP112Manager ::initializeDevice() { +Fw::Success Tmp112Manager ::initializeDevice() { if (this->isDeviceInitialized()) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); @@ -133,7 +133,7 @@ Fw::Success TMP112Manager ::initializeDevice() { return Fw::Success::SUCCESS; } -Fw::Success TMP112Manager ::deinitializeDevice() { +Fw::Success Tmp112Manager ::deinitializeDevice() { if (!this->m_dev) { this->log_WARNING_HI_DeviceNil(); return Fw::Success::FAILURE; @@ -150,7 +150,7 @@ Fw::Success TMP112Manager ::deinitializeDevice() { Fw::Success::SUCCESS; } -bool TMP112Manager ::loadSwitchReady() { +bool Tmp112Manager ::loadSwitchReady() { return this->m_load_switch_state == Fw::On::ON && this->getTime() >= this->m_load_switch_on_timeout; } diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index bec8547a..e763e507 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -4,7 +4,7 @@ module Drv { module Drv { @ Manager for TMP112 device - passive component TMP112Manager { + passive component Tmp112Manager { # Ports @ Port to read the temperature in degrees Celsius sync input port temperatureGet: temperatureGet diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index d182d757..2414ae1b 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -1,29 +1,29 @@ // ====================================================================== -// \title TMP112Manager.hpp -// \brief hpp file for TMP112Manager component implementation class +// \title Tmp112Manager.hpp +// \brief hpp file for Tmp112Manager component implementation class // ====================================================================== -#ifndef Drv_TMP112Manager_HPP -#define Drv_TMP112Manager_HPP +#ifndef Drv_Tmp112Manager_HPP +#define Drv_Tmp112Manager_HPP -#include "FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112ManagerComponentAc.hpp" +#include "FprimeZephyrReference/Components/Drv/Tmp112Manager/Tmp112ManagerComponentAc.hpp" #include #include #include namespace Drv { -class TMP112Manager final : public TMP112ManagerComponentBase { +class Tmp112Manager final : public Tmp112ManagerComponentBase { public: // ---------------------------------------------------------------------- // Component construction and destruction // ---------------------------------------------------------------------- - //! Construct TMP112Manager object - TMP112Manager(const char* const compName //!< The component name + //! Construct Tmp112Manager object + Tmp112Manager(const char* const compName //!< The component name ); - //! Destroy TMP112Manager object - ~TMP112Manager(); + //! Destroy Tmp112Manager object + ~Tmp112Manager(); public: // ---------------------------------------------------------------------- diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 39680e77..84836790 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -4,7 +4,7 @@ module Components { passive component ThermalManager { sync input port run: Svc.Sched - # Output ports to TMP112Manager instances + # Output ports to instances @ Port to return the state of the TCA output port tcaHealthGet: Components.HealthGet diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 6ec14d5f..9ea8cf14 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -167,23 +167,23 @@ module ReferenceDeployment { instance thermalManager: Components.ThermalManager base id 0x1004A000 - instance tmp112Face0Manager: Drv.TMP112Manager base id 0x1004B000 + instance tmp112Face0Manager: Drv.Tmp112Manager base id 0x1004B000 - instance tmp112Face1Manager: Drv.TMP112Manager base id 0x1004C000 + instance tmp112Face1Manager: Drv.Tmp112Manager base id 0x1004C000 - instance tmp112Face2Manager: Drv.TMP112Manager base id 0x1004D000 + instance tmp112Face2Manager: Drv.Tmp112Manager base id 0x1004D000 - instance tmp112Face3Manager: Drv.TMP112Manager base id 0x1004E000 + instance tmp112Face3Manager: Drv.Tmp112Manager base id 0x1004E000 - instance tmp112Face5Manager: Drv.TMP112Manager base id 0x1004F000 + instance tmp112Face5Manager: Drv.Tmp112Manager base id 0x1004F000 - instance tmp112BattCell1Manager: Drv.TMP112Manager base id 0x10050000 + instance tmp112BattCell1Manager: Drv.Tmp112Manager base id 0x10050000 - instance tmp112BattCell2Manager: Drv.TMP112Manager base id 0x10051000 + instance tmp112BattCell2Manager: Drv.Tmp112Manager base id 0x10051000 - instance tmp112BattCell3Manager: Drv.TMP112Manager base id 0x10052000 + instance tmp112BattCell3Manager: Drv.Tmp112Manager base id 0x10052000 - instance tmp112BattCell4Manager: Drv.TMP112Manager base id 0x10053000 + instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x10053000 # instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 From fdf689464878a6b3722a32c01d00f7fc1e925491 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 00:30:23 -0600 Subject: [PATCH 52/68] Clean up thermal manager, thanks for the tip Saidi! --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 2 +- .../ThermalManager/ThermalManager.cpp | 23 ++--- .../ThermalManager/ThermalManager.fpp | 95 +------------------ .../ReferenceDeployment/Top/topology.fpp | 18 ++-- 4 files changed, 21 insertions(+), 117 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 073ec350..1db8d3ab 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -147,7 +147,7 @@ Fw::Success Tmp112Manager ::deinitializeDevice() { this->log_WARNING_HI_DeviceStateNil_ThrottleClear(); this->m_dev->state->initialized = false; - Fw::Success::SUCCESS; + return Fw::Success::SUCCESS; } bool Tmp112Manager ::loadSwitchReady() { diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 1ba28f23..5afd2b79 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -22,25 +22,16 @@ ThermalManager::~ThermalManager() {} // ---------------------------------------------------------------------- void ThermalManager::run_handler(FwIndexType portNum, U32 context) { - // Cube face sensors (5 sensors) - Fw::Success condition; // We're not going to act on this condition for now + Fw::Success condition; - this->face0TempGet_out(0, condition); - this->face1TempGet_out(0, condition); - this->face2TempGet_out(0, condition); - this->face3TempGet_out(0, condition); - this->face5TempGet_out(0, condition); - - // // If mux channel 4 is not healthy, skip battery cell sensors - // if (this->muxChannel4HealthGet_out(0) != Fw::Health::HEALTHY) { - // return; - // } + for (FwIndexType i = 0; i < this->getNum_faceTempGet_OutputPorts(); i++) { + this->faceTempGet_out(i, condition); + } // Battery cell sensors (4 sensors) - this->battCell1TempGet_out(0, condition); - this->battCell2TempGet_out(0, condition); - this->battCell3TempGet_out(0, condition); - this->battCell4TempGet_out(0, condition); + for (FwIndexType i = 0; i < this->getNum_battCellTempGet_OutputPorts(); i++) { + this->battCellTempGet_out(i, condition); + } } } // namespace Components diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp index 84836790..f3c73ab7 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.fpp @@ -5,101 +5,14 @@ module Components { sync input port run: Svc.Sched # Output ports to instances - @ Port to return the state of the TCA - output port tcaHealthGet: Components.HealthGet - # XY Boards - - @ Port to return the state of mux channel 0 - output port muxChannel0HealthGet: Components.HealthGet - - @ Port to return the state of the load switch for face 0 - output port face0LoadSwitchStateGet: Components.loadSwitchStateGet - - @ Port for face 0 temperature sensor initialization - output port face0Init: Fw.SuccessCondition - - @ Port for face 0 temperature sensor - output port face0TempGet: Drv.temperatureGet - - @ Port to return the state of mux channel 1 - output port muxChannel1HealthGet: Components.HealthGet - - @ Port for face 1 load switch state - output port face1LoadSwitchStateGet: Components.loadSwitchStateGet - - @ Port for face 1 temperature sensor initialization - output port face1Init: Fw.SuccessCondition - - @ Port for face 1 temperature sensor - output port face1TempGet: Drv.temperatureGet - - @ Port to return the state of mux channel 2 - output port muxChannel2HealthGet: Components.HealthGet - - @ Port for face 2 load switch state - output port face2LoadSwitchStateGet: Components.loadSwitchStateGet - - @ Port for face 2 temperature sensor initialization - output port face2Init: Fw.SuccessCondition - - @ Port for face 2 temperature sensor - output port face2TempGet: Drv.temperatureGet - - @ Port to return the state of mux channel 3 - output port muxChannel3HealthGet: Components.HealthGet - - @ Port for face 3 load switch state - output port face3LoadSwitchStateGet: Components.loadSwitchStateGet - - @ Port for face 3 temperature sensor initialization - output port face3Init: Fw.SuccessCondition - - @ Port for face 3 temperature sensor - output port face3TempGet: Drv.temperatureGet - - # Z- Board - - @ Port to return the state of mux channel 5 - output port muxChannel5HealthGet: Components.HealthGet - - @ Port for face 5 load switch state - output port face5LoadSwitchStateGet: Components.loadSwitchStateGet - - @ Port for face 5 temperature sensor initialization - output port face5Init: Fw.SuccessCondition - - @ Port for face 5 temperature sensor - output port face5TempGet: Drv.temperatureGet + @ Port for face temperature sensors + output port faceTempGet: [5] Drv.temperatureGet # Battery Cell - @ Port to return the state of mux channel 4 - output port muxChannel4HealthGet: Components.HealthGet - - @ Port for battery cell 1 temperature sensor initialization - output port battCell1Init: Fw.SuccessCondition - - @ Port for battery cell 1 temperature sensor - output port battCell1TempGet: Drv.temperatureGet - - @ Port for battery cell 2 temperature sensor initialization - output port battCell2Init: Fw.SuccessCondition - - @ Port for battery cell 2 temperature sensor - output port battCell2TempGet: Drv.temperatureGet - - @ Port for battery cell 3 temperature sensor initialization - output port battCell3Init: Fw.SuccessCondition - - @ Port for battery cell 3 temperature sensor - output port battCell3TempGet: Drv.temperatureGet - - @ Port for battery cell 4 temperature sensor initialization - output port battCell4Init: Fw.SuccessCondition - - @ Port for battery cell 4 temperature sensor - output port battCell4TempGet: Drv.temperatureGet + @ Port for battery cell temperature sensors + output port battCellTempGet: [4] Drv.temperatureGet ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 4b1e9ec5..9192fcff 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -294,39 +294,39 @@ module ReferenceDeployment { connections thermalManager { tmp112Face0Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112Face0Manager.muxHealthGet -> muxChannel0Monitor.healthGet - thermalManager.face0TempGet -> tmp112Face0Manager.temperatureGet + thermalManager.faceTempGet[0] -> tmp112Face0Manager.temperatureGet tmp112Face1Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112Face1Manager.muxHealthGet -> muxChannel1Monitor.healthGet - thermalManager.face1TempGet -> tmp112Face1Manager.temperatureGet + thermalManager.faceTempGet[1] -> tmp112Face1Manager.temperatureGet tmp112Face2Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112Face2Manager.muxHealthGet -> muxChannel2Monitor.healthGet - thermalManager.face2TempGet -> tmp112Face2Manager.temperatureGet + thermalManager.faceTempGet[2] -> tmp112Face2Manager.temperatureGet tmp112Face3Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112Face3Manager.muxHealthGet -> muxChannel3Monitor.healthGet - thermalManager.face3TempGet -> tmp112Face3Manager.temperatureGet + thermalManager.faceTempGet[3] -> tmp112Face3Manager.temperatureGet tmp112Face5Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112Face5Manager.muxHealthGet -> muxChannel5Monitor.healthGet - thermalManager.face5TempGet -> tmp112Face5Manager.temperatureGet + thermalManager.faceTempGet[4] -> tmp112Face5Manager.temperatureGet tmp112BattCell1Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112BattCell1Manager.muxHealthGet -> muxChannel4Monitor.healthGet - thermalManager.battCell1TempGet -> tmp112BattCell1Manager.temperatureGet + thermalManager.battCellTempGet[0] -> tmp112BattCell1Manager.temperatureGet tmp112BattCell2Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112BattCell2Manager.muxHealthGet -> muxChannel4Monitor.healthGet - thermalManager.battCell2TempGet -> tmp112BattCell2Manager.temperatureGet + thermalManager.battCellTempGet[1] -> tmp112BattCell2Manager.temperatureGet tmp112BattCell3Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112BattCell3Manager.muxHealthGet -> muxChannel4Monitor.healthGet - thermalManager.battCell3TempGet -> tmp112BattCell3Manager.temperatureGet + thermalManager.battCellTempGet[2] -> tmp112BattCell3Manager.temperatureGet tmp112BattCell4Manager.tcaHealthGet -> tcaMonitor.healthGet tmp112BattCell4Manager.muxHealthGet -> muxChannel4Monitor.healthGet - thermalManager.battCell4TempGet -> tmp112BattCell4Manager.temperatureGet + thermalManager.battCellTempGet[3] -> tmp112BattCell4Manager.temperatureGet } connections ModeManager { From c578181e33aeabf6410808adbbe07c20ffefb4cc Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 02:41:53 -0600 Subject: [PATCH 53/68] Fill out VELM6031 functionality --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 4 +- .../Drv/Tmp112Manager/TMP112Manager.fpp | 1 - .../Drv/Velm6031Manager/Velm6031Manager.cpp | 341 +++++++++++++----- .../Drv/Velm6031Manager/Velm6031Manager.fpp | 135 +++++-- .../Drv/Velm6031Manager/Velm6031Manager.hpp | 84 ++++- .../Components/LoadSwitch/LoadSwitch.cpp | 4 +- .../Components/LoadSwitch/LoadSwitch.fpp | 2 +- .../ThermalManager/ThermalManager.cpp | 3 +- .../ReferenceDeployment/Main.cpp | 2 +- .../Top/ReferenceDeploymentPackets.fppi | 34 +- .../Top/ReferenceDeploymentTopology.cpp | 2 +- .../Top/ReferenceDeploymentTopologyDefs.hpp | 2 +- .../ReferenceDeployment/Top/instances.fpp | 14 +- .../ReferenceDeployment/Top/topology.fpp | 13 +- 14 files changed, 453 insertions(+), 188 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 1db8d3ab..1875cc3b 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -31,9 +31,9 @@ void Tmp112Manager::configure(const struct device* dev) { // Handler implementations for typed input ports // ---------------------------------------------------------------------- -Fw::Success Tmp112Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& loadSwitchState) { +Fw::Success Tmp112Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& state) { // Store the load switch state - this->m_load_switch_state = loadSwitchState; + this->m_load_switch_state = state; // If the load switch is off, deinitialize the device if (this->m_load_switch_state == Fw::On::OFF) { diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index e763e507..5eed08dc 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -24,7 +24,6 @@ module Drv { telemetry Temperature: F64 @ Event for reporting TMP112 not ready error - # event DeviceNotReady() severity warning high format "TMP112 device not ready" event DeviceNotReady() severity warning high format "TMP112 device not ready" throttle 5 @ Event for reporting TMP112 initialization failure diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp index da5e1428..55b31375 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp @@ -20,134 +20,277 @@ Velm6031Manager ::Velm6031Manager(const char* const compName) : Velm6031ManagerC Velm6031Manager ::~Velm6031Manager() {} +// ---------------------------------------------------------------------- +// Public helper methods +// ---------------------------------------------------------------------- + void Velm6031Manager ::configure(const struct device* dev) { this->m_dev = dev; } -void Velm6031Manager ::ReadData() { // const struct device *dev, - // Return integer - int ret; +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- - // Sensor value structs for reading data - struct sensor_value light; - struct sensor_value als_raw; - struct sensor_value ir_raw; - struct sensor_value sen; +F32 Velm6031Manager ::ambientLightGet_handler(FwIndexType portNum, Fw::Success& condition) { + condition = Fw::Success::FAILURE; - sen.val2 = 0; + if (!this->initializeDevice()) { + return 0; + } - Fw::ParamValid valid; - sen.val1 = 5; // pass in saying that the parameter is valid + configureSensorAttributes(SENSOR_CHAN_AMBIENT_LIGHT); // ignore return value for now - // Setting the integration time attribute for the light sensor + int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_LIGHT); + if (rc != 0) { + this->log_WARNING_HI_SensorSampleFetchFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); - if (!(this->m_attributes_set)) { - ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_IT, &sen); - if (ret) { - Fw::LogStringArg errMsg("Failed to set it attribute"); - // this->log_WARNING_HI_Velm6031ManagerError(errMsg); - } + struct sensor_value val; + sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_LIGHT, &val); - // Set the sensor attribute for div4 - // sen.val1 = paramGet_DIV4(valid); + F32 lux = sensor_value_to_double(&val); - ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_DIV4, &sen); - if (ret) { - Fw::LogStringArg errMsg("Failed to set div4 attribute"); - // this->log_WARNING_HI_Velm6031ManagerError(errMsg); - } + this->tlmWrite_VisibleLight(lux); - // Set the sensor attribute for the gain - sen.val1 = 0; - ret = sensor_attr_set(this->m_dev, SENSOR_CHAN_LIGHT, (enum sensor_attribute)SENSOR_ATTR_VEML6031_GAIN, &sen); - if (ret) { - Fw::LogStringArg errMsg("Failed to set gain attribute ret"); - // this->log_WARNING_HI_Velm6031ManagerError(errMsg); - } + condition = Fw::Success::SUCCESS; + return lux; +} + +F32 Velm6031Manager ::infraRedLightGet_handler(FwIndexType portNum, Fw::Success& condition) { + condition = Fw::Success::FAILURE; - this->m_attributes_set = true; + if (!this->initializeDevice()) { + return 0; } - // Get the rate - ret = sensor_sample_fetch(this->m_dev); - if ((ret < 0) && (ret != -E2BIG)) { - Fw::LogStringArg errMsg("sample update error"); - // this->log_WARNING_HI_Velm6031ManagerError(errMsg); - // this->log_WARNING_HI_Velm6031ManagerErrorInt(ret); + configureSensorAttributes(SENSOR_CHAN_IR); // ignore return value for now + + int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_IR); + if (rc != 0) { + this->log_WARNING_HI_SensorSampleFetchFailed(rc); + return 0; } + this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); + + struct sensor_value val; + sensor_channel_get(this->m_dev, SENSOR_CHAN_IR, &val); - // Get the light data - sensor_channel_get(this->m_dev, (enum sensor_channel)SENSOR_CHAN_LIGHT, &light); + F32 lux = sensor_value_to_double(&val); - // Get the raw ALS - sensor_channel_get(this->m_dev, (enum sensor_channel)SENSOR_CHAN_VEML6031_ALS_RAW_COUNTS, &als_raw); + this->tlmWrite_InfraRedLight(lux); + + condition = Fw::Success::SUCCESS; + return lux; +} + +Fw::Success Velm6031Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& state) { + // Store the load switch state + this->m_load_switch_state = state; + + // If the load switch is off, deinitialize the device + if (this->m_load_switch_state == Fw::On::OFF) { + return this->deinitializeDevice(); + } - // Get the raw IR - sensor_channel_get(this->m_dev, (enum sensor_channel)SENSOR_CHAN_VEML6031_IR_RAW_COUNTS, &ir_raw); + // If the load switch is on, set the timeout + // We only consider the load switch to be fully on after a timeout period + this->m_load_switch_on_timeout = this->getTime(); + this->m_load_switch_on_timeout.add(1, 0); - this->m_RawLightData = sensor_value_to_double(&light); - this->m_ALSLightData = sensor_value_to_double(&als_raw); - this->m_IRLightData = sensor_value_to_double(&ir_raw); + return Fw::Success::SUCCESS; +} + +F32 Velm6031Manager ::visibleLightGet_handler(FwIndexType portNum, Fw::Success& condition) { + condition = Fw::Success::FAILURE; + + if (!this->initializeDevice()) { + return 0; + } + + configureSensorAttributes(SENSOR_CHAN_LIGHT); // ignore return value for now + + int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_LIGHT); + if (rc != 0) { + this->log_WARNING_HI_SensorSampleFetchFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); + + struct sensor_value val; + sensor_channel_get(this->m_dev, SENSOR_CHAN_LIGHT, &val); + + F32 lux = sensor_value_to_double(&val); + + this->tlmWrite_VisibleLight(lux); + + condition = Fw::Success::SUCCESS; + return lux; } // ---------------------------------------------------------------------- -// Handler implementations for typed input ports +// Private helper methods // ---------------------------------------------------------------------- -void Velm6031Manager ::run_handler(FwIndexType portNum, U32 context) { - Fw::Logic state; - // this->gpioRead_out(portNum, state); - if (state == Fw::Logic::HIGH) { // port call to the gpio driver, pass in a specific pin # - this->ReadData(); - // this->tlmWrite_RawLightData(this->m_RawLightData); - // this->tlmWrite_IRLightData(this->m_IRLightData); - // this->tlmWrite_ALSLightData(this->m_ALSLightData); - } else { - if (this->m_device_init == true) { - this->m_device_init = false; - } - if (state == Fw::Logic::LOW && this->m_attributes_set == true) { - this->m_attributes_set = false; +bool Velm6031Manager ::isDeviceInitialized() { + if (!this->m_dev) { + this->log_WARNING_HI_DeviceNil(); + return false; + } + this->log_WARNING_HI_DeviceNil_ThrottleClear(); + + if (!this->m_dev->state) { + this->log_WARNING_HI_DeviceStateNil(); + return false; + } + this->log_WARNING_HI_DeviceStateNil_ThrottleClear(); + + return this->m_dev->state->initialized; +} + +Fw::Success Velm6031Manager ::initializeDevice() { + if (this->isDeviceInitialized()) { + if (!device_is_ready(this->m_dev)) { + this->log_WARNING_HI_DeviceNotReady(); + return Fw::Success::FAILURE; } + this->log_WARNING_HI_DeviceNotReady_ThrottleClear(); + return Fw::Success::SUCCESS; + } + + if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { + this->log_WARNING_HI_TcaUnhealthy(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_TcaUnhealthy_ThrottleClear(); + + if (this->muxHealthGet_out(0) != Fw::Health::HEALTHY) { + this->log_WARNING_HI_MuxUnhealthy(); + return Fw::Success::FAILURE; } + this->log_WARNING_HI_MuxUnhealthy_ThrottleClear(); + + if (!this->loadSwitchReady()) { + this->log_WARNING_HI_LoadSwitchNotReady(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_LoadSwitchNotReady_ThrottleClear(); + + int rc = device_init(this->m_dev); + if (rc < 0) { + this->log_WARNING_HI_DeviceInitFailed(rc); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_DeviceInitFailed_ThrottleClear(); + + return Fw::Success::SUCCESS; } -void Velm6031Manager::init_handler(FwIndexType portNum) { - // const struct device* mux = DEVICE_DT_GET(DT_NODELABEL(tca9548a)); - // const struct device* channel = DEVICE_DT_GET(DT_NODELABEL(face0_i2c)); - // const struct device* sensor = DEVICE_DT_GET(DT_NODELABEL(face0_light_sens)); - - // if (!mux || !channel || !sensor) { - // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Device DT_NODELABEL missing")); - // return; - // } - - // int ret = device_init(mux); - // if (ret < 0) { - // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("TCA9548A init failed")); - // return; - // } - - // ret = device_init(channel); - // if (ret < 0) { - // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Mux channel init failed")); - // return; - // } - - // ret = device_init(sensor); - // if (ret < 0) { - // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor init failed")); - // // Continue anyway - might still work - // } - - // if (!device_is_ready(sensor)) { - // // this->log_WARNING_HI_Velm6031ManagerError(Fw::LogStringArg("Light sensor not ready after timeout")); - // } - - // this->m_dev = sensor; - // this->m_device_init = true; - - // this->log_ACTIVITY_LO_Velm6031ManagerConfigured(); +Fw::Success Velm6031Manager ::deinitializeDevice() { + if (!this->m_dev) { + this->log_WARNING_HI_DeviceNil(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_DeviceNil_ThrottleClear(); + + if (!this->m_dev->state) { + this->log_WARNING_HI_DeviceStateNil(); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_DeviceStateNil_ThrottleClear(); + + this->m_dev->state->initialized = false; + return Fw::Success::SUCCESS; +} + +bool Velm6031Manager ::loadSwitchReady() { + return this->m_load_switch_state == Fw::On::ON && this->getTime() >= this->m_load_switch_on_timeout; +} + +Fw::Success Velm6031Manager ::setIntegrationTimeAttribute(sensor_channel chan) { + Fw::ParamValid valid; + U8 it = this->paramGet_INTEGRATION_TIME(valid); + if (valid != Fw::ParamValid::VALID) { + this->log_WARNING_HI_InvalidIntegrationTimeParam(it); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_InvalidIntegrationTimeParam_ThrottleClear(); + + struct sensor_value attr; + sensor_value_from_double(&attr, it); + int rc = sensor_attr_set(this->m_dev, chan, (enum sensor_attribute)SENSOR_ATTR_VEML6031_IT, &attr); + if (rc) { + this->log_WARNING_HI_SensorAttrSetFailed(SENSOR_ATTR_VEML6031_IT, it, rc); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_SensorAttrSetFailed_ThrottleClear(); + + return Fw::Success::SUCCESS; +} + +Fw::Success Velm6031Manager ::setGainAttribute(sensor_channel chan) { + Fw::ParamValid valid; + U8 gain = this->paramGet_GAIN(valid); + if (valid != Fw::ParamValid::VALID) { + this->log_WARNING_HI_InvalidGainParam(gain); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_InvalidGainParam_ThrottleClear(); + + struct sensor_value attr; + sensor_value_from_double(&attr, gain); + int rc = sensor_attr_set(this->m_dev, chan, (enum sensor_attribute)SENSOR_ATTR_VEML6031_GAIN, &attr); + if (rc) { + this->log_WARNING_HI_SensorAttrSetFailed(SENSOR_ATTR_VEML6031_GAIN, gain, rc); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_SensorAttrSetFailed_ThrottleClear(); + + return Fw::Success::SUCCESS; +} + +Fw::Success Velm6031Manager ::setDiv4Attribute(sensor_channel chan) { + Fw::ParamValid valid; + U8 div4 = this->paramGet_EFFECTIVE_PHOTODIODE_SIZE(valid); + if (valid != Fw::ParamValid::VALID) { + this->log_WARNING_HI_InvalidDiv4Param(div4); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_InvalidDiv4Param_ThrottleClear(); + + struct sensor_value attr; + sensor_value_from_double(&attr, div4); + int rc = sensor_attr_set(this->m_dev, chan, (enum sensor_attribute)SENSOR_ATTR_VEML6031_DIV4, &attr); + if (rc) { + this->log_WARNING_HI_SensorAttrSetFailed(SENSOR_ATTR_VEML6031_DIV4, div4, rc); + return Fw::Success::FAILURE; + } + this->log_WARNING_HI_SensorAttrSetFailed_ThrottleClear(); + + return Fw::Success::SUCCESS; +} + +Fw::Success Velm6031Manager ::configureSensorAttributes(sensor_channel chan) { + Fw::Success result; + + result = this->setIntegrationTimeAttribute(chan); + if (result != Fw::Success::SUCCESS) { + return result; + } + + result = this->setGainAttribute(chan); + if (result != Fw::Success::SUCCESS) { + return result; + } + + result = this->setDiv4Attribute(chan); + if (result != Fw::Success::SUCCESS) { + return result; + } + + return Fw::Success::SUCCESS; } } // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp index 5ee1e61d..9c2768c9 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp @@ -1,73 +1,134 @@ module Drv { - @ Component for reading light sensor data - port InitPort + port lightGet(ref condition: Fw.Success) -> F32 + + @ Gain settings for VELM6031 sensor + enum GAIN : U8 { + VEML6031_GAIN_1 @< Gain of 1 + VEML6031_GAIN_2 @< Gain of 2 + VEML6031_GAIN_0_66 @< Gain of 0.66 + VEML6031_GAIN_0_5 @< Gain of 0.5 + } + + @ Integration time settings for VELM6031 sensor + enum IT : U8 { + VEML6031_IT_3_125 @< 3.25 ms integration time + VEML6031_IT_6_25 @< 6.25 ms integration time + VEML6031_IT_12_5 @< 12.5 ms integration time + VEML6031_IT_25 @< 25 ms integration time + VEML6031_IT_50 @< 50 ms integration time + VEML6031_IT_100 @< 100 ms integration time + VEML6031_IT_200 @< 200 ms integration time + VEML6031_IT_400 @< 400 ms integration time + VEML6031_IT_800 @< 800 ms integration time + } + + @ Effective photodiode size (DIV4) settings for VELM6031 sensor + enum DIV4 : U8 { + VEML6031_SIZE_4_4 + VEML6031_SIZE_1_4 + } + + @ Ambient Light Sensor (ALS) persistence protect number settings for VELM6031 sensor + enum ALS_PERS : U8 { + VEML60XX_PERS_1 @< Interrupt triggered every ALS reading + VEML60XX_PERS_2 @< Interrupt triggered after 2 consecutive ALS readings out of threshold + VEML60XX_PERS_4 @< Interrupt triggered after 4 consecutive ALS readings out of threshold + VEML60XX_PERS_8 @< Interrupt triggered after 8 consecutive ALS readings out of threshold + } +} +module Drv { passive component Velm6031Manager { #### Parameters #### @ Parameter for setting the gain of the light senors - param GAIN: U32 default 1 + param GAIN: GAIN default GAIN.VEML6031_GAIN_1 + + @ Parameter for setting the integration time (IT) of the light sensors + param INTEGRATION_TIME: IT default IT.VEML6031_IT_100 - @ Parameter for setting the integration time of the light sensors - param INTEGRATION_TIME: U32 default 100 + @ Parameter for setting the effective photodiode size (DIV4) mode of the light sensors + param EFFECTIVE_PHOTODIODE_SIZE: DIV4 default DIV4.VEML6031_SIZE_4_4 - @ Parameter for setting the div4 mode of the light sensors - param DIV4: U32 default 0 + @ Parameter for setting the Ambient Light Sensor (ALS) persistence protect number setting (PERS). + param ALS_PERSISTENCE_PROTECT_NUMBER: ALS_PERS default ALS_PERS.VEML60XX_PERS_1 #### Telemetry #### - @ Telemetry for the raw light sensor data - telemetry RawLightData: F32 + @ Telemetry for the illuminance in the visible spectrum, in lux + telemetry VisibleLight: F32 - @ Telemetry for the IR light sensor data - telemetry IRLightData: F32 + @ Telemetry for the illuminance in the infra-red spectrum, in lux + telemetry InfraRedLight: F32 - @ Telemetry for the ALS light sensor data - telemetry ALSLightData: F32 + @ Telemetry for the ambient illuminance in visible spectrum, in lux + telemetry AmbientLight: F32 #### Ports #### - @ Port for polling the light sensor data - called by rate group - sync input port run: Svc.Sched + @ Port to read the illuminance in visible spectrum, in lux + @ This channel represents the raw measurement counts provided by the sensor ALS register. + @ It is useful for estimating good values for integration time, effective photodiode size + @ and gain attributes in fetch and get mode. + sync input port visibleLightGet: lightGet + + @ Port to read the illuminance in infra-red spectrum, in lux + sync input port infraRedLightGet: lightGet + + @ Port to read the ambient illuminance in visible spectrum, in lux + sync input port ambientLightGet: lightGet + + @ Port to initialize and deinitialize the VELM6031 device on load switch state change + sync input port loadSwitchStateChanged: Components.loadSwitchStateChanged + + @ Output port to check device TCA health + output port tcaHealthGet: Components.HealthGet + + @ Output port to check device MUX health + output port muxHealthGet: Components.HealthGet @ Port for reading gpio status output port gpioRead: Drv.GpioRead - @ Port to tell us when to init the device - sync input port init: InitPort - #### Events #### - @ Event for light sensor errors - event Velm6031ManagerError(log: string) severity warning high format "Light Sensor Error: {}" + @ Event for reporting VELM6031 not ready error + event DeviceNotReady() severity warning high format "VELM6031 device not ready" throttle 5 - event Velm6031ManagerErrorInt(log: U32) severity warning high format "Light Sensor Error: {}" + @ Event for reporting VELM6031 initialization failure + event DeviceInitFailed(ret: I32) severity warning high format "VELM6031 initialization failed with return code: {}" throttle 5 - @ Event for light sensor configuration - event Velm6031ManagerConfigured() severity activity low format "Light Sensor Configured" + @ Event for reporting VELM6031 nil device error + event DeviceNil() severity warning high format "VELM6031 device is nil" throttle 5 - event Velm6031ManagerRead() severity activity low format "Values Read from the Light Sensor" + @ Event for reporting VELM6031 nil state error + event DeviceStateNil() severity warning high format "VELM6031 device state is nil" throttle 5 + @ Event for reporting TCA unhealthy state + event TcaUnhealthy() severity warning high format "VELM6031 TCA device is unhealthy" throttle 5 + @ Event for reporting MUX unhealthy state + event MuxUnhealthy() severity warning high format "VELM6031 MUX device is unhealthy" throttle 5 + @ Event for reporting Load Switch not ready state + event LoadSwitchNotReady() severity warning high format "VELM6031 Load Switch is not ready" throttle 5 - ############################################################################## - #### Uncomment the following examples to start customizing your component #### - ############################################################################## + @ Event for reporting VELM6031 sensor fetch failure + event SensorSampleFetchFailed(ret: I32) severity warning high format "VELM6031 sensor fetch failed with return code: {}" throttle 5 - # @ Example async command - # async command COMMAND_NAME(param_name: U32) + @ Event for reporting VELM6031 sensor channel get failure + event SensorChannelGetFailed(ret: I32) severity warning high format "VELM6031 sensor channel get failed with return code: {}" throttle 5 - # @ Example telemetry counter - # telemetry ExampleCounter: U64 + @ Event for reporting invalid gain parameter + event InvalidGainParam(gain: U8) severity warning high format "VELM6031 invalid gain parameter: {}" throttle 5 - # @ Example event - # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + @ Event for reporting invalid integration time parameter + event InvalidIntegrationTimeParam(it: U8) severity warning high format "VELM6031 invalid integration time parameter: {}" throttle 5 - # @ Example port: receiving calls from the rate group - # sync input port run: Svc.Sched + @ Event for reporting invalid effective photodiode size parameter + event InvalidDiv4Param(div4: U8) severity warning high format "VELM6031 invalid effective photodiode size parameter: {}" throttle 5 - # @ Example parameter - # param PARAMETER_NAME: U32 + @ Event for reporting sensor attribute set failure + event SensorAttrSetFailed(attr: U16, val: U8, ret: I32) severity warning high format "VELM6031 sensor attribute {}={} set failed with return code: {}" throttle 5 ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp index 8e33e60e..0ed53ddc 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp @@ -32,8 +32,12 @@ class Velm6031Manager final : public Velm6031ManagerComponentBase { //! Destroy Velm6031Manager object ~Velm6031Manager(); - void ReadData(); + public: + // ---------------------------------------------------------------------- + // Public helper methods + // ---------------------------------------------------------------------- + //! Configure the TMP112 device void configure(const struct device* dev); private: @@ -41,28 +45,82 @@ class Velm6031Manager final : public Velm6031ManagerComponentBase { // Handler implementations for typed input ports // ---------------------------------------------------------------------- - //! Handler implementation for run + //! Handler implementation for ambientLightGet //! - //! Port for polling the light sensor data - called by rate group - void run_handler(FwIndexType portNum, //!< The port number - U32 context //!< The call order - ) override; + //! Port to read the ambient illuminance in visible spectrum, in lux + F32 ambientLightGet_handler(FwIndexType portNum, //!< The port number + Fw::Success& condition) override; + + //! Handler implementation for infraRedLightGet + //! + //! Port to read the illuminance in infra-red spectrum, in lux + F32 infraRedLightGet_handler(FwIndexType portNum, //!< The port number + Fw::Success& condition) override; + + //! Handler implementation for loadSwitchStateChanged + //! + //! Port to initialize and deinitialize the VELM6031 device on load switch state change + Fw::Success loadSwitchStateChanged_handler(FwIndexType portNum, //!< The port number + const Fw::On& state) override; + + //! Handler implementation for visibleLightGet + //! + //! Port to read the illuminance in visible spectrum, in lux + //! This channel represents the raw measurement counts provided by the sensor ALS register. + //! It is useful for estimating good values for integration time, effective photodiode size + //! and gain attributes in fetch and get mode. + F32 visibleLightGet_handler(FwIndexType portNum, //!< The port number + Fw::Success& condition) override; + + private: + // ---------------------------------------------------------------------- + // Private helper methods + // ---------------------------------------------------------------------- + + //! Initialize the TMP112 device + Fw::Success initializeDevice(); - void init_handler(FwIndexType portNum); + //! Deinitialize the TMP112 device + Fw::Success deinitializeDevice(); - F32 m_RawLightData; + //! Check if the TMP112 device is initialized + bool isDeviceInitialized(); - F32 m_IRLightData; + //! Check if the load switch is ready (on and timeout passed) + bool loadSwitchReady(); - F32 m_ALSLightData; + //! Set the integration time attribute for the VELM6031 sensor + Fw::Success setIntegrationTimeAttribute(sensor_channel chan); - bool m_configured = false; + //! Set the gain attribute for the VELM6031 sensor + Fw::Success setGainAttribute(sensor_channel chan); - bool m_attributes_set = false; + //! Set the div4 attribute for the VELM6031 sensor + Fw::Success setDiv4Attribute(sensor_channel chan); - bool m_device_init = false; + //! Set all sensor attributes for the VELM6031 sensor + Fw::Success configureSensorAttributes(sensor_channel chan); + private: + // ---------------------------------------------------------------------- + // Private member variables + // ---------------------------------------------------------------------- + + //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; + + //! TCA health state + Fw::Health m_tca_state = Fw::Health::FAILED; + + //! MUX health state + Fw::Health m_mux_state = Fw::Health::FAILED; + + //! Load switch state + Fw::On m_load_switch_state = Fw::On::OFF; + + //! Load switch on timeout + //! Time when we can consider the load switch to be fully on (giving time for power to normalize) + Fw::Time m_load_switch_on_timeout; }; } // namespace Drv diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 8224d0be..094cd976 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -59,7 +59,9 @@ void LoadSwitch ::setLoadSwitchState(Fw::On state) { this->gpioSet_out(0, gpioValue); // Inform downstream components of the state change - this->loadSwitchStateChanged_out(0, state); + for (FwIndexType i = 0; i < this->getNum_loadSwitchStateChanged_OutputPorts(); i++) { + this->loadSwitchStateChanged_out(i, state); + } this->log_ACTIVITY_HI_StatusChanged(state); this->tlmWrite_IsOn(state); } diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 27843f80..c2f7339d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -26,7 +26,7 @@ module Components { output port gpioGet: Drv.GpioRead @ Port to indicate a change in load switch state - output port loadSwitchStateChanged: loadSwitchStateChanged + output port loadSwitchStateChanged: [2] loadSwitchStateChanged @ Input port to turn on the load switch (called by other components) sync input port turnOn: Fw.Signal diff --git a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp index 5afd2b79..17102ee2 100644 --- a/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp +++ b/FprimeZephyrReference/Components/ThermalManager/ThermalManager.cpp @@ -24,11 +24,12 @@ ThermalManager::~ThermalManager() {} void ThermalManager::run_handler(FwIndexType portNum, U32 context) { Fw::Success condition; + // Face temp sensors for (FwIndexType i = 0; i < this->getNum_faceTempGet_OutputPorts(); i++) { this->faceTempGet_out(i, condition); } - // Battery cell sensors (4 sensors) + // Battery cell temp sensors for (FwIndexType i = 0; i < this->getNum_battCellTempGet_OutputPorts(); i++) { this->battCellTempGet_out(i, condition); } diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index cd707337..e3642197 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) { inputs.battCell3TempDevice = batt_cell3_temp_sens; inputs.battCell4TempDevice = batt_cell4_temp_sens; // Light sensor devices - // inputs.face0LightDevice = face0_light_sens; + inputs.face0LightDevice = face0_light_sens; // inputs.face1LightDevice = face1_light_sens; // inputs.face2LightDevice = face2_light_sens; // inputs.face3LightDevice = face3_light_sens; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 9088f7e0..94b367f7 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -120,29 +120,29 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112BattCell4Manager.Temperature } - # packet LightSensor id 14 group 4 { - # ReferenceDeployment.velm6031Face0Manager.RawLightData - # ReferenceDeployment.velm6031Face1Manager.RawLightData - # ReferenceDeployment.velm6031Face2Manager.RawLightData - # ReferenceDeployment.velm6031Face3Manager.RawLightData - # ReferenceDeployment.velm6031Face5Manager.RawLightData - # ReferenceDeployment.velm6031Face6Manager.RawLightData - # ReferenceDeployment.velm6031Face7Manager.RawLightData - # ReferenceDeployment.velm6031Face0Manager.IRLightData - # ReferenceDeployment.velm6031Face1Manager.IRLightData - # ReferenceDeployment.velm6031Face2Manager.IRLightData - # ReferenceDeployment.velm6031Face3Manager.IRLightData - # ReferenceDeployment.velm6031Face5Manager.IRLightData - # ReferenceDeployment.velm6031Face6Manager.IRLightData - # ReferenceDeployment.velm6031Face7Manager.IRLightData - # ReferenceDeployment.velm6031Face0Manager.ALSLightData + packet LightSensor id 14 group 4 { + ReferenceDeployment.velm6031Face0Manager.VisibleLight + # ReferenceDeployment.velm6031Face1Manager.RawLightData + # ReferenceDeployment.velm6031Face2Manager.RawLightData + # ReferenceDeployment.velm6031Face3Manager.RawLightData + # ReferenceDeployment.velm6031Face5Manager.RawLightData + # ReferenceDeployment.velm6031Face6Manager.RawLightData + # ReferenceDeployment.velm6031Face7Manager.RawLightData + ReferenceDeployment.velm6031Face0Manager.InfraRedLight + # ReferenceDeployment.velm6031Face1Manager.IRLightData + # ReferenceDeployment.velm6031Face2Manager.IRLightData + # ReferenceDeployment.velm6031Face3Manager.IRLightData + # ReferenceDeployment.velm6031Face5Manager.IRLightData + # ReferenceDeployment.velm6031Face6Manager.IRLightData + # ReferenceDeployment.velm6031Face7Manager.IRLightData + ReferenceDeployment.velm6031Face0Manager.AmbientLight # ReferenceDeployment.velm6031Face1Manager.ALSLightData # ReferenceDeployment.velm6031Face2Manager.ALSLightData # ReferenceDeployment.velm6031Face3Manager.ALSLightData # ReferenceDeployment.velm6031Face5Manager.ALSLightData # ReferenceDeployment.velm6031Face6Manager.ALSLightData # ReferenceDeployment.velm6031Face7Manager.ALSLightData - # } + } } omit { CdhCore.cmdDisp.CommandErrors diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 1b7c61d2..298b9511 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -142,7 +142,7 @@ void setupTopology(const TopologyState& state) { tmp112BattCell4Manager.configure(state.battCell4TempDevice); // Configure all 7 VELM6031 light sensor managers - // velm6031Face0Manager.configure(state.face0LightDevice); + velm6031Face0Manager.configure(state.face0LightDevice); // velm6031Face1Manager.configure(state.face1LightDevice); // velm6031Face2Manager.configure(state.face2LightDevice); // velm6031Face3Manager.configure(state.face3LightDevice); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 64c587ca..c6dd5eb2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -106,7 +106,7 @@ struct TopologyState { const device* battCell3TempDevice; //!< TMP112 device for battery cell 3 const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 // - Light sensors - // const device* face0LightDevice; //!< Light sensor device for cube face 0 + const device* face0LightDevice; //!< Light sensor device for cube face 0 // const device* face1LightDevice; //!< Light sensor device for cube face 1 // const device* face2LightDevice; //!< Light sensor device for cube face 2 // const device* face3LightDevice; //!< Light sensor device for cube face 3 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 9ea8cf14..c036eb33 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -185,18 +185,18 @@ module ReferenceDeployment { instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x10053000 - # instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 + instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 - # instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 + instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 - # instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 + instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 - # instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 + instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 - # instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 + instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 - # instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 + instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 - # instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 + instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 9192fcff..7e32dfa8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -91,7 +91,7 @@ module ReferenceDeployment { instance tmp112BattCell4Manager instance resetManager instance modeManager - # instance velm6031Face0Manager + instance velm6031Face0Manager # instance velm6031Face1Manager # instance velm6031Face2Manager # instance velm6031Face3Manager @@ -229,23 +229,24 @@ module ReferenceDeployment { face0LoadSwitch.gpioSet -> gpioface0LS.gpioWrite face0LoadSwitch.gpioGet -> gpioface0LS.gpioRead - face0LoadSwitch.loadSwitchStateChanged -> tmp112Face0Manager.loadSwitchStateChanged + face0LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face0Manager.loadSwitchStateChanged + face0LoadSwitch.loadSwitchStateChanged[1] -> velm6031Face0Manager.loadSwitchStateChanged face1LoadSwitch.gpioSet -> gpioface1LS.gpioWrite face1LoadSwitch.gpioGet -> gpioface1LS.gpioRead - face1LoadSwitch.loadSwitchStateChanged -> tmp112Face1Manager.loadSwitchStateChanged + face1LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face1Manager.loadSwitchStateChanged face2LoadSwitch.gpioSet -> gpioface2LS.gpioWrite face2LoadSwitch.gpioGet -> gpioface2LS.gpioRead - face2LoadSwitch.loadSwitchStateChanged -> tmp112Face2Manager.loadSwitchStateChanged + face2LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face2Manager.loadSwitchStateChanged face3LoadSwitch.gpioSet -> gpioface3LS.gpioWrite face3LoadSwitch.gpioGet -> gpioface3LS.gpioRead - face3LoadSwitch.loadSwitchStateChanged -> tmp112Face3Manager.loadSwitchStateChanged + face3LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face3Manager.loadSwitchStateChanged face5LoadSwitch.gpioSet -> gpioface5LS.gpioWrite face5LoadSwitch.gpioGet -> gpioface5LS.gpioRead - face5LoadSwitch.loadSwitchStateChanged -> tmp112Face5Manager.loadSwitchStateChanged + face5LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face5Manager.loadSwitchStateChanged payloadPowerLoadSwitch.gpioSet -> gpioPayloadPowerLS.gpioWrite payloadPowerLoadSwitch.gpioGet -> gpioPayloadPowerLS.gpioRead From 2eba75db0e0d93fa4a0f2e51f81e01881f5eda8c Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 03:09:01 -0600 Subject: [PATCH 54/68] Add ADCS component, still not in topology --- .../Components/ADCS/ADCS.cpp | 33 +++++++++++++++ .../Components/ADCS/ADCS.fpp | 24 +++++++++++ .../Components/ADCS/ADCS.hpp | 41 +++++++++++++++++++ .../Components/ADCS/CMakeLists.txt | 18 ++++++++ .../Components/CMakeLists.txt | 1 + .../ReferenceDeployment/Top/instances.fpp | 16 ++++---- .../ReferenceDeployment/Top/topology.fpp | 11 +++++ .../project/config/AcConstants.fpp | 2 +- 8 files changed, 138 insertions(+), 8 deletions(-) create mode 100644 FprimeZephyrReference/Components/ADCS/ADCS.cpp create mode 100644 FprimeZephyrReference/Components/ADCS/ADCS.fpp create mode 100644 FprimeZephyrReference/Components/ADCS/ADCS.hpp create mode 100644 FprimeZephyrReference/Components/ADCS/CMakeLists.txt diff --git a/FprimeZephyrReference/Components/ADCS/ADCS.cpp b/FprimeZephyrReference/Components/ADCS/ADCS.cpp new file mode 100644 index 00000000..8a756d83 --- /dev/null +++ b/FprimeZephyrReference/Components/ADCS/ADCS.cpp @@ -0,0 +1,33 @@ +// ====================================================================== +// \title ADCS.cpp +// \brief cpp file for ADCS component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/ADCS/ADCS.hpp" + +#include + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +ADCS::ADCS(const char* const compName) : ADCSComponentBase(compName) {} + +ADCS::~ADCS() {} + +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +void ADCS::run_handler(FwIndexType portNum, U32 context) { + Fw::Success condition; + + // Face light sensors + for (FwIndexType i = 0; i < this->getNum_visibleLightGet_OutputPorts(); i++) { + this->visibleLightGet_out(i, condition); + } +} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/ADCS/ADCS.fpp b/FprimeZephyrReference/Components/ADCS/ADCS.fpp new file mode 100644 index 00000000..57f2b661 --- /dev/null +++ b/FprimeZephyrReference/Components/ADCS/ADCS.fpp @@ -0,0 +1,24 @@ +module Components { + @ Attitude Determination and Control Component for F Prime FSW framework. + passive component ADCS { + sync input port run: Svc.Sched + + @ Port for face light sensors + output port visibleLightGet: [6] Drv.lightGet + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for emitting telemetry + telemetry port tlmOut + + @ Port for emitting events + event port logOut + + @ Port for emitting text events + text event port logTextOut + } +} diff --git a/FprimeZephyrReference/Components/ADCS/ADCS.hpp b/FprimeZephyrReference/Components/ADCS/ADCS.hpp new file mode 100644 index 00000000..077815fb --- /dev/null +++ b/FprimeZephyrReference/Components/ADCS/ADCS.hpp @@ -0,0 +1,41 @@ +// ====================================================================== +// \title ADCS.hpp +// \brief hpp file for ADCS component implementation class +// ====================================================================== + +#ifndef Components_ADCS_HPP +#define Components_ADCS_HPP + +#include "FprimeZephyrReference/Components/ADCS/ADCSComponentAc.hpp" + +namespace Components { + +class ADCS final : public ADCSComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct ADCS object + ADCS(const char* const compName //!< The component name + ); + + //! Destroy ADCS object + ~ADCS(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for run + //! + //! Scheduled port for periodic temperature reading + void run_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/ADCS/CMakeLists.txt b/FprimeZephyrReference/Components/ADCS/CMakeLists.txt new file mode 100644 index 00000000..fe80bbbf --- /dev/null +++ b/FprimeZephyrReference/Components/ADCS/CMakeLists.txt @@ -0,0 +1,18 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/ADCS.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/ADCS.cpp" +) diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index face4e63..62da1a3f 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -1,5 +1,6 @@ # Include project-wide components here +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ADCS/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/AntennaDeployer/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Authenticate/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/") diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index c036eb33..3e2d6306 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -185,18 +185,20 @@ module ReferenceDeployment { instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x10053000 - instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10054000 + instance adcs: Components.ADCS base id 0x10054000 - instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10055000 + instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10055000 - instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10056000 + instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10056000 - instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10057000 + instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10057000 - instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10058000 + instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10058000 - instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x10059000 + instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10059000 - instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005A000 + instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x1005A000 + + instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005B000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 7e32dfa8..27110b38 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -91,6 +91,7 @@ module ReferenceDeployment { instance tmp112BattCell4Manager instance resetManager instance modeManager + instance adcs instance velm6031Face0Manager # instance velm6031Face1Manager # instance velm6031Face2Manager @@ -212,6 +213,7 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[20] -> muxChannel5Monitor.run rateGroup1Hz.RateGroupMemberOut[21] -> muxChannel7Monitor.run rateGroup1Hz.RateGroupMemberOut[22] -> thermalManager.run + # rateGroup1Hz.RateGroupMemberOut[23] -> adcs.run # Slow rate (1/6 Hz) rate group # rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn @@ -330,6 +332,15 @@ module ReferenceDeployment { thermalManager.battCellTempGet[3] -> tmp112BattCell4Manager.temperatureGet } + connections adcs { + adcs.visibleLightGet[0] -> velm6031Face0Manager.visibleLightGet + # adcs.visibleLightGet[1] -> velm6031Face1Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[2] -> velm6031Face2Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[3] -> velm6031Face3Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[4] -> velm6031Face5Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[5] -> velm6031Face6Manager.visibleLightGet --- IGNORE + } + connections ModeManager { # Voltage monitoring from system power manager modeManager.voltageGet -> ina219SysManager.voltageGet diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 45302ea6..4f29a2e8 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 23 +constant ActiveRateGroupOutputPorts = 24 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 From 61b9577fda7b55b9581afc9b59c2b1eed0d6f9d0 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 17:46:37 -0600 Subject: [PATCH 55/68] not booting --- .../Top/ReferenceDeploymentPackets.fppi | 4 +- .../Top/ReferenceDeploymentTopology.cpp | 2 +- .../ReferenceDeployment/Top/instances.fpp | 8 ++-- .../ReferenceDeployment/Top/topology.fpp | 43 +++++++++---------- .../project/config/AcConstants.fpp | 2 +- prj.conf | 2 +- 6 files changed, 30 insertions(+), 31 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 94b367f7..24efcb9e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -9,7 +9,7 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.HiBuffs ReferenceDeployment.rateGroup10Hz.RgMaxTime ReferenceDeployment.rateGroup1Hz.RgMaxTime - # ReferenceDeployment.rateGroup1_6Hz.RgMaxTime + ReferenceDeployment.rateGroup1_6Hz.RgMaxTime ReferenceDeployment.startupManager.BootCount ReferenceDeployment.startupManager.QuiescenceEndTime ReferenceDeployment.modeManager.CurrentMode @@ -24,7 +24,7 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.EmptyBuffs ReferenceDeployment.rateGroup10Hz.RgCycleSlips ReferenceDeployment.rateGroup1Hz.RgCycleSlips - # ReferenceDeployment.rateGroup1_6Hz.RgCycleSlips + ReferenceDeployment.rateGroup1_6Hz.RgCycleSlips } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 298b9511..9b9b51f3 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -67,7 +67,7 @@ void configureTopology() { // Rate groups require context arrays. rateGroup10Hz.configure(rateGroup10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup10HzContext)); rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); - // rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); + rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); cmdSeq.allocateBuffer(0, mallocator, 5 * 1024); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 3e2d6306..1d5d3e3d 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,10 +37,10 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 3 - # instance rateGroup1_6Hz: Svc.ActiveRateGroup base id 0x10003000 \ - # queue size Default.QUEUE_SIZE \ - # stack size Default.STACK_SIZE \ - # priority 4 + instance rateGroup1_6Hz: Svc.ActiveRateGroup base id 0x10003000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 4 instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \ queue size Default.QUEUE_SIZE * 2 \ diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 27110b38..f93b96bf 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -25,7 +25,7 @@ module ReferenceDeployment { # ---------------------------------------------------------------------- instance rateGroup10Hz instance rateGroup1Hz - # instance rateGroup1_6Hz + instance rateGroup1_6Hz instance rateGroupDriver instance timer instance lora @@ -193,31 +193,30 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn - rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run - rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run - rateGroup1Hz.RateGroupMemberOut[5] -> imuManager.run - rateGroup1Hz.RateGroupMemberOut[6] -> comDelay.run - rateGroup1Hz.RateGroupMemberOut[7] -> burnwire.schedIn - rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn - rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run - rateGroup1Hz.RateGroupMemberOut[10] -> FileHandling.fileDownlink.Run - rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run # doubles (20ms) rate group max time + rateGroup1Hz.RateGroupMemberOut[3] -> watchdog.run + rateGroup1Hz.RateGroupMemberOut[4] -> comDelay.run + rateGroup1Hz.RateGroupMemberOut[5] -> burnwire.schedIn + rateGroup1Hz.RateGroupMemberOut[6] -> antennaDeployer.schedIn + rateGroup1Hz.RateGroupMemberOut[7] -> fsSpace.run + rateGroup1Hz.RateGroupMemberOut[8] -> FileHandling.fileDownlink.Run + rateGroup1Hz.RateGroupMemberOut[9] -> startupManager.run # doubles (20ms) rate group max time # rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run # Causing rate group to slip? - rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run - rateGroup1Hz.RateGroupMemberOut[14] -> tcaMonitor.run - rateGroup1Hz.RateGroupMemberOut[15] -> muxChannel0Monitor.run - rateGroup1Hz.RateGroupMemberOut[16] -> muxChannel1Monitor.run - rateGroup1Hz.RateGroupMemberOut[17] -> muxChannel2Monitor.run - rateGroup1Hz.RateGroupMemberOut[18] -> muxChannel3Monitor.run - rateGroup1Hz.RateGroupMemberOut[19] -> muxChannel4Monitor.run - rateGroup1Hz.RateGroupMemberOut[20] -> muxChannel5Monitor.run - rateGroup1Hz.RateGroupMemberOut[21] -> muxChannel7Monitor.run - rateGroup1Hz.RateGroupMemberOut[22] -> thermalManager.run + rateGroup1Hz.RateGroupMemberOut[10] -> modeManager.run # rateGroup1Hz.RateGroupMemberOut[23] -> adcs.run # Slow rate (1/6 Hz) rate group - # rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn - + rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn + rateGroup1_6Hz.RateGroupMemberOut[0] -> CdhCore.tlmSend.Run + rateGroup1_6Hz.RateGroupMemberOut[1] -> imuManager.run + rateGroup1_6Hz.RateGroupMemberOut[2] -> tcaMonitor.run + rateGroup1_6Hz.RateGroupMemberOut[3] -> muxChannel0Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[4] -> muxChannel1Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[5] -> muxChannel2Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[6] -> muxChannel3Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[7] -> muxChannel4Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[8] -> muxChannel5Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[9] -> muxChannel7Monitor.run + rateGroup1_6Hz.RateGroupMemberOut[10] -> thermalManager.run } diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 4f29a2e8..6eadde8f 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 24 +constant ActiveRateGroupOutputPorts = 12 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 diff --git a/prj.conf b/prj.conf index d54b91ee..f26c071f 100644 --- a/prj.conf +++ b/prj.conf @@ -39,7 +39,7 @@ CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y CONFIG_DYNAMIC_THREAD_ALLOC=n CONFIG_DYNAMIC_THREAD_PREFER_POOL=y -CONFIG_DYNAMIC_THREAD_POOL_SIZE=30 +CONFIG_DYNAMIC_THREAD_POOL_SIZE=33 # Num threads in the thread pool CONFIG_DYNAMIC_THREAD_STACK_SIZE=8192 # Size of thread stack in thread pool, must be >= Thread Pool size in F' From cc60a256cf156c6382861fca8676c455d78ce2d6 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 18:12:12 -0600 Subject: [PATCH 56/68] Rename light sensor --- .../Components/Drv/CMakeLists.txt | 2 +- .../CMakeLists.txt | 10 ++-- .../Veml6031Manager.cpp} | 36 ++++++------- .../Veml6031Manager.fpp} | 50 +++++++++---------- .../Veml6031Manager.hpp} | 30 +++++------ .../docs/sdd.md | 2 +- .../Top/ReferenceDeploymentPackets.fppi | 42 ++++++++-------- .../Top/ReferenceDeploymentTopology.cpp | 16 +++--- .../ReferenceDeployment/Top/instances.fpp | 14 +++--- .../ReferenceDeployment/Top/topology.fpp | 28 +++++------ prj.conf | 2 +- 11 files changed, 116 insertions(+), 116 deletions(-) rename FprimeZephyrReference/Components/Drv/{Velm6031Manager => Veml6031Manager}/CMakeLists.txt (74%) rename FprimeZephyrReference/Components/Drv/{Velm6031Manager/Velm6031Manager.cpp => Veml6031Manager/Veml6031Manager.cpp} (88%) rename FprimeZephyrReference/Components/Drv/{Velm6031Manager/Velm6031Manager.fpp => Veml6031Manager/Veml6031Manager.fpp} (78%) rename FprimeZephyrReference/Components/Drv/{Velm6031Manager/Velm6031Manager.hpp => Veml6031Manager/Veml6031Manager.hpp} (83%) rename FprimeZephyrReference/Components/Drv/{Velm6031Manager => Veml6031Manager}/docs/sdd.md (97%) diff --git a/FprimeZephyrReference/Components/Drv/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/CMakeLists.txt index 6f1b9ec8..7a38cbfe 100644 --- a/FprimeZephyrReference/Components/Drv/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/CMakeLists.txt @@ -4,4 +4,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RtcManager") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Tmp112Manager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Veml6031Manager/") diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt b/FprimeZephyrReference/Components/Drv/Veml6031Manager/CMakeLists.txt similarity index 74% rename from FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt rename to FprimeZephyrReference/Components/Drv/Veml6031Manager/CMakeLists.txt index 99e460de..b3fa8d69 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/CMakeLists.txt @@ -16,9 +16,9 @@ register_fprime_library( AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager.fpp" + "${CMAKE_CURRENT_LIST_DIR}/Veml6031Manager.fpp" SOURCES - "${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Veml6031Manager.cpp" # DEPENDS # MyPackage_MyOtherModule ) @@ -26,10 +26,10 @@ register_fprime_library( ### Unit Tests ### # register_fprime_ut( # AUTOCODER_INPUTS -# "${CMAKE_CURRENT_LIST_DIR}/Velm6031Manager.fpp" +# "${CMAKE_CURRENT_LIST_DIR}/Veml6031Manager.fpp" # SOURCES -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Velm6031ManagerTestMain.cpp" -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Velm6031ManagerTester.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Veml6031ManagerTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Veml6031ManagerTester.cpp" # DEPENDS # STest # For rules-based testing # UT_AUTO_HELPERS diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp similarity index 88% rename from FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp rename to FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp index 55b31375..1e520f7c 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp @@ -1,9 +1,9 @@ // ====================================================================== -// \title Velm6031Manager.cpp -// \brief cpp file for Velm6031Manager component implementation class +// \title Veml6031Manager.cpp +// \brief cpp file for Veml6031Manager component implementation class // ====================================================================== -#include "FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp" +#include "FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp" #include #include @@ -16,15 +16,15 @@ namespace Drv { // Component construction and destruction // ---------------------------------------------------------------------- -Velm6031Manager ::Velm6031Manager(const char* const compName) : Velm6031ManagerComponentBase(compName) {} +Veml6031Manager ::Veml6031Manager(const char* const compName) : Veml6031ManagerComponentBase(compName) {} -Velm6031Manager ::~Velm6031Manager() {} +Veml6031Manager ::~Veml6031Manager() {} // ---------------------------------------------------------------------- // Public helper methods // ---------------------------------------------------------------------- -void Velm6031Manager ::configure(const struct device* dev) { +void Veml6031Manager ::configure(const struct device* dev) { this->m_dev = dev; } @@ -32,7 +32,7 @@ void Velm6031Manager ::configure(const struct device* dev) { // Handler implementations for typed input ports // ---------------------------------------------------------------------- -F32 Velm6031Manager ::ambientLightGet_handler(FwIndexType portNum, Fw::Success& condition) { +F32 Veml6031Manager ::ambientLightGet_handler(FwIndexType portNum, Fw::Success& condition) { condition = Fw::Success::FAILURE; if (!this->initializeDevice()) { @@ -59,7 +59,7 @@ F32 Velm6031Manager ::ambientLightGet_handler(FwIndexType portNum, Fw::Success& return lux; } -F32 Velm6031Manager ::infraRedLightGet_handler(FwIndexType portNum, Fw::Success& condition) { +F32 Veml6031Manager ::infraRedLightGet_handler(FwIndexType portNum, Fw::Success& condition) { condition = Fw::Success::FAILURE; if (!this->initializeDevice()) { @@ -86,7 +86,7 @@ F32 Velm6031Manager ::infraRedLightGet_handler(FwIndexType portNum, Fw::Success& return lux; } -Fw::Success Velm6031Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& state) { +Fw::Success Veml6031Manager ::loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& state) { // Store the load switch state this->m_load_switch_state = state; @@ -103,7 +103,7 @@ Fw::Success Velm6031Manager ::loadSwitchStateChanged_handler(FwIndexType portNum return Fw::Success::SUCCESS; } -F32 Velm6031Manager ::visibleLightGet_handler(FwIndexType portNum, Fw::Success& condition) { +F32 Veml6031Manager ::visibleLightGet_handler(FwIndexType portNum, Fw::Success& condition) { condition = Fw::Success::FAILURE; if (!this->initializeDevice()) { @@ -134,7 +134,7 @@ F32 Velm6031Manager ::visibleLightGet_handler(FwIndexType portNum, Fw::Success& // Private helper methods // ---------------------------------------------------------------------- -bool Velm6031Manager ::isDeviceInitialized() { +bool Veml6031Manager ::isDeviceInitialized() { if (!this->m_dev) { this->log_WARNING_HI_DeviceNil(); return false; @@ -150,7 +150,7 @@ bool Velm6031Manager ::isDeviceInitialized() { return this->m_dev->state->initialized; } -Fw::Success Velm6031Manager ::initializeDevice() { +Fw::Success Veml6031Manager ::initializeDevice() { if (this->isDeviceInitialized()) { if (!device_is_ready(this->m_dev)) { this->log_WARNING_HI_DeviceNotReady(); @@ -188,7 +188,7 @@ Fw::Success Velm6031Manager ::initializeDevice() { return Fw::Success::SUCCESS; } -Fw::Success Velm6031Manager ::deinitializeDevice() { +Fw::Success Veml6031Manager ::deinitializeDevice() { if (!this->m_dev) { this->log_WARNING_HI_DeviceNil(); return Fw::Success::FAILURE; @@ -205,11 +205,11 @@ Fw::Success Velm6031Manager ::deinitializeDevice() { return Fw::Success::SUCCESS; } -bool Velm6031Manager ::loadSwitchReady() { +bool Veml6031Manager ::loadSwitchReady() { return this->m_load_switch_state == Fw::On::ON && this->getTime() >= this->m_load_switch_on_timeout; } -Fw::Success Velm6031Manager ::setIntegrationTimeAttribute(sensor_channel chan) { +Fw::Success Veml6031Manager ::setIntegrationTimeAttribute(sensor_channel chan) { Fw::ParamValid valid; U8 it = this->paramGet_INTEGRATION_TIME(valid); if (valid != Fw::ParamValid::VALID) { @@ -230,7 +230,7 @@ Fw::Success Velm6031Manager ::setIntegrationTimeAttribute(sensor_channel chan) { return Fw::Success::SUCCESS; } -Fw::Success Velm6031Manager ::setGainAttribute(sensor_channel chan) { +Fw::Success Veml6031Manager ::setGainAttribute(sensor_channel chan) { Fw::ParamValid valid; U8 gain = this->paramGet_GAIN(valid); if (valid != Fw::ParamValid::VALID) { @@ -251,7 +251,7 @@ Fw::Success Velm6031Manager ::setGainAttribute(sensor_channel chan) { return Fw::Success::SUCCESS; } -Fw::Success Velm6031Manager ::setDiv4Attribute(sensor_channel chan) { +Fw::Success Veml6031Manager ::setDiv4Attribute(sensor_channel chan) { Fw::ParamValid valid; U8 div4 = this->paramGet_EFFECTIVE_PHOTODIODE_SIZE(valid); if (valid != Fw::ParamValid::VALID) { @@ -272,7 +272,7 @@ Fw::Success Velm6031Manager ::setDiv4Attribute(sensor_channel chan) { return Fw::Success::SUCCESS; } -Fw::Success Velm6031Manager ::configureSensorAttributes(sensor_channel chan) { +Fw::Success Veml6031Manager ::configureSensorAttributes(sensor_channel chan) { Fw::Success result; result = this->setIntegrationTimeAttribute(chan); diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp similarity index 78% rename from FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp rename to FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp index 9c2768c9..38e5ef9f 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp @@ -1,7 +1,7 @@ module Drv { port lightGet(ref condition: Fw.Success) -> F32 - @ Gain settings for VELM6031 sensor + @ Gain settings for VEML6031 sensor enum GAIN : U8 { VEML6031_GAIN_1 @< Gain of 1 VEML6031_GAIN_2 @< Gain of 2 @@ -9,7 +9,7 @@ module Drv { VEML6031_GAIN_0_5 @< Gain of 0.5 } - @ Integration time settings for VELM6031 sensor + @ Integration time settings for VEML6031 sensor enum IT : U8 { VEML6031_IT_3_125 @< 3.25 ms integration time VEML6031_IT_6_25 @< 6.25 ms integration time @@ -22,13 +22,13 @@ module Drv { VEML6031_IT_800 @< 800 ms integration time } - @ Effective photodiode size (DIV4) settings for VELM6031 sensor + @ Effective photodiode size (DIV4) settings for VEML6031 sensor enum DIV4 : U8 { VEML6031_SIZE_4_4 VEML6031_SIZE_1_4 } - @ Ambient Light Sensor (ALS) persistence protect number settings for VELM6031 sensor + @ Ambient Light Sensor (ALS) persistence protect number settings for VEML6031 sensor enum ALS_PERS : U8 { VEML60XX_PERS_1 @< Interrupt triggered every ALS reading VEML60XX_PERS_2 @< Interrupt triggered after 2 consecutive ALS readings out of threshold @@ -38,7 +38,7 @@ module Drv { } module Drv { - passive component Velm6031Manager { + passive component Veml6031Manager { #### Parameters #### @ Parameter for setting the gain of the light senors @@ -77,7 +77,7 @@ module Drv { @ Port to read the ambient illuminance in visible spectrum, in lux sync input port ambientLightGet: lightGet - @ Port to initialize and deinitialize the VELM6031 device on load switch state change + @ Port to initialize and deinitialize the VEML6031 device on load switch state change sync input port loadSwitchStateChanged: Components.loadSwitchStateChanged @ Output port to check device TCA health @@ -91,44 +91,44 @@ module Drv { #### Events #### - @ Event for reporting VELM6031 not ready error - event DeviceNotReady() severity warning high format "VELM6031 device not ready" throttle 5 + @ Event for reporting VEML6031 not ready error + event DeviceNotReady() severity warning high format "VEML6031 device not ready" throttle 5 - @ Event for reporting VELM6031 initialization failure - event DeviceInitFailed(ret: I32) severity warning high format "VELM6031 initialization failed with return code: {}" throttle 5 + @ Event for reporting VEML6031 initialization failure + event DeviceInitFailed(ret: I32) severity warning high format "VEML6031 initialization failed with return code: {}" throttle 5 - @ Event for reporting VELM6031 nil device error - event DeviceNil() severity warning high format "VELM6031 device is nil" throttle 5 + @ Event for reporting VEML6031 nil device error + event DeviceNil() severity warning high format "VEML6031 device is nil" throttle 5 - @ Event for reporting VELM6031 nil state error - event DeviceStateNil() severity warning high format "VELM6031 device state is nil" throttle 5 + @ Event for reporting VEML6031 nil state error + event DeviceStateNil() severity warning high format "VEML6031 device state is nil" throttle 5 @ Event for reporting TCA unhealthy state - event TcaUnhealthy() severity warning high format "VELM6031 TCA device is unhealthy" throttle 5 + event TcaUnhealthy() severity warning high format "VEML6031 TCA device is unhealthy" throttle 5 @ Event for reporting MUX unhealthy state - event MuxUnhealthy() severity warning high format "VELM6031 MUX device is unhealthy" throttle 5 + event MuxUnhealthy() severity warning high format "VEML6031 MUX device is unhealthy" throttle 5 @ Event for reporting Load Switch not ready state - event LoadSwitchNotReady() severity warning high format "VELM6031 Load Switch is not ready" throttle 5 + event LoadSwitchNotReady() severity warning high format "VEML6031 Load Switch is not ready" throttle 5 - @ Event for reporting VELM6031 sensor fetch failure - event SensorSampleFetchFailed(ret: I32) severity warning high format "VELM6031 sensor fetch failed with return code: {}" throttle 5 + @ Event for reporting VEML6031 sensor fetch failure + event SensorSampleFetchFailed(ret: I32) severity warning high format "VEML6031 sensor fetch failed with return code: {}" throttle 5 - @ Event for reporting VELM6031 sensor channel get failure - event SensorChannelGetFailed(ret: I32) severity warning high format "VELM6031 sensor channel get failed with return code: {}" throttle 5 + @ Event for reporting VEML6031 sensor channel get failure + event SensorChannelGetFailed(ret: I32) severity warning high format "VEML6031 sensor channel get failed with return code: {}" throttle 5 @ Event for reporting invalid gain parameter - event InvalidGainParam(gain: U8) severity warning high format "VELM6031 invalid gain parameter: {}" throttle 5 + event InvalidGainParam(gain: U8) severity warning high format "VEML6031 invalid gain parameter: {}" throttle 5 @ Event for reporting invalid integration time parameter - event InvalidIntegrationTimeParam(it: U8) severity warning high format "VELM6031 invalid integration time parameter: {}" throttle 5 + event InvalidIntegrationTimeParam(it: U8) severity warning high format "VEML6031 invalid integration time parameter: {}" throttle 5 @ Event for reporting invalid effective photodiode size parameter - event InvalidDiv4Param(div4: U8) severity warning high format "VELM6031 invalid effective photodiode size parameter: {}" throttle 5 + event InvalidDiv4Param(div4: U8) severity warning high format "VEML6031 invalid effective photodiode size parameter: {}" throttle 5 @ Event for reporting sensor attribute set failure - event SensorAttrSetFailed(attr: U16, val: U8, ret: I32) severity warning high format "VELM6031 sensor attribute {}={} set failed with return code: {}" throttle 5 + event SensorAttrSetFailed(attr: U16, val: U8, ret: I32) severity warning high format "VEML6031 sensor attribute {}={} set failed with return code: {}" throttle 5 ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp similarity index 83% rename from FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp rename to FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp index 0ed53ddc..a5455292 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp @@ -1,14 +1,14 @@ // ====================================================================== -// \title Velm6031Manager.hpp -// \brief hpp file for Velm6031Manager component implementation class +// \title Veml6031Manager.hpp +// \brief hpp file for Veml6031Manager component implementation class // ====================================================================== -#ifndef Components_Velm6031Manager_HPP -#define Components_Velm6031Manager_HPP +#ifndef Components_Veml6031Manager_HPP +#define Components_Veml6031Manager_HPP #include -#include "FprimeZephyrReference/Components/Drv/Velm6031Manager/Velm6031ManagerComponentAc.hpp" +#include "FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031ManagerComponentAc.hpp" #include #include #include @@ -19,18 +19,18 @@ namespace Drv { -class Velm6031Manager final : public Velm6031ManagerComponentBase { +class Veml6031Manager final : public Veml6031ManagerComponentBase { public: // ---------------------------------------------------------------------- // Component construction and destruction // ---------------------------------------------------------------------- - //! Construct Velm6031Manager object - Velm6031Manager(const char* const compName //!< The component name + //! Construct Veml6031Manager object + Veml6031Manager(const char* const compName //!< The component name ); - //! Destroy Velm6031Manager object - ~Velm6031Manager(); + //! Destroy Veml6031Manager object + ~Veml6031Manager(); public: // ---------------------------------------------------------------------- @@ -59,7 +59,7 @@ class Velm6031Manager final : public Velm6031ManagerComponentBase { //! Handler implementation for loadSwitchStateChanged //! - //! Port to initialize and deinitialize the VELM6031 device on load switch state change + //! Port to initialize and deinitialize the VEML6031 device on load switch state change Fw::Success loadSwitchStateChanged_handler(FwIndexType portNum, //!< The port number const Fw::On& state) override; @@ -89,16 +89,16 @@ class Velm6031Manager final : public Velm6031ManagerComponentBase { //! Check if the load switch is ready (on and timeout passed) bool loadSwitchReady(); - //! Set the integration time attribute for the VELM6031 sensor + //! Set the integration time attribute for the VEML6031 sensor Fw::Success setIntegrationTimeAttribute(sensor_channel chan); - //! Set the gain attribute for the VELM6031 sensor + //! Set the gain attribute for the VEML6031 sensor Fw::Success setGainAttribute(sensor_channel chan); - //! Set the div4 attribute for the VELM6031 sensor + //! Set the div4 attribute for the VEML6031 sensor Fw::Success setDiv4Attribute(sensor_channel chan); - //! Set all sensor attributes for the VELM6031 sensor + //! Set all sensor attributes for the VEML6031 sensor Fw::Success configureSensorAttributes(sensor_channel chan); private: diff --git a/FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md b/FprimeZephyrReference/Components/Drv/Veml6031Manager/docs/sdd.md similarity index 97% rename from FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md rename to FprimeZephyrReference/Components/Drv/Veml6031Manager/docs/sdd.md index 2f35f91e..f0672bcd 100644 --- a/FprimeZephyrReference/Components/Drv/Velm6031Manager/docs/sdd.md +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/docs/sdd.md @@ -1,4 +1,4 @@ -# Components::Velm6031Manager +# Components::Veml6031Manager Component for reading light sensor data diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 24efcb9e..df0baf83 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -121,27 +121,27 @@ telemetry packets ReferenceDeploymentPackets { } packet LightSensor id 14 group 4 { - ReferenceDeployment.velm6031Face0Manager.VisibleLight - # ReferenceDeployment.velm6031Face1Manager.RawLightData - # ReferenceDeployment.velm6031Face2Manager.RawLightData - # ReferenceDeployment.velm6031Face3Manager.RawLightData - # ReferenceDeployment.velm6031Face5Manager.RawLightData - # ReferenceDeployment.velm6031Face6Manager.RawLightData - # ReferenceDeployment.velm6031Face7Manager.RawLightData - ReferenceDeployment.velm6031Face0Manager.InfraRedLight - # ReferenceDeployment.velm6031Face1Manager.IRLightData - # ReferenceDeployment.velm6031Face2Manager.IRLightData - # ReferenceDeployment.velm6031Face3Manager.IRLightData - # ReferenceDeployment.velm6031Face5Manager.IRLightData - # ReferenceDeployment.velm6031Face6Manager.IRLightData - # ReferenceDeployment.velm6031Face7Manager.IRLightData - ReferenceDeployment.velm6031Face0Manager.AmbientLight - # ReferenceDeployment.velm6031Face1Manager.ALSLightData - # ReferenceDeployment.velm6031Face2Manager.ALSLightData - # ReferenceDeployment.velm6031Face3Manager.ALSLightData - # ReferenceDeployment.velm6031Face5Manager.ALSLightData - # ReferenceDeployment.velm6031Face6Manager.ALSLightData - # ReferenceDeployment.velm6031Face7Manager.ALSLightData + ReferenceDeployment.veml6031Face0Manager.VisibleLight + # ReferenceDeployment.veml6031Face1Manager.RawLightData + # ReferenceDeployment.veml6031Face2Manager.RawLightData + # ReferenceDeployment.veml6031Face3Manager.RawLightData + # ReferenceDeployment.veml6031Face5Manager.RawLightData + # ReferenceDeployment.veml6031Face6Manager.RawLightData + # ReferenceDeployment.veml6031Face7Manager.RawLightData + ReferenceDeployment.veml6031Face0Manager.InfraRedLight + # ReferenceDeployment.veml6031Face1Manager.IRLightData + # ReferenceDeployment.veml6031Face2Manager.IRLightData + # ReferenceDeployment.veml6031Face3Manager.IRLightData + # ReferenceDeployment.veml6031Face5Manager.IRLightData + # ReferenceDeployment.veml6031Face6Manager.IRLightData + # ReferenceDeployment.veml6031Face7Manager.IRLightData + ReferenceDeployment.veml6031Face0Manager.AmbientLight + # ReferenceDeployment.veml6031Face1Manager.ALSLightData + # ReferenceDeployment.veml6031Face2Manager.ALSLightData + # ReferenceDeployment.veml6031Face3Manager.ALSLightData + # ReferenceDeployment.veml6031Face5Manager.ALSLightData + # ReferenceDeployment.veml6031Face6Manager.ALSLightData + # ReferenceDeployment.veml6031Face7Manager.ALSLightData } } omit { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 9b9b51f3..d6406ec3 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -141,14 +141,14 @@ void setupTopology(const TopologyState& state) { tmp112BattCell3Manager.configure(state.battCell3TempDevice); tmp112BattCell4Manager.configure(state.battCell4TempDevice); - // Configure all 7 VELM6031 light sensor managers - velm6031Face0Manager.configure(state.face0LightDevice); - // velm6031Face1Manager.configure(state.face1LightDevice); - // velm6031Face2Manager.configure(state.face2LightDevice); - // velm6031Face3Manager.configure(state.face3LightDevice); - // velm6031Face5Manager.configure(state.face5LightDevice); - // velm6031Face6Manager.configure(state.face6LightDevice); - // velm6031Face7Manager.configure(state.face7LightDevice); + // Configure all 7 VEML6031 light sensor managers + veml6031Face0Manager.configure(state.face0LightDevice); + // veml6031Face1Manager.configure(state.face1LightDevice); + // veml6031Face2Manager.configure(state.face2LightDevice); + // veml6031Face3Manager.configure(state.face3LightDevice); + // veml6031Face5Manager.configure(state.face5LightDevice); + // veml6031Face6Manager.configure(state.face6LightDevice); + // veml6031Face7Manager.configure(state.face7LightDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 1d5d3e3d..94b9311c 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -187,18 +187,18 @@ module ReferenceDeployment { instance adcs: Components.ADCS base id 0x10054000 - instance velm6031Face0Manager: Drv.Velm6031Manager base id 0x10055000 + instance veml6031Face0Manager: Drv.Veml6031Manager base id 0x10055000 - instance velm6031Face1Manager: Drv.Velm6031Manager base id 0x10056000 + instance veml6031Face1Manager: Drv.Veml6031Manager base id 0x10056000 - instance velm6031Face2Manager: Drv.Velm6031Manager base id 0x10057000 + instance veml6031Face2Manager: Drv.Veml6031Manager base id 0x10057000 - instance velm6031Face3Manager: Drv.Velm6031Manager base id 0x10058000 + instance veml6031Face3Manager: Drv.Veml6031Manager base id 0x10058000 - instance velm6031Face5Manager: Drv.Velm6031Manager base id 0x10059000 + instance veml6031Face5Manager: Drv.Veml6031Manager base id 0x10059000 - instance velm6031Face6Manager: Drv.Velm6031Manager base id 0x1005A000 + instance veml6031Face6Manager: Drv.Veml6031Manager base id 0x1005A000 - instance velm6031Face7Manager: Drv.Velm6031Manager base id 0x1005B000 + instance veml6031Face7Manager: Drv.Veml6031Manager base id 0x1005B000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index f93b96bf..49741a9b 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -92,13 +92,13 @@ module ReferenceDeployment { instance resetManager instance modeManager instance adcs - instance velm6031Face0Manager - # instance velm6031Face1Manager - # instance velm6031Face2Manager - # instance velm6031Face3Manager - # instance velm6031Face5Manager - # instance velm6031Face6Manager - # instance velm6031Face7Manager + instance veml6031Face0Manager + # instance veml6031Face1Manager + # instance veml6031Face2Manager + # instance veml6031Face3Manager + # instance veml6031Face5Manager + # instance veml6031Face6Manager + # instance veml6031Face7Manager # ---------------------------------------------------------------------- @@ -231,7 +231,7 @@ module ReferenceDeployment { face0LoadSwitch.gpioSet -> gpioface0LS.gpioWrite face0LoadSwitch.gpioGet -> gpioface0LS.gpioRead face0LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face0Manager.loadSwitchStateChanged - face0LoadSwitch.loadSwitchStateChanged[1] -> velm6031Face0Manager.loadSwitchStateChanged + face0LoadSwitch.loadSwitchStateChanged[1] -> veml6031Face0Manager.loadSwitchStateChanged face1LoadSwitch.gpioSet -> gpioface1LS.gpioWrite face1LoadSwitch.gpioGet -> gpioface1LS.gpioRead @@ -332,12 +332,12 @@ module ReferenceDeployment { } connections adcs { - adcs.visibleLightGet[0] -> velm6031Face0Manager.visibleLightGet - # adcs.visibleLightGet[1] -> velm6031Face1Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[2] -> velm6031Face2Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[3] -> velm6031Face3Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[4] -> velm6031Face5Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[5] -> velm6031Face6Manager.visibleLightGet --- IGNORE + adcs.visibleLightGet[0] -> veml6031Face0Manager.visibleLightGet + # adcs.visibleLightGet[1] -> veml6031Face1Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[2] -> veml6031Face2Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[3] -> veml6031Face3Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[4] -> veml6031Face5Manager.visibleLightGet --- IGNORE --- + # adcs.visibleLightGet[5] -> veml6031Face6Manager.visibleLightGet --- IGNORE } connections ModeManager { diff --git a/prj.conf b/prj.conf index f26c071f..d54b91ee 100644 --- a/prj.conf +++ b/prj.conf @@ -39,7 +39,7 @@ CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y CONFIG_DYNAMIC_THREAD_ALLOC=n CONFIG_DYNAMIC_THREAD_PREFER_POOL=y -CONFIG_DYNAMIC_THREAD_POOL_SIZE=33 +CONFIG_DYNAMIC_THREAD_POOL_SIZE=30 # Num threads in the thread pool CONFIG_DYNAMIC_THREAD_STACK_SIZE=8192 # Size of thread stack in thread pool, must be >= Thread Pool size in F' From d8c5b7fcf3cdbaa657b094618e83118b310eeb91 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Mon, 1 Dec 2025 18:51:44 -0600 Subject: [PATCH 57/68] bump max packets --- FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp index f116344b..16071fc2 100644 --- a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp +++ b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp @@ -16,7 +16,7 @@ #include namespace Svc { -static const FwChanIdType MAX_PACKETIZER_PACKETS = 10; +static const FwChanIdType MAX_PACKETIZER_PACKETS = 13; static const FwChanIdType TLMPACKETIZER_NUM_TLM_HASH_SLOTS = 15; // !< Number of slots in the hash table. // Works best when set to about twice the number of components producing telemetry From 8a0a201cb08d62956267a6c93a178a324bdb45d4 Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Tue, 2 Dec 2025 16:46:10 -0800 Subject: [PATCH 58/68] Increase Health Queue and Decrease Thread Stack Size --- .../ReferenceDeployment/Top/instances.fpp | 2 +- FprimeZephyrReference/project/config/CdhCoreConfig.fpp | 8 ++++---- FprimeZephyrReference/project/config/ComCcsdsConfig.fpp | 4 ++-- .../project/config/FileHandlingConfig.fpp | 8 ++++---- prj.conf | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index a2cd9211..42bae188 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -20,7 +20,7 @@ module ReferenceDeployment { module Default { constant QUEUE_SIZE = 10 - constant STACK_SIZE = 8 * 1024 # Must match prj.conf thread stack size + constant STACK_SIZE = 4 * 1024 # Must match prj.conf thread stack size } # ---------------------------------------------------------------------- diff --git a/FprimeZephyrReference/project/config/CdhCoreConfig.fpp b/FprimeZephyrReference/project/config/CdhCoreConfig.fpp index 36c77be5..be3e0a37 100644 --- a/FprimeZephyrReference/project/config/CdhCoreConfig.fpp +++ b/FprimeZephyrReference/project/config/CdhCoreConfig.fpp @@ -6,14 +6,14 @@ module CdhCoreConfig { constant cmdDisp = 10 constant events = 25 constant tlmSend = 5 - constant $health = 10 + constant $health = 20 } module StackSizes { - constant cmdDisp = 8 * 1024 # Must match prj.conf thread stack size - constant events = 8 * 1024 # Must match prj.conf thread stack size - constant tlmSend = 8 * 1024 # Must match prj.conf thread stack size + constant cmdDisp = 4 * 1024 # Must match prj.conf thread stack size + constant events = 4 * 1024 # Must match prj.conf thread stack size + constant tlmSend = 4 * 1024 # Must match prj.conf thread stack size } module Priorities { diff --git a/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp b/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp index c39d3778..9d0bddf8 100644 --- a/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp +++ b/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp @@ -9,8 +9,8 @@ module ComCcsdsConfig { } module StackSizes { - constant comQueue = 8 * 1024 # Must match prj.conf thread stack size - constant aggregator = 8 * 1024 # Must match prj.conf thread stack size + constant comQueue = 4 * 1024 # Must match prj.conf thread stack size + constant aggregator = 4 * 1024 # Must match prj.conf thread stack size } module Priorities { diff --git a/FprimeZephyrReference/project/config/FileHandlingConfig.fpp b/FprimeZephyrReference/project/config/FileHandlingConfig.fpp index 1074f62c..4af8199c 100644 --- a/FprimeZephyrReference/project/config/FileHandlingConfig.fpp +++ b/FprimeZephyrReference/project/config/FileHandlingConfig.fpp @@ -10,10 +10,10 @@ module FileHandlingConfig { } module StackSizes { - constant fileUplink = 8 * 1024 - constant fileDownlink = 8 * 1024 - constant fileManager = 8 * 1024 - constant prmDb = 8 * 1024 + constant fileUplink = 4 * 1024 + constant fileDownlink = 4 * 1024 + constant fileManager = 4 * 1024 + constant prmDb = 4 * 1024 } module Priorities { diff --git a/prj.conf b/prj.conf index 6c8cb703..743d7d1f 100644 --- a/prj.conf +++ b/prj.conf @@ -41,7 +41,7 @@ CONFIG_DYNAMIC_THREAD_ALLOC=n CONFIG_DYNAMIC_THREAD_PREFER_POOL=y CONFIG_DYNAMIC_THREAD_POOL_SIZE=30 # Num threads in the thread pool -CONFIG_DYNAMIC_THREAD_STACK_SIZE=8192 +CONFIG_DYNAMIC_THREAD_STACK_SIZE=4096 # Size of thread stack in thread pool, must be >= Thread Pool size in F' CONFIG_THREAD_STACK_INFO=y From b2bea66fb3e537cda2a399d4c9f72fd6babd9a0a Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Tue, 2 Dec 2025 23:27:17 -0600 Subject: [PATCH 59/68] Remove generic health monitor component --- .../Components/CMakeLists.txt | 1 - .../Drv/Tmp112Manager/TMP112Manager.cpp | 16 +- .../Drv/Tmp112Manager/TMP112Manager.fpp | 6 - .../Drv/Tmp112Manager/TMP112Manager.hpp | 14 +- .../Drv/Veml6031Manager/Veml6031Manager.cpp | 8 +- .../Drv/Veml6031Manager/Veml6031Manager.fpp | 9 - .../Drv/Veml6031Manager/Veml6031Manager.hpp | 10 +- .../GenericDeviceMonitor/CMakeLists.txt | 36 ---- .../GenericDeviceMonitor.cpp | 45 ----- .../GenericDeviceMonitor.fpp | 38 ----- .../GenericDeviceMonitor.hpp | 65 ------- .../GenericDeviceMonitor/docs/sdd.md | 66 -------- .../ReferenceDeployment/Main.cpp | 12 +- .../Top/ReferenceDeploymentPackets.fppi | 54 +++--- .../Top/ReferenceDeploymentTopology.cpp | 42 ++--- .../Top/ReferenceDeploymentTopologyDefs.hpp | 12 +- .../ReferenceDeployment/Top/instances.fpp | 160 +++++++----------- .../ReferenceDeployment/Top/topology.fpp | 83 +++------ .../project/config/AcConstants.fpp | 2 +- 19 files changed, 162 insertions(+), 517 deletions(-) delete mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt delete mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp delete mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp delete mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp delete mode 100644 FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index 307b05de..a3589964 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -8,7 +8,6 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComDelay/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Drv/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FsSpace/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ModeManager/") diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 1875cc3b..943a9acf 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -23,8 +23,15 @@ Tmp112Manager ::~Tmp112Manager() {} // Helper methods // ---------------------------------------------------------------------- -void Tmp112Manager::configure(const struct device* dev) { +void Tmp112Manager::configure(const struct device* tca, + const struct device* mux, + const struct device* dev, + bool loadSwitchCheck) { + this->m_tca = tca; + this->m_mux = mux; this->m_dev = dev; + // TODO(nateinaction): Abstract load switch check, perhaps wrap this component and only use when needed? + this->m_load_switch_check = loadSwitchCheck; } // ---------------------------------------------------------------------- @@ -105,13 +112,13 @@ Fw::Success Tmp112Manager ::initializeDevice() { return Fw::Success::SUCCESS; } - if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { + if (!device_is_ready(this->m_tca)) { this->log_WARNING_HI_TcaUnhealthy(); return Fw::Success::FAILURE; } this->log_WARNING_HI_TcaUnhealthy_ThrottleClear(); - if (this->muxHealthGet_out(0) != Fw::Health::HEALTHY) { + if (!device_is_ready(this->m_mux)) { this->log_WARNING_HI_MuxUnhealthy(); return Fw::Success::FAILURE; } @@ -151,7 +158,8 @@ Fw::Success Tmp112Manager ::deinitializeDevice() { } bool Tmp112Manager ::loadSwitchReady() { - return this->m_load_switch_state == Fw::On::ON && this->getTime() >= this->m_load_switch_on_timeout; + return (this->m_load_switch_state == Fw::On::ON && this->getTime() >= this->m_load_switch_on_timeout) || + !this->m_load_switch_check; } } // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp index 5eed08dc..81173781 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.fpp @@ -12,12 +12,6 @@ module Drv { @ Port to initialize and deinitialize the TMP112 device on load switch state change sync input port loadSwitchStateChanged: Components.loadSwitchStateChanged - @ Output port to check device TCA health - output port tcaHealthGet: Components.HealthGet - - @ Output port to check device MUX health - output port muxHealthGet: Components.HealthGet - # Telemetry channels @ Telemetry channel for temperature in degrees Celsius diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp index 2414ae1b..cc45fc16 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.hpp @@ -31,7 +31,7 @@ class Tmp112Manager final : public Tmp112ManagerComponentBase { // ---------------------------------------------------------------------- //! Configure the TMP112 device - void configure(const struct device* dev); + void configure(const struct device* tca, const struct device* mux, const struct device* dev, bool loadSwitchCheck); private: // ---------------------------------------------------------------------- @@ -75,11 +75,11 @@ class Tmp112Manager final : public Tmp112ManagerComponentBase { //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; - //! TCA health state - Fw::Health m_tca_state = Fw::Health::FAILED; + //! Zephyr device for the TCA + const struct device* m_tca; - //! MUX health state - Fw::Health m_mux_state = Fw::Health::FAILED; + //! Zephyr device for the mux + const struct device* m_mux; //! Load switch state Fw::On m_load_switch_state = Fw::On::OFF; @@ -87,6 +87,10 @@ class Tmp112Manager final : public Tmp112ManagerComponentBase { //! Load switch on timeout //! Time when we can consider the load switch to be fully on (giving time for power to normalize) Fw::Time m_load_switch_on_timeout; + + //! Load switch check + //! Available to disable if the component is not powered by a load switch + bool m_load_switch_check = true; }; } // namespace Drv diff --git a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp index 1e520f7c..216e4b12 100644 --- a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp @@ -24,7 +24,9 @@ Veml6031Manager ::~Veml6031Manager() {} // Public helper methods // ---------------------------------------------------------------------- -void Veml6031Manager ::configure(const struct device* dev) { +void Veml6031Manager ::configure(const struct device* tca, const struct device* mux, const struct device* dev) { + this->m_tca = tca; + this->m_mux = mux; this->m_dev = dev; } @@ -160,13 +162,13 @@ Fw::Success Veml6031Manager ::initializeDevice() { return Fw::Success::SUCCESS; } - if (this->tcaHealthGet_out(0) != Fw::Health::HEALTHY) { + if (!device_is_ready(this->m_tca)) { this->log_WARNING_HI_TcaUnhealthy(); return Fw::Success::FAILURE; } this->log_WARNING_HI_TcaUnhealthy_ThrottleClear(); - if (this->muxHealthGet_out(0) != Fw::Health::HEALTHY) { + if (!device_is_ready(this->m_mux)) { this->log_WARNING_HI_MuxUnhealthy(); return Fw::Success::FAILURE; } diff --git a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp index 38e5ef9f..2bd567b5 100644 --- a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp @@ -80,15 +80,6 @@ module Drv { @ Port to initialize and deinitialize the VEML6031 device on load switch state change sync input port loadSwitchStateChanged: Components.loadSwitchStateChanged - @ Output port to check device TCA health - output port tcaHealthGet: Components.HealthGet - - @ Output port to check device MUX health - output port muxHealthGet: Components.HealthGet - - @ Port for reading gpio status - output port gpioRead: Drv.GpioRead - #### Events #### @ Event for reporting VEML6031 not ready error diff --git a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp index a5455292..f2552ede 100644 --- a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.hpp @@ -38,7 +38,7 @@ class Veml6031Manager final : public Veml6031ManagerComponentBase { // ---------------------------------------------------------------------- //! Configure the TMP112 device - void configure(const struct device* dev); + void configure(const struct device* tca, const struct device* mux, const struct device* dev); private: // ---------------------------------------------------------------------- @@ -109,11 +109,11 @@ class Veml6031Manager final : public Veml6031ManagerComponentBase { //! Zephyr device stores the initialized TMP112 sensor const struct device* m_dev; - //! TCA health state - Fw::Health m_tca_state = Fw::Health::FAILED; + //! Zephyr device for the TCA + const struct device* m_tca; - //! MUX health state - Fw::Health m_mux_state = Fw::Health::FAILED; + //! Zephyr device for the mux + const struct device* m_mux; //! Load switch state Fw::On m_load_switch_state = Fw::On::OFF; diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt b/FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt deleted file mode 100644 index 731a72e3..00000000 --- a/FprimeZephyrReference/Components/GenericDeviceMonitor/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -#### -# F Prime CMakeLists.txt: -# -# SOURCES: list of source files (to be compiled) -# AUTOCODER_INPUTS: list of files to be passed to the autocoders -# DEPENDS: list of libraries that this module depends on -# -# More information in the F´ CMake API documentation: -# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ -# -#### - -# Module names are derived from the path from the nearest project/library/framework -# root when not specifically overridden by the developer. i.e. The module defined by -# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. - -register_fprime_library( - AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor.fpp" - SOURCES - "${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor.cpp" -# DEPENDS -# MyPackage_MyOtherModule -) - -### Unit Tests ### -# register_fprime_ut( -# AUTOCODER_INPUTS -# "${CMAKE_CURRENT_LIST_DIR}/GenericDeviceMonitor.fpp" -# SOURCES -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/GenericDeviceMonitorTestMain.cpp" -# "${CMAKE_CURRENT_LIST_DIR}/test/ut/GenericDeviceMonitorTester.cpp" -# DEPENDS -# STest # For rules-based testing -# UT_AUTO_HELPERS -# ) diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp deleted file mode 100644 index 17bca66e..00000000 --- a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// ====================================================================== -// \title GenericDeviceMonitor.cpp -// \author nate -// \brief cpp file for GenericDeviceMonitor component implementation class -// ====================================================================== - -#include "FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp" - -namespace Components { - -// ---------------------------------------------------------------------- -// Component construction and destruction -// ---------------------------------------------------------------------- - -GenericDeviceMonitor ::GenericDeviceMonitor(const char* const compName) : GenericDeviceMonitorComponentBase(compName) {} - -GenericDeviceMonitor ::~GenericDeviceMonitor() {} - -// ---------------------------------------------------------------------- -// Helper methods -// ---------------------------------------------------------------------- - -void GenericDeviceMonitor::configure(const struct device* dev) { - this->m_dev = dev; -} - -// ---------------------------------------------------------------------- -// Handler implementations for typed input ports -// ---------------------------------------------------------------------- - -Fw::Health GenericDeviceMonitor ::healthGet_handler(FwIndexType portNum) { - return device_is_ready(this->m_dev) ? Fw::Health::HEALTHY : Fw::Health::FAILED; -} - -void GenericDeviceMonitor ::run_handler(FwIndexType portNum, U32 context) { - if (!device_is_ready(this->m_dev)) { - this->tlmWrite_Healthy(Fw::Health::FAILED); - this->log_WARNING_LO_DeviceNotReady(); - return; - } - - this->tlmWrite_Healthy(Fw::Health::HEALTHY); -} - -} // namespace Components diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp deleted file mode 100644 index e5da4abc..00000000 --- a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.fpp +++ /dev/null @@ -1,38 +0,0 @@ -module Components { - port HealthGet -> Fw.Health -} - -module Components { - @ Generic Device Health Reporter - @ Use for devices which only need to report simple health status and have no interactivity - passive component GenericDeviceMonitor { - - @ Port receiving calls from the rate group - sync input port run: Svc.Sched - - @ Port receiving calls to request device health - sync input port healthGet: HealthGet - - @ Telemetry showing device health - telemetry Healthy: Fw.Health - - @ Event indicating device not ready - event DeviceNotReady() severity warning low id 0 format "Device not ready" throttle 5 - - ############################################################################### - # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # - ############################################################################### - @ Port for requesting the current time - time get port timeCaller - - @ Port for sending textual representation of events - text event port logTextOut - - @ Port for sending events to downlink - event port logOut - - @ Port for sending telemetry channels to downlink - telemetry port tlmOut - - } -} diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp b/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp deleted file mode 100644 index ea0d741f..00000000 --- a/FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitor.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// ====================================================================== -// \title GenericDeviceMonitor.hpp -// \author nate -// \brief hpp file for GenericDeviceMonitor component implementation class -// ====================================================================== - -#ifndef Components_GenericDeviceMonitor_HPP -#define Components_GenericDeviceMonitor_HPP - -#include "FprimeZephyrReference/Components/GenericDeviceMonitor/GenericDeviceMonitorComponentAc.hpp" -#include - -namespace Components { - -class GenericDeviceMonitor final : public GenericDeviceMonitorComponentBase { - public: - // ---------------------------------------------------------------------- - // Component construction and destruction - // ---------------------------------------------------------------------- - - //! Construct GenericDeviceMonitor object - GenericDeviceMonitor(const char* const compName //!< The component name - ); - - //! Destroy GenericDeviceMonitor object - ~GenericDeviceMonitor(); - - public: - // ---------------------------------------------------------------------- - // Public helper methods - // ---------------------------------------------------------------------- - - //! Configure the zephyr mux channel device - void configure(const struct device* dev); - - private: - // ---------------------------------------------------------------------- - // Handler implementations for typed input ports - // ---------------------------------------------------------------------- - - //! Handler implementation for healthGet - //! - //! Port receiving calls to request device health - Fw::Health healthGet_handler(FwIndexType portNum //!< The port number - ) override; - - //! Handler implementation for run - //! - //! Port receiving calls from the rate group - void run_handler(FwIndexType portNum, //!< The port number - U32 context //!< The call order - ) override; - - private: - // ---------------------------------------------------------------------- - // Private member variables - // ---------------------------------------------------------------------- - - //! Zephyr device stores the initialized mux channel - const struct device* m_dev; -}; - -} // namespace Components - -#endif diff --git a/FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md b/FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md deleted file mode 100644 index fb0ea3d4..00000000 --- a/FprimeZephyrReference/Components/GenericDeviceMonitor/docs/sdd.md +++ /dev/null @@ -1,66 +0,0 @@ -# Components::GenericDeviceMonitor - -Mux Channel Health Reporter - -## Usage Examples -Add usage examples here - -### Diagrams -Add diagrams here - -### Typical Usage -And the typical usage of the component here - -## Class Diagram -Add a class diagram here - -## Port Descriptions -| Name | Description | -|---|---| -|---|---| - -## Component States -Add component states in the chart below -| Name | Description | -|---|---| -|---|---| - -## Sequence Diagrams -Add sequence diagrams here - -## Parameters -| Name | Description | -|---|---| -|---|---| - -## Commands -| Name | Description | -|---|---| -|---|---| - -## Events -| Name | Description | -|---|---| -|---|---| - -## Telemetry -| Name | Description | -|---|---| -|---|---| - -## Unit Tests -Add unit test descriptions in the chart below -| Name | Description | Output | Coverage | -|---|---|---|---| -|---|---|---|---| - -## Requirements -Add requirements in the chart below -| Name | Description | Validation | -|---|---|---| -|---|---|---| - -## Change Log -| Date | Description | -|---|---| -|---| Initial Draft | diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index e3642197..16b871ce 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -86,12 +86,12 @@ int main(int argc, char* argv[]) { inputs.battCell4TempDevice = batt_cell4_temp_sens; // Light sensor devices inputs.face0LightDevice = face0_light_sens; - // inputs.face1LightDevice = face1_light_sens; - // inputs.face2LightDevice = face2_light_sens; - // inputs.face3LightDevice = face3_light_sens; - // inputs.face5LightDevice = face5_light_sens; - // inputs.face6LightDevice = face6_light_sens; - // inputs.face7LightDevice = face7_light_sens; + inputs.face1LightDevice = face1_light_sens; + inputs.face2LightDevice = face2_light_sens; + inputs.face3LightDevice = face3_light_sens; + inputs.face5LightDevice = face5_light_sens; + inputs.face6LightDevice = face6_light_sens; + inputs.face7LightDevice = face7_light_sens; inputs.baudRate = 115200; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 1771e858..c8f90f9a 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -9,7 +9,6 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.HiBuffs ReferenceDeployment.rateGroup10Hz.RgMaxTime ReferenceDeployment.rateGroup1Hz.RgMaxTime - ReferenceDeployment.rateGroup1_6Hz.RgMaxTime ReferenceDeployment.startupManager.BootCount ReferenceDeployment.startupManager.QuiescenceEndTime ReferenceDeployment.modeManager.CurrentMode @@ -24,7 +23,6 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.EmptyBuffs ReferenceDeployment.rateGroup10Hz.RgCycleSlips ReferenceDeployment.rateGroup1Hz.RgCycleSlips - ReferenceDeployment.rateGroup1_6Hz.RgCycleSlips } @@ -89,19 +87,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.powerMonitor.TotalPowerGenerated } - packet TcaMonitor id 12 group 4 { - ReferenceDeployment.tcaMonitor.Healthy - ReferenceDeployment.muxChannel0Monitor.Healthy - ReferenceDeployment.muxChannel1Monitor.Healthy - ReferenceDeployment.muxChannel2Monitor.Healthy - ReferenceDeployment.muxChannel3Monitor.Healthy - ReferenceDeployment.muxChannel4Monitor.Healthy - ReferenceDeployment.muxChannel5Monitor.Healthy - ReferenceDeployment.muxChannel6Monitor.Healthy - ReferenceDeployment.muxChannel7Monitor.Healthy - } - - packet Thermal id 13 group 4 { + packet Thermal id 12 group 4 { ReferenceDeployment.tmp112Face0Manager.Temperature ReferenceDeployment.tmp112Face1Manager.Temperature ReferenceDeployment.tmp112Face2Manager.Temperature @@ -113,28 +99,28 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.tmp112BattCell4Manager.Temperature } - packet LightSensor id 14 group 4 { + packet LightSensor id 13 group 4 { ReferenceDeployment.veml6031Face0Manager.VisibleLight - # ReferenceDeployment.veml6031Face1Manager.RawLightData - # ReferenceDeployment.veml6031Face2Manager.RawLightData - # ReferenceDeployment.veml6031Face3Manager.RawLightData - # ReferenceDeployment.veml6031Face5Manager.RawLightData - # ReferenceDeployment.veml6031Face6Manager.RawLightData - # ReferenceDeployment.veml6031Face7Manager.RawLightData + ReferenceDeployment.veml6031Face1Manager.VisibleLight + ReferenceDeployment.veml6031Face2Manager.VisibleLight + ReferenceDeployment.veml6031Face3Manager.VisibleLight + ReferenceDeployment.veml6031Face5Manager.VisibleLight + ReferenceDeployment.veml6031Face6Manager.VisibleLight + ReferenceDeployment.veml6031Face7Manager.VisibleLight ReferenceDeployment.veml6031Face0Manager.InfraRedLight - # ReferenceDeployment.veml6031Face1Manager.IRLightData - # ReferenceDeployment.veml6031Face2Manager.IRLightData - # ReferenceDeployment.veml6031Face3Manager.IRLightData - # ReferenceDeployment.veml6031Face5Manager.IRLightData - # ReferenceDeployment.veml6031Face6Manager.IRLightData - # ReferenceDeployment.veml6031Face7Manager.IRLightData + ReferenceDeployment.veml6031Face1Manager.InfraRedLight + ReferenceDeployment.veml6031Face2Manager.InfraRedLight + ReferenceDeployment.veml6031Face3Manager.InfraRedLight + ReferenceDeployment.veml6031Face5Manager.InfraRedLight + ReferenceDeployment.veml6031Face6Manager.InfraRedLight + ReferenceDeployment.veml6031Face7Manager.InfraRedLight ReferenceDeployment.veml6031Face0Manager.AmbientLight - # ReferenceDeployment.veml6031Face1Manager.ALSLightData - # ReferenceDeployment.veml6031Face2Manager.ALSLightData - # ReferenceDeployment.veml6031Face3Manager.ALSLightData - # ReferenceDeployment.veml6031Face5Manager.ALSLightData - # ReferenceDeployment.veml6031Face6Manager.ALSLightData - # ReferenceDeployment.veml6031Face7Manager.ALSLightData + ReferenceDeployment.veml6031Face1Manager.AmbientLight + ReferenceDeployment.veml6031Face2Manager.AmbientLight + ReferenceDeployment.veml6031Face3Manager.AmbientLight + ReferenceDeployment.veml6031Face5Manager.AmbientLight + ReferenceDeployment.veml6031Face6Manager.AmbientLight + ReferenceDeployment.veml6031Face7Manager.AmbientLight } } omit { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index d6406ec3..6326cdf2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -67,7 +67,7 @@ void configureTopology() { // Rate groups require context arrays. rateGroup10Hz.configure(rateGroup10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup10HzContext)); rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); - rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); + // rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); cmdSeq.allocateBuffer(0, mallocator, 5 * 1024); @@ -121,34 +121,26 @@ void setupTopology(const TopologyState& state) { lis2mdlManager.configure(state.lis2mdlDevice); ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); - tcaMonitor.configure(state.tca9548aDevice); - muxChannel0Monitor.configure(state.muxChannel0Device); - muxChannel1Monitor.configure(state.muxChannel1Device); - muxChannel2Monitor.configure(state.muxChannel2Device); - muxChannel3Monitor.configure(state.muxChannel3Device); - muxChannel4Monitor.configure(state.muxChannel4Device); - muxChannel5Monitor.configure(state.muxChannel5Device); - muxChannel7Monitor.configure(state.muxChannel7Device); // Configure all 11 TMP112 temperature sensor managers - tmp112Face0Manager.configure(state.face0TempDevice); - tmp112Face1Manager.configure(state.face1TempDevice); - tmp112Face2Manager.configure(state.face2TempDevice); - tmp112Face3Manager.configure(state.face3TempDevice); - tmp112Face5Manager.configure(state.face5TempDevice); - tmp112BattCell1Manager.configure(state.battCell1TempDevice); - tmp112BattCell2Manager.configure(state.battCell2TempDevice); - tmp112BattCell3Manager.configure(state.battCell3TempDevice); - tmp112BattCell4Manager.configure(state.battCell4TempDevice); + tmp112Face0Manager.configure(state.tca9548aDevice, state.muxChannel0Device, state.face0TempDevice, true); + tmp112Face1Manager.configure(state.tca9548aDevice, state.muxChannel1Device, state.face1TempDevice, true); + tmp112Face2Manager.configure(state.tca9548aDevice, state.muxChannel2Device, state.face2TempDevice, true); + tmp112Face3Manager.configure(state.tca9548aDevice, state.muxChannel3Device, state.face3TempDevice, true); + tmp112Face5Manager.configure(state.tca9548aDevice, state.muxChannel5Device, state.face5TempDevice, true); + tmp112BattCell1Manager.configure(state.tca9548aDevice, state.muxChannel4Device, state.battCell1TempDevice, false); + tmp112BattCell2Manager.configure(state.tca9548aDevice, state.muxChannel4Device, state.battCell2TempDevice, false); + tmp112BattCell3Manager.configure(state.tca9548aDevice, state.muxChannel4Device, state.battCell3TempDevice, false); + tmp112BattCell4Manager.configure(state.tca9548aDevice, state.muxChannel4Device, state.battCell4TempDevice, false); // Configure all 7 VEML6031 light sensor managers - veml6031Face0Manager.configure(state.face0LightDevice); - // veml6031Face1Manager.configure(state.face1LightDevice); - // veml6031Face2Manager.configure(state.face2LightDevice); - // veml6031Face3Manager.configure(state.face3LightDevice); - // veml6031Face5Manager.configure(state.face5LightDevice); - // veml6031Face6Manager.configure(state.face6LightDevice); - // veml6031Face7Manager.configure(state.face7LightDevice); + veml6031Face0Manager.configure(state.tca9548aDevice, state.muxChannel0Device, state.face0LightDevice); + veml6031Face1Manager.configure(state.tca9548aDevice, state.muxChannel1Device, state.face1LightDevice); + veml6031Face2Manager.configure(state.tca9548aDevice, state.muxChannel2Device, state.face2LightDevice); + veml6031Face3Manager.configure(state.tca9548aDevice, state.muxChannel3Device, state.face3LightDevice); + veml6031Face5Manager.configure(state.tca9548aDevice, state.muxChannel5Device, state.face5LightDevice); + veml6031Face6Manager.configure(state.tca9548aDevice, state.muxChannel6Device, state.face6LightDevice); + veml6031Face7Manager.configure(state.tca9548aDevice, state.muxChannel7Device, state.face7LightDevice); } void startRateGroups() { diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index c6dd5eb2..19d72cea 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -107,12 +107,12 @@ struct TopologyState { const device* battCell4TempDevice; //!< TMP112 device for battery cell 4 // - Light sensors const device* face0LightDevice; //!< Light sensor device for cube face 0 - // const device* face1LightDevice; //!< Light sensor device for cube face 1 - // const device* face2LightDevice; //!< Light sensor device for cube face 2 - // const device* face3LightDevice; //!< Light sensor device for cube face 3 - // const device* face5LightDevice; //!< Light sensor device for cube face 5 - // const device* face6LightDevice; //!< Light sensor device for cube face 6 - // const device* face7LightDevice; //!< Light sensor device for cube face 7 + const device* face1LightDevice; //!< Light sensor device for cube face 1 + const device* face2LightDevice; //!< Light sensor device for cube face 2 + const device* face3LightDevice; //!< Light sensor device for cube face 3 + const device* face5LightDevice; //!< Light sensor device for cube face 5 + const device* face6LightDevice; //!< Light sensor device for cube face 6 + const device* face7LightDevice; //!< Light sensor device for cube face 7 }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 94b9311c..ca50782c 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -42,17 +42,17 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \ + instance cmdSeq: Svc.CmdSequencer base id 0x10004000 \ queue size Default.QUEUE_SIZE * 2 \ stack size Default.STACK_SIZE \ priority 15 - instance prmDb: Svc.PrmDb base id 0x1000B000 \ + instance prmDb: Svc.PrmDb base id 0x10005000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 14 - instance modeManager: Components.ModeManager base id 0x10040000 \ + instance modeManager: Components.ModeManager base id 0x10006000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 16 @@ -85,120 +85,78 @@ module ReferenceDeployment { instance lsm6dsoManager: Drv.Lsm6dsoManager base id 0x10019000 - instance bootloaderTrigger: Components.BootloaderTrigger base id 0x10020000 + instance bootloaderTrigger: Components.BootloaderTrigger base id 0x1001A000 - instance burnwire: Components.Burnwire base id 0x10021000 + instance burnwire: Components.Burnwire base id 0x1001B000 - instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10022000 + instance comDelay: Components.ComDelay base id 0x1001C000 - instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10023000 + instance comSplitterEvents: Svc.ComSplitter base id 0x1001D000 - instance comDelay: Components.ComDelay base id 0x10025000 + instance comSplitterTelemetry: Svc.ComSplitter base id 0x1001E000 - instance lora: Zephyr.LoRa base id 0x10026000 + instance lora: Zephyr.LoRa base id 0x1001F000 - instance comSplitterEvents: Svc.ComSplitter base id 0x10027000 + instance antennaDeployer: Components.AntennaDeployer base id 0x10020000 - instance comSplitterTelemetry: Svc.ComSplitter base id 0x10028000 + instance fsSpace: Components.FsSpace base id 0x10021000 - instance antennaDeployer: Components.AntennaDeployer base id 0x10029000 + instance resetManager: Components.ResetManager base id 0x10022000 - instance gpioface4LS: Zephyr.ZephyrGpioDriver base id 0x1002A000 + instance powerMonitor: Components.PowerMonitor base id 0x10023000 - instance gpioface0LS: Zephyr.ZephyrGpioDriver base id 0x1002B000 + instance startupManager: Components.StartupManager base id 0x10024000 - instance gpioface1LS: Zephyr.ZephyrGpioDriver base id 0x1002C000 + instance thermalManager: Components.ThermalManager base id 0x10025000 - instance gpioface2LS: Zephyr.ZephyrGpioDriver base id 0x1002D000 + instance adcs: Components.ADCS base id 0x10026000 - instance gpioface3LS: Zephyr.ZephyrGpioDriver base id 0x1002E000 + # GPIO Drivers + instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10027000 + instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10028000 + instance gpioface0LS: Zephyr.ZephyrGpioDriver base id 0x10029000 + instance gpioface1LS: Zephyr.ZephyrGpioDriver base id 0x1002A000 + instance gpioface2LS: Zephyr.ZephyrGpioDriver base id 0x1002B000 + instance gpioface3LS: Zephyr.ZephyrGpioDriver base id 0x1002C000 + instance gpioface4LS: Zephyr.ZephyrGpioDriver base id 0x1002D000 + instance gpioface5LS: Zephyr.ZephyrGpioDriver base id 0x1002E000 + instance gpioPayloadPowerLS: Zephyr.ZephyrGpioDriver base id 0x1002F000 + instance gpioPayloadBatteryLS: Zephyr.ZephyrGpioDriver base id 0x10030000 - instance gpioface5LS: Zephyr.ZephyrGpioDriver base id 0x1002F000 + # Load Switches + instance face0LoadSwitch: Components.LoadSwitch base id 0x10031000 + instance face1LoadSwitch: Components.LoadSwitch base id 0x10032000 + instance face2LoadSwitch: Components.LoadSwitch base id 0x10033000 + instance face3LoadSwitch: Components.LoadSwitch base id 0x10034000 + instance face4LoadSwitch: Components.LoadSwitch base id 0x10035000 + instance face5LoadSwitch: Components.LoadSwitch base id 0x10036000 + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10037000 + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x10038000 - instance gpioPayloadPowerLS: Zephyr.ZephyrGpioDriver base id 0x10030000 + # Power Monitors + instance ina219SysManager: Drv.Ina219Manager base id 0x10039000 + instance ina219SolManager: Drv.Ina219Manager base id 0x1003A000 - instance gpioPayloadBatteryLS: Zephyr.ZephyrGpioDriver base id 0x10031000 + # Temperature Sensors + instance tmp112Face0Manager: Drv.Tmp112Manager base id 0x1003B000 + instance tmp112Face1Manager: Drv.Tmp112Manager base id 0x1003C000 + instance tmp112Face2Manager: Drv.Tmp112Manager base id 0x1003D000 + instance tmp112Face3Manager: Drv.Tmp112Manager base id 0x1003E000 + instance tmp112Face4Manager: Drv.Tmp112Manager base id 0x1003F000 + instance tmp112Face5Manager: Drv.Tmp112Manager base id 0x10040000 + instance tmp112BattCell1Manager: Drv.Tmp112Manager base id 0x10041000 + instance tmp112BattCell2Manager: Drv.Tmp112Manager base id 0x10042000 + instance tmp112BattCell3Manager: Drv.Tmp112Manager base id 0x10043000 + instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x10044000 - instance fsSpace: Components.FsSpace base id 0x10032000 - - instance face4LoadSwitch: Components.LoadSwitch base id 0x10033000 - - instance face0LoadSwitch: Components.LoadSwitch base id 0x10034000 - - instance face1LoadSwitch: Components.LoadSwitch base id 0x10035000 - - instance face2LoadSwitch: Components.LoadSwitch base id 0x10036000 - - instance face3LoadSwitch: Components.LoadSwitch base id 0x10037000 - - instance face5LoadSwitch: Components.LoadSwitch base id 0x10038000 - - instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10039000 - - instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1003A000 - - instance resetManager: Components.ResetManager base id 0x1003B000 - - instance powerMonitor: Components.PowerMonitor base id 0x1003C000 - - instance ina219SysManager: Drv.Ina219Manager base id 0x1003D000 - - instance ina219SolManager: Drv.Ina219Manager base id 0x1003E000 - - instance startupManager: Components.StartupManager base id 0x1003F000 - - instance tcaMonitor: Components.GenericDeviceMonitor base id 0x10041000 - - instance muxChannel0Monitor: Components.GenericDeviceMonitor base id 0x10042000 - - instance muxChannel1Monitor: Components.GenericDeviceMonitor base id 0x10043000 - - instance muxChannel2Monitor: Components.GenericDeviceMonitor base id 0x10044000 - - instance muxChannel3Monitor: Components.GenericDeviceMonitor base id 0x10045000 - - instance muxChannel4Monitor: Components.GenericDeviceMonitor base id 0x10046000 - - instance muxChannel5Monitor: Components.GenericDeviceMonitor base id 0x10047000 - - instance muxChannel6Monitor: Components.GenericDeviceMonitor base id 0x10048000 - - instance muxChannel7Monitor: Components.GenericDeviceMonitor base id 0x10049000 - - instance thermalManager: Components.ThermalManager base id 0x1004A000 - - instance tmp112Face0Manager: Drv.Tmp112Manager base id 0x1004B000 - - instance tmp112Face1Manager: Drv.Tmp112Manager base id 0x1004C000 - - instance tmp112Face2Manager: Drv.Tmp112Manager base id 0x1004D000 - - instance tmp112Face3Manager: Drv.Tmp112Manager base id 0x1004E000 - - instance tmp112Face5Manager: Drv.Tmp112Manager base id 0x1004F000 - - instance tmp112BattCell1Manager: Drv.Tmp112Manager base id 0x10050000 - - instance tmp112BattCell2Manager: Drv.Tmp112Manager base id 0x10051000 - - instance tmp112BattCell3Manager: Drv.Tmp112Manager base id 0x10052000 - - instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x10053000 - - instance adcs: Components.ADCS base id 0x10054000 - - instance veml6031Face0Manager: Drv.Veml6031Manager base id 0x10055000 - - instance veml6031Face1Manager: Drv.Veml6031Manager base id 0x10056000 - - instance veml6031Face2Manager: Drv.Veml6031Manager base id 0x10057000 - - instance veml6031Face3Manager: Drv.Veml6031Manager base id 0x10058000 - - instance veml6031Face5Manager: Drv.Veml6031Manager base id 0x10059000 - - instance veml6031Face6Manager: Drv.Veml6031Manager base id 0x1005A000 - - instance veml6031Face7Manager: Drv.Veml6031Manager base id 0x1005B000 + # Light Sensors + instance veml6031Face0Manager: Drv.Veml6031Manager base id 0x10045000 + instance veml6031Face1Manager: Drv.Veml6031Manager base id 0x10046000 + instance veml6031Face2Manager: Drv.Veml6031Manager base id 0x10047000 + instance veml6031Face3Manager: Drv.Veml6031Manager base id 0x10048000 + instance veml6031Face4Manager: Drv.Veml6031Manager base id 0x10049000 + instance veml6031Face5Manager: Drv.Veml6031Manager base id 0x1004A000 + instance veml6031Face6Manager: Drv.Veml6031Manager base id 0x1004B000 + instance veml6031Face7Manager: Drv.Veml6031Manager base id 0x1004C000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 49741a9b..bbc51199 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -25,7 +25,7 @@ module ReferenceDeployment { # ---------------------------------------------------------------------- instance rateGroup10Hz instance rateGroup1Hz - instance rateGroup1_6Hz + # instance rateGroup1_6Hz instance rateGroupDriver instance timer instance lora @@ -68,15 +68,6 @@ module ReferenceDeployment { instance powerMonitor instance ina219SysManager instance ina219SolManager - instance tcaMonitor - instance muxChannel0Monitor - instance muxChannel1Monitor - instance muxChannel2Monitor - instance muxChannel3Monitor - instance muxChannel4Monitor - instance muxChannel5Monitor - instance muxChannel6Monitor - instance muxChannel7Monitor # Face Board Instances instance thermalManager @@ -93,12 +84,12 @@ module ReferenceDeployment { instance modeManager instance adcs instance veml6031Face0Manager - # instance veml6031Face1Manager - # instance veml6031Face2Manager - # instance veml6031Face3Manager - # instance veml6031Face5Manager - # instance veml6031Face6Manager - # instance veml6031Face7Manager + instance veml6031Face1Manager + instance veml6031Face2Manager + instance veml6031Face3Manager + instance veml6031Face5Manager + instance veml6031Face6Manager + instance veml6031Face7Manager # ---------------------------------------------------------------------- @@ -200,23 +191,15 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[7] -> fsSpace.run rateGroup1Hz.RateGroupMemberOut[8] -> FileHandling.fileDownlink.Run rateGroup1Hz.RateGroupMemberOut[9] -> startupManager.run # doubles (20ms) rate group max time - # rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run # Causing rate group to slip? rateGroup1Hz.RateGroupMemberOut[10] -> modeManager.run - # rateGroup1Hz.RateGroupMemberOut[23] -> adcs.run + rateGroup1Hz.RateGroupMemberOut[11] -> adcs.run + rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run # Causing rate group to slip? + rateGroup1Hz.RateGroupMemberOut[13] -> CdhCore.tlmSend.Run + rateGroup1Hz.RateGroupMemberOut[14] -> imuManager.run + rateGroup1Hz.RateGroupMemberOut[15] -> thermalManager.run # Slow rate (1/6 Hz) rate group - rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn - rateGroup1_6Hz.RateGroupMemberOut[0] -> CdhCore.tlmSend.Run - rateGroup1_6Hz.RateGroupMemberOut[1] -> imuManager.run - rateGroup1_6Hz.RateGroupMemberOut[2] -> tcaMonitor.run - rateGroup1_6Hz.RateGroupMemberOut[3] -> muxChannel0Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[4] -> muxChannel1Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[5] -> muxChannel2Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[6] -> muxChannel3Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[7] -> muxChannel4Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[8] -> muxChannel5Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[9] -> muxChannel7Monitor.run - rateGroup1_6Hz.RateGroupMemberOut[10] -> thermalManager.run + # rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn } @@ -236,18 +219,22 @@ module ReferenceDeployment { face1LoadSwitch.gpioSet -> gpioface1LS.gpioWrite face1LoadSwitch.gpioGet -> gpioface1LS.gpioRead face1LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face1Manager.loadSwitchStateChanged + face1LoadSwitch.loadSwitchStateChanged[1] -> veml6031Face1Manager.loadSwitchStateChanged face2LoadSwitch.gpioSet -> gpioface2LS.gpioWrite face2LoadSwitch.gpioGet -> gpioface2LS.gpioRead face2LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face2Manager.loadSwitchStateChanged + face2LoadSwitch.loadSwitchStateChanged[1] -> veml6031Face2Manager.loadSwitchStateChanged face3LoadSwitch.gpioSet -> gpioface3LS.gpioWrite face3LoadSwitch.gpioGet -> gpioface3LS.gpioRead face3LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face3Manager.loadSwitchStateChanged + face3LoadSwitch.loadSwitchStateChanged[1] -> veml6031Face3Manager.loadSwitchStateChanged face5LoadSwitch.gpioSet -> gpioface5LS.gpioWrite face5LoadSwitch.gpioGet -> gpioface5LS.gpioRead face5LoadSwitch.loadSwitchStateChanged[0] -> tmp112Face5Manager.loadSwitchStateChanged + face5LoadSwitch.loadSwitchStateChanged[1] -> veml6031Face5Manager.loadSwitchStateChanged payloadPowerLoadSwitch.gpioSet -> gpioPayloadPowerLS.gpioWrite payloadPowerLoadSwitch.gpioGet -> gpioPayloadPowerLS.gpioRead @@ -294,50 +281,24 @@ module ReferenceDeployment { } connections thermalManager { - tmp112Face0Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112Face0Manager.muxHealthGet -> muxChannel0Monitor.healthGet thermalManager.faceTempGet[0] -> tmp112Face0Manager.temperatureGet - - tmp112Face1Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112Face1Manager.muxHealthGet -> muxChannel1Monitor.healthGet thermalManager.faceTempGet[1] -> tmp112Face1Manager.temperatureGet - - tmp112Face2Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112Face2Manager.muxHealthGet -> muxChannel2Monitor.healthGet thermalManager.faceTempGet[2] -> tmp112Face2Manager.temperatureGet - - tmp112Face3Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112Face3Manager.muxHealthGet -> muxChannel3Monitor.healthGet thermalManager.faceTempGet[3] -> tmp112Face3Manager.temperatureGet - - tmp112Face5Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112Face5Manager.muxHealthGet -> muxChannel5Monitor.healthGet thermalManager.faceTempGet[4] -> tmp112Face5Manager.temperatureGet - - tmp112BattCell1Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112BattCell1Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCellTempGet[0] -> tmp112BattCell1Manager.temperatureGet - - tmp112BattCell2Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112BattCell2Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCellTempGet[1] -> tmp112BattCell2Manager.temperatureGet - - tmp112BattCell3Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112BattCell3Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCellTempGet[2] -> tmp112BattCell3Manager.temperatureGet - - tmp112BattCell4Manager.tcaHealthGet -> tcaMonitor.healthGet - tmp112BattCell4Manager.muxHealthGet -> muxChannel4Monitor.healthGet thermalManager.battCellTempGet[3] -> tmp112BattCell4Manager.temperatureGet } connections adcs { adcs.visibleLightGet[0] -> veml6031Face0Manager.visibleLightGet - # adcs.visibleLightGet[1] -> veml6031Face1Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[2] -> veml6031Face2Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[3] -> veml6031Face3Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[4] -> veml6031Face5Manager.visibleLightGet --- IGNORE --- - # adcs.visibleLightGet[5] -> veml6031Face6Manager.visibleLightGet --- IGNORE + adcs.visibleLightGet[1] -> veml6031Face1Manager.visibleLightGet + adcs.visibleLightGet[2] -> veml6031Face2Manager.visibleLightGet + adcs.visibleLightGet[3] -> veml6031Face3Manager.visibleLightGet + adcs.visibleLightGet[4] -> veml6031Face5Manager.visibleLightGet + adcs.visibleLightGet[5] -> veml6031Face6Manager.visibleLightGet } connections ModeManager { diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 6eadde8f..1b372f0e 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 12 +constant ActiveRateGroupOutputPorts = 16 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 From c01153830c75c2f95a8fb9580e6ee4905ad570af Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Tue, 2 Dec 2025 23:29:41 -0600 Subject: [PATCH 60/68] Reduce logging overhead --- prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prj.conf b/prj.conf index 743d7d1f..c635cfce 100644 --- a/prj.conf +++ b/prj.conf @@ -54,7 +54,7 @@ CONFIG_COMMON_LIBC_MALLOC=y CONFIG_SENSOR=y # Enable detailed logging for I2C and sensor debugging -CONFIG_LOG=y +CONFIG_LOG=n CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_CBPRINTF_FP_SUPPORT=y From aa1dcd89d33960f6b70ebb67c2aa5d9b0c85ab2a Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Tue, 2 Dec 2025 23:46:32 -0600 Subject: [PATCH 61/68] Reduce lines changed. Remove 1/6Hz rate group --- .../Top/ReferenceDeploymentTopology.cpp | 16 +- .../Top/ReferenceDeploymentTopologyDefs.hpp | 8 +- .../ReferenceDeployment/Top/instances.fpp | 137 +++++++++--------- .../ReferenceDeployment/Top/topology.fpp | 7 +- .../project/config/AcConstants.fpp | 4 +- .../config/CommandDispatcherImplCfg.hpp | 2 +- 6 files changed, 83 insertions(+), 91 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 6326cdf2..efb6019e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -42,16 +42,14 @@ constexpr FwSizeType getRateGroupPeriod(const FwSizeType hz) { // The reference topology divides the incoming clock signal (1Hz) into sub-signals: 1Hz, 1/2Hz, and 1/4Hz with 0 offset Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{ // Array of divider objects - {getRateGroupPeriod(10), 0}, // 10Hz = 100ms - {getRateGroupPeriod(1), 0}, // 1Hz = 1s - {6000, 0} // 1/6 Hz = 6s + {getRateGroupPeriod(10), 0}, // 10Hz + {getRateGroupPeriod(1), 0}, // 1Hz }}; // Rate groups may supply a context token to each of the attached children whose purpose is set by the project. The // reference topology sets each token to zero as these contexts are unused in this project. U32 rateGroup10HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGroupPeriod(10)}; U32 rateGroup1HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGroupPeriod(1)}; -U32 rateGroup1_6HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {6000}; /** * \brief configure/setup components in project-specific way @@ -67,16 +65,12 @@ void configureTopology() { // Rate groups require context arrays. rateGroup10Hz.configure(rateGroup10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup10HzContext)); rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); - // rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); - cmdSeq.allocateBuffer(0, mallocator, 5 * 1024); - - // FC GPIO configuration gpioWatchdog.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); - // Face load switch GPIO configuration + cmdSeq.allocateBuffer(0, mallocator, 5 * 1024); gpioface4LS.open(face4LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioface0LS.open(face0LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioface1LS.open(face1LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); @@ -122,7 +116,7 @@ void setupTopology(const TopologyState& state) { ina219SysManager.configure(state.ina219SysDevice); ina219SolManager.configure(state.ina219SolDevice); - // Configure all 11 TMP112 temperature sensor managers + // Configure TMP112 temperature sensor managers tmp112Face0Manager.configure(state.tca9548aDevice, state.muxChannel0Device, state.face0TempDevice, true); tmp112Face1Manager.configure(state.tca9548aDevice, state.muxChannel1Device, state.face1TempDevice, true); tmp112Face2Manager.configure(state.tca9548aDevice, state.muxChannel2Device, state.face2TempDevice, true); @@ -133,7 +127,7 @@ void setupTopology(const TopologyState& state) { tmp112BattCell3Manager.configure(state.tca9548aDevice, state.muxChannel4Device, state.battCell3TempDevice, false); tmp112BattCell4Manager.configure(state.tca9548aDevice, state.muxChannel4Device, state.battCell4TempDevice, false); - // Configure all 7 VEML6031 light sensor managers + // Configure VEML6031 light sensor managers veml6031Face0Manager.configure(state.tca9548aDevice, state.muxChannel0Device, state.face0LightDevice); veml6031Face1Manager.configure(state.tca9548aDevice, state.muxChannel1Device, state.face1LightDevice); veml6031Face2Manager.configure(state.tca9548aDevice, state.muxChannel2Device, state.face2LightDevice); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 19d72cea..1e20354e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -53,9 +53,6 @@ enum { WARN = 3, FATAL = 5 }; namespace ReferenceDeployment_rateGroup1Hz { enum { WARN = 3, FATAL = 5 }; } -namespace ReferenceDeployment_rateGroup1_6Hz { -enum { WARN = 3, FATAL = 5 }; -} namespace ReferenceDeployment_cmdSeq { enum { WARN = 3, FATAL = 5 }; } @@ -72,9 +69,8 @@ namespace ReferenceDeployment { * autocoder. The contents are entirely up to the definition of the project. This deployment uses subtopologies. */ struct TopologyState { - const device* uartDevice; //!< UART device path for communication - const device* loraDevice; //!< LoRa device path for communication - + const device* uartDevice; //!< UART device path for communication + const device* loraDevice; //!< LoRa device path for communication U32 baudRate; //!< Baud rate for UART communication CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 4ec4d65e..7d57293e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -20,7 +20,7 @@ module ReferenceDeployment { module Default { constant QUEUE_SIZE = 10 - constant STACK_SIZE = 4 * 1024 # Must match prj.conf thread stack size + constant STACK_SIZE = 8 * 1024 # Must match prj.conf thread stack size } # ---------------------------------------------------------------------- @@ -37,22 +37,17 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 3 - instance rateGroup1_6Hz: Svc.ActiveRateGroup base id 0x10003000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 4 - - instance cmdSeq: Svc.CmdSequencer base id 0x10004000 \ + instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \ queue size Default.QUEUE_SIZE * 2 \ stack size Default.STACK_SIZE \ priority 15 - instance prmDb: Svc.PrmDb base id 0x10005000 \ + instance prmDb: Svc.PrmDb base id 0x1000B000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 14 - instance modeManager: Components.ModeManager base id 0x10006000 \ + instance modeManager: Components.ModeManager base id 0x10040000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 16 @@ -85,78 +80,90 @@ module ReferenceDeployment { instance lsm6dsoManager: Drv.Lsm6dsoManager base id 0x10019000 - instance bootloaderTrigger: Components.BootloaderTrigger base id 0x1001A000 + instance bootloaderTrigger: Components.BootloaderTrigger base id 0x10020000 + + instance burnwire: Components.Burnwire base id 0x10021000 + + instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10022000 + + instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10023000 + + instance comDelay: Components.ComDelay base id 0x10025000 + + instance lora: Zephyr.LoRa base id 0x10026000 + + instance comSplitterEvents: Svc.ComSplitter base id 0x10027000 + + instance comSplitterTelemetry: Svc.ComSplitter base id 0x10028000 + + instance antennaDeployer: Components.AntennaDeployer base id 0x10029000 + + instance gpioface4LS: Zephyr.ZephyrGpioDriver base id 0x1002A000 + + instance gpioface0LS: Zephyr.ZephyrGpioDriver base id 0x1002B000 + + instance gpioface1LS: Zephyr.ZephyrGpioDriver base id 0x1002C000 + + instance gpioface2LS: Zephyr.ZephyrGpioDriver base id 0x1002D000 + + instance gpioface3LS: Zephyr.ZephyrGpioDriver base id 0x1002E000 + + instance gpioface5LS: Zephyr.ZephyrGpioDriver base id 0x1002F000 + + instance gpioPayloadPowerLS: Zephyr.ZephyrGpioDriver base id 0x10030000 - instance burnwire: Components.Burnwire base id 0x1001B000 + instance gpioPayloadBatteryLS: Zephyr.ZephyrGpioDriver base id 0x10031000 - instance comDelay: Components.ComDelay base id 0x1001C000 + instance fsSpace: Components.FsSpace base id 0x10032000 - instance comSplitterEvents: Svc.ComSplitter base id 0x1001D000 + instance face4LoadSwitch: Components.LoadSwitch base id 0x10033000 - instance comSplitterTelemetry: Svc.ComSplitter base id 0x1001E000 + instance face0LoadSwitch: Components.LoadSwitch base id 0x10034000 - instance lora: Zephyr.LoRa base id 0x1001F000 + instance face1LoadSwitch: Components.LoadSwitch base id 0x10035000 - instance antennaDeployer: Components.AntennaDeployer base id 0x10020000 + instance face2LoadSwitch: Components.LoadSwitch base id 0x10036000 - instance fsSpace: Components.FsSpace base id 0x10021000 + instance face3LoadSwitch: Components.LoadSwitch base id 0x10037000 - instance resetManager: Components.ResetManager base id 0x10022000 + instance face5LoadSwitch: Components.LoadSwitch base id 0x10038000 - instance powerMonitor: Components.PowerMonitor base id 0x10023000 + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10039000 - instance startupManager: Components.StartupManager base id 0x10024000 + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1003A000 - instance thermalManager: Components.ThermalManager base id 0x10025000 + instance resetManager: Components.ResetManager base id 0x1003B000 - instance adcs: Components.ADCS base id 0x10026000 + instance powerMonitor: Components.PowerMonitor base id 0x1003C000 - # GPIO Drivers - instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10027000 - instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10028000 - instance gpioface0LS: Zephyr.ZephyrGpioDriver base id 0x10029000 - instance gpioface1LS: Zephyr.ZephyrGpioDriver base id 0x1002A000 - instance gpioface2LS: Zephyr.ZephyrGpioDriver base id 0x1002B000 - instance gpioface3LS: Zephyr.ZephyrGpioDriver base id 0x1002C000 - instance gpioface4LS: Zephyr.ZephyrGpioDriver base id 0x1002D000 - instance gpioface5LS: Zephyr.ZephyrGpioDriver base id 0x1002E000 - instance gpioPayloadPowerLS: Zephyr.ZephyrGpioDriver base id 0x1002F000 - instance gpioPayloadBatteryLS: Zephyr.ZephyrGpioDriver base id 0x10030000 + instance ina219SysManager: Drv.Ina219Manager base id 0x1003D000 - # Load Switches - instance face0LoadSwitch: Components.LoadSwitch base id 0x10031000 - instance face1LoadSwitch: Components.LoadSwitch base id 0x10032000 - instance face2LoadSwitch: Components.LoadSwitch base id 0x10033000 - instance face3LoadSwitch: Components.LoadSwitch base id 0x10034000 - instance face4LoadSwitch: Components.LoadSwitch base id 0x10035000 - instance face5LoadSwitch: Components.LoadSwitch base id 0x10036000 - instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10037000 - instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x10038000 + instance ina219SolManager: Drv.Ina219Manager base id 0x1003E000 - # Power Monitors - instance ina219SysManager: Drv.Ina219Manager base id 0x10039000 - instance ina219SolManager: Drv.Ina219Manager base id 0x1003A000 + instance startupManager: Components.StartupManager base id 0x1003F000 - # Temperature Sensors - instance tmp112Face0Manager: Drv.Tmp112Manager base id 0x1003B000 - instance tmp112Face1Manager: Drv.Tmp112Manager base id 0x1003C000 - instance tmp112Face2Manager: Drv.Tmp112Manager base id 0x1003D000 - instance tmp112Face3Manager: Drv.Tmp112Manager base id 0x1003E000 - instance tmp112Face4Manager: Drv.Tmp112Manager base id 0x1003F000 - instance tmp112Face5Manager: Drv.Tmp112Manager base id 0x10040000 - instance tmp112BattCell1Manager: Drv.Tmp112Manager base id 0x10041000 - instance tmp112BattCell2Manager: Drv.Tmp112Manager base id 0x10042000 - instance tmp112BattCell3Manager: Drv.Tmp112Manager base id 0x10043000 - instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x10044000 + # Thermal Management System + instance thermalManager: Components.ThermalManager base id 0x10041000 + instance tmp112Face0Manager: Drv.Tmp112Manager base id 0x10042000 + instance tmp112Face1Manager: Drv.Tmp112Manager base id 0x10043000 + instance tmp112Face2Manager: Drv.Tmp112Manager base id 0x10044000 + instance tmp112Face3Manager: Drv.Tmp112Manager base id 0x10045000 + instance tmp112Face4Manager: Drv.Tmp112Manager base id 0x10046000 + instance tmp112Face5Manager: Drv.Tmp112Manager base id 0x10047000 + instance tmp112BattCell1Manager: Drv.Tmp112Manager base id 0x10048000 + instance tmp112BattCell2Manager: Drv.Tmp112Manager base id 0x10049000 + instance tmp112BattCell3Manager: Drv.Tmp112Manager base id 0x1004A000 + instance tmp112BattCell4Manager: Drv.Tmp112Manager base id 0x1004B000 - # Light Sensors - instance veml6031Face0Manager: Drv.Veml6031Manager base id 0x10045000 - instance veml6031Face1Manager: Drv.Veml6031Manager base id 0x10046000 - instance veml6031Face2Manager: Drv.Veml6031Manager base id 0x10047000 - instance veml6031Face3Manager: Drv.Veml6031Manager base id 0x10048000 - instance veml6031Face4Manager: Drv.Veml6031Manager base id 0x10049000 - instance veml6031Face5Manager: Drv.Veml6031Manager base id 0x1004A000 - instance veml6031Face6Manager: Drv.Veml6031Manager base id 0x1004B000 - instance veml6031Face7Manager: Drv.Veml6031Manager base id 0x1004C000 + # Attitude Determination and Control System (ADCS) + instance adcs: Components.ADCS base id 0x1004C000 + instance veml6031Face0Manager: Drv.Veml6031Manager base id 0x1004D000 + instance veml6031Face1Manager: Drv.Veml6031Manager base id 0x1004E000 + instance veml6031Face2Manager: Drv.Veml6031Manager base id 0x1004F000 + instance veml6031Face3Manager: Drv.Veml6031Manager base id 0x10050000 + instance veml6031Face4Manager: Drv.Veml6031Manager base id 0x10051000 + instance veml6031Face5Manager: Drv.Veml6031Manager base id 0x10052000 + instance veml6031Face6Manager: Drv.Veml6031Manager base id 0x10053000 + instance veml6031Face7Manager: Drv.Veml6031Manager base id 0x10054000 } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index bbc51199..bbeb3363 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -7,7 +7,6 @@ module ReferenceDeployment { enum Ports_RateGroups { rateGroup10Hz rateGroup1Hz - rateGroup1_6Hz } topology ReferenceDeployment { @@ -25,7 +24,6 @@ module ReferenceDeployment { # ---------------------------------------------------------------------- instance rateGroup10Hz instance rateGroup1Hz - # instance rateGroup1_6Hz instance rateGroupDriver instance timer instance lora @@ -179,7 +177,7 @@ module ReferenceDeployment { rateGroup10Hz.RateGroupMemberOut[3] -> FileHandling.fileManager.schedIn rateGroup10Hz.RateGroupMemberOut[4] -> cmdSeq.schedIn - # Medium rate (1Hz) rate group + # Slow rate (1Hz) rate group rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1Hz] -> rateGroup1Hz.CycleIn rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run @@ -197,9 +195,6 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[13] -> CdhCore.tlmSend.Run rateGroup1Hz.RateGroupMemberOut[14] -> imuManager.run rateGroup1Hz.RateGroupMemberOut[15] -> thermalManager.run - - # Slow rate (1/6 Hz) rate group - # rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn } diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 1b372f0e..8eeefb4b 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 16 +constant ActiveRateGroupOutputPorts = 15 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 @@ -13,7 +13,7 @@ constant PassiveRateGroupOutputPorts = 10 constant RateGroupDriverRateGroupPorts = 3 @ Used for command and registration ports -constant CmdDispatcherComponentCommandPorts = 36 +constant CmdDispatcherComponentCommandPorts = 30 @ Used for uplink/sequencer buffer/response ports constant CmdDispatcherSequencePorts = 5 diff --git a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp index e4bd50b9..3f426ec8 100644 --- a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp +++ b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp @@ -11,7 +11,7 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 128, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 160, // !< The size of the table holding opcodes to dispatch CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress }; From 67ec13ea24e4058aa92791840f8dcbe45bed56f6 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 3 Dec 2025 00:01:43 -0600 Subject: [PATCH 62/68] Next error --- FprimeZephyrReference/project/config/AcConstants.fpp | 4 ++-- .../project/config/CommandDispatcherImplCfg.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 8eeefb4b..2c84297d 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -4,7 +4,7 @@ # ====================================================================== @ Number of rate group member output ports for ActiveRateGroup -constant ActiveRateGroupOutputPorts = 15 +constant ActiveRateGroupOutputPorts = 16 @ Number of rate group member output ports for PassiveRateGroup constant PassiveRateGroupOutputPorts = 10 @@ -13,7 +13,7 @@ constant PassiveRateGroupOutputPorts = 10 constant RateGroupDriverRateGroupPorts = 3 @ Used for command and registration ports -constant CmdDispatcherComponentCommandPorts = 30 +constant CmdDispatcherComponentCommandPorts = 35 @ Used for uplink/sequencer buffer/response ports constant CmdDispatcherSequencePorts = 5 diff --git a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp index 3f426ec8..6f0a521a 100644 --- a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp +++ b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp @@ -11,7 +11,7 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 160, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 192, // !< The size of the table holding opcodes to dispatch CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress }; From 797fc7e34a9ba46b8cd4473b6b0dc37f408c9697 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 3 Dec 2025 00:29:02 -0600 Subject: [PATCH 63/68] Booting --- prj.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prj.conf b/prj.conf index c635cfce..250b38ee 100644 --- a/prj.conf +++ b/prj.conf @@ -39,9 +39,9 @@ CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y CONFIG_DYNAMIC_THREAD_ALLOC=n CONFIG_DYNAMIC_THREAD_PREFER_POOL=y -CONFIG_DYNAMIC_THREAD_POOL_SIZE=30 +CONFIG_DYNAMIC_THREAD_POOL_SIZE=25 # Num threads in the thread pool -CONFIG_DYNAMIC_THREAD_STACK_SIZE=4096 +CONFIG_DYNAMIC_THREAD_STACK_SIZE=8192 # Size of thread stack in thread pool, must be >= Thread Pool size in F' CONFIG_THREAD_STACK_INFO=y From 74f546690ed646593d92ae409f9ac45bcfa2a452 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Wed, 3 Dec 2025 23:15:38 -0600 Subject: [PATCH 64/68] Update param value defaults --- .../Components/Drv/Veml6031Manager/Veml6031Manager.cpp | 2 +- .../Components/Drv/Veml6031Manager/Veml6031Manager.fpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp index 216e4b12..4ee12c88 100644 --- a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp @@ -55,7 +55,7 @@ F32 Veml6031Manager ::ambientLightGet_handler(FwIndexType portNum, Fw::Success& F32 lux = sensor_value_to_double(&val); - this->tlmWrite_VisibleLight(lux); + this->tlmWrite_AmbientLight(lux); condition = Fw::Success::SUCCESS; return lux; diff --git a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp index 2bd567b5..22b36d52 100644 --- a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.fpp @@ -42,13 +42,13 @@ module Drv { #### Parameters #### @ Parameter for setting the gain of the light senors - param GAIN: GAIN default GAIN.VEML6031_GAIN_1 + param GAIN: GAIN default GAIN.VEML6031_GAIN_0_5 @ Parameter for setting the integration time (IT) of the light sensors - param INTEGRATION_TIME: IT default IT.VEML6031_IT_100 + param INTEGRATION_TIME: IT default IT.VEML6031_IT_25 @ Parameter for setting the effective photodiode size (DIV4) mode of the light sensors - param EFFECTIVE_PHOTODIODE_SIZE: DIV4 default DIV4.VEML6031_SIZE_4_4 + param EFFECTIVE_PHOTODIODE_SIZE: DIV4 default DIV4.VEML6031_SIZE_1_4 @ Parameter for setting the Ambient Light Sensor (ALS) persistence protect number setting (PERS). param ALS_PERSISTENCE_PROTECT_NUMBER: ALS_PERS default ALS_PERS.VEML60XX_PERS_1 From 4dee50b4b5f541abccb7dbe35d4fedc37973152f Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Thu, 4 Dec 2025 12:48:21 -0600 Subject: [PATCH 65/68] More defensive --- .../Drv/Tmp112Manager/TMP112Manager.cpp | 6 ++--- .../Drv/Veml6031Manager/Veml6031Manager.cpp | 21 +++++++++++++--- .../ReferenceDeployment/Top/topology.fpp | 24 +++++++++---------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp index 943a9acf..10f5d5cb 100644 --- a/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Tmp112Manager/TMP112Manager.cpp @@ -6,6 +6,7 @@ #include "FprimeZephyrReference/Components/Drv/Tmp112Manager/Tmp112Manager.hpp" #include +#include #include @@ -62,8 +63,6 @@ F64 Tmp112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& con return 0; } - struct sensor_value val; - int rc = sensor_sample_fetch_chan(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP); if (rc != 0) { this->log_WARNING_HI_SensorSampleFetchFailed(rc); @@ -71,6 +70,7 @@ F64 Tmp112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& con } this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); + struct sensor_value val; rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_TEMP, &val); if (rc != 0) { this->log_WARNING_HI_SensorChannelGetFailed(rc); @@ -79,10 +79,10 @@ F64 Tmp112Manager ::temperatureGet_handler(FwIndexType portNum, Fw::Success& con this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); F64 temp = sensor_value_to_double(&val); - condition = Fw::Success::SUCCESS; this->tlmWrite_Temperature(temp); + condition = Fw::Success::SUCCESS; return temp; } diff --git a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp index 4ee12c88..786b33ab 100644 --- a/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp +++ b/FprimeZephyrReference/Components/Drv/Veml6031Manager/Veml6031Manager.cpp @@ -51,7 +51,12 @@ F32 Veml6031Manager ::ambientLightGet_handler(FwIndexType portNum, Fw::Success& this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); struct sensor_value val; - sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_LIGHT, &val); + rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_AMBIENT_LIGHT, &val); + if (rc != 0) { + this->log_WARNING_HI_SensorChannelGetFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); F32 lux = sensor_value_to_double(&val); @@ -78,7 +83,12 @@ F32 Veml6031Manager ::infraRedLightGet_handler(FwIndexType portNum, Fw::Success& this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); struct sensor_value val; - sensor_channel_get(this->m_dev, SENSOR_CHAN_IR, &val); + rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_IR, &val); + if (rc != 0) { + this->log_WARNING_HI_SensorChannelGetFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); F32 lux = sensor_value_to_double(&val); @@ -122,7 +132,12 @@ F32 Veml6031Manager ::visibleLightGet_handler(FwIndexType portNum, Fw::Success& this->log_WARNING_HI_SensorSampleFetchFailed_ThrottleClear(); struct sensor_value val; - sensor_channel_get(this->m_dev, SENSOR_CHAN_LIGHT, &val); + rc = sensor_channel_get(this->m_dev, SENSOR_CHAN_LIGHT, &val); + if (rc != 0) { + this->log_WARNING_HI_SensorChannelGetFailed(rc); + return 0; + } + this->log_WARNING_HI_SensorChannelGetFailed_ThrottleClear(); F32 lux = sensor_value_to_double(&val); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index bbeb3363..345a58c1 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -182,18 +182,18 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn - rateGroup1Hz.RateGroupMemberOut[3] -> watchdog.run - rateGroup1Hz.RateGroupMemberOut[4] -> comDelay.run - rateGroup1Hz.RateGroupMemberOut[5] -> burnwire.schedIn - rateGroup1Hz.RateGroupMemberOut[6] -> antennaDeployer.schedIn - rateGroup1Hz.RateGroupMemberOut[7] -> fsSpace.run - rateGroup1Hz.RateGroupMemberOut[8] -> FileHandling.fileDownlink.Run - rateGroup1Hz.RateGroupMemberOut[9] -> startupManager.run # doubles (20ms) rate group max time - rateGroup1Hz.RateGroupMemberOut[10] -> modeManager.run - rateGroup1Hz.RateGroupMemberOut[11] -> adcs.run - rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run # Causing rate group to slip? - rateGroup1Hz.RateGroupMemberOut[13] -> CdhCore.tlmSend.Run - rateGroup1Hz.RateGroupMemberOut[14] -> imuManager.run + rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run + rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run + rateGroup1Hz.RateGroupMemberOut[5] -> imuManager.run + rateGroup1Hz.RateGroupMemberOut[6] -> comDelay.run + rateGroup1Hz.RateGroupMemberOut[7] -> burnwire.schedIn + rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn + rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run + rateGroup1Hz.RateGroupMemberOut[10] -> FileHandling.fileDownlink.Run + rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run # doubles (20ms) rate group max time + rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run + rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run + rateGroup1Hz.RateGroupMemberOut[14] -> adcs.run rateGroup1Hz.RateGroupMemberOut[15] -> thermalManager.run } From 8aa4cbc568ca8d858623f405d5f792fadfa9acfb Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Thu, 4 Dec 2025 13:41:29 -0600 Subject: [PATCH 66/68] 2 new rategroups --- .../Top/ReferenceDeploymentPackets.fppi | 4 ++++ .../Top/ReferenceDeploymentTopology.cpp | 4 ++++ .../Top/ReferenceDeploymentTopologyDefs.hpp | 6 ++++++ .../ReferenceDeployment/Top/instances.fpp | 10 ++++++++++ .../ReferenceDeployment/Top/topology.fpp | 16 ++++++++++++---- .../project/config/AcConstants.fpp | 2 +- 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index c8f90f9a..9685d012 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -9,6 +9,8 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.HiBuffs ReferenceDeployment.rateGroup10Hz.RgMaxTime ReferenceDeployment.rateGroup1Hz.RgMaxTime + ReferenceDeployment.rateGroup1_6Hz.RgMaxTime + ReferenceDeployment.rateGroup1_10Hz.RgMaxTime ReferenceDeployment.startupManager.BootCount ReferenceDeployment.startupManager.QuiescenceEndTime ReferenceDeployment.modeManager.CurrentMode @@ -23,6 +25,8 @@ telemetry packets ReferenceDeploymentPackets { ComCcsdsUart.commsBufferManager.EmptyBuffs ReferenceDeployment.rateGroup10Hz.RgCycleSlips ReferenceDeployment.rateGroup1Hz.RgCycleSlips + ReferenceDeployment.rateGroup1_6Hz.RgCycleSlips + ReferenceDeployment.rateGroup1_10Hz.RgCycleSlips } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index efb6019e..9f3eef19 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -50,6 +50,8 @@ Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{ // reference topology sets each token to zero as these contexts are unused in this project. U32 rateGroup10HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGroupPeriod(10)}; U32 rateGroup1HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGroupPeriod(1)}; +U32 rateGroup1_6HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {6000}; +U32 rateGroup1_10HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {12000}; /** * \brief configure/setup components in project-specific way @@ -65,6 +67,8 @@ void configureTopology() { // Rate groups require context arrays. rateGroup10Hz.configure(rateGroup10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup10HzContext)); rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); + rateGroup1_6Hz.configure(rateGroup1_6HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_6HzContext)); + rateGroup1_10Hz.configure(rateGroup1_10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1_10HzContext)); gpioWatchdog.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 1e20354e..efeb40eb 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -53,6 +53,12 @@ enum { WARN = 3, FATAL = 5 }; namespace ReferenceDeployment_rateGroup1Hz { enum { WARN = 3, FATAL = 5 }; } +namespace ReferenceDeployment_rateGroup1_6Hz { +enum { WARN = 3, FATAL = 5 }; +} +namespace ReferenceDeployment_rateGroup1_10Hz { +enum { WARN = 3, FATAL = 5 }; +} namespace ReferenceDeployment_cmdSeq { enum { WARN = 3, FATAL = 5 }; } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 7d57293e..ce6a15b2 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,6 +37,16 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 3 + instance rateGroup1_6Hz: Svc.ActiveRateGroup base id 0x10003000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 4 + + instance rateGroup1_10Hz: Svc.ActiveRateGroup base id 0x10004000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \ queue size Default.QUEUE_SIZE * 2 \ stack size Default.STACK_SIZE \ diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 345a58c1..af4cef97 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -7,6 +7,8 @@ module ReferenceDeployment { enum Ports_RateGroups { rateGroup10Hz rateGroup1Hz + rateGroup1_6Hz + rateGroup1_10Hz } topology ReferenceDeployment { @@ -24,6 +26,8 @@ module ReferenceDeployment { # ---------------------------------------------------------------------- instance rateGroup10Hz instance rateGroup1Hz + instance rateGroup1_6Hz + instance rateGroup1_10Hz instance rateGroupDriver instance timer instance lora @@ -184,17 +188,21 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run - rateGroup1Hz.RateGroupMemberOut[5] -> imuManager.run rateGroup1Hz.RateGroupMemberOut[6] -> comDelay.run rateGroup1Hz.RateGroupMemberOut[7] -> burnwire.schedIn rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run rateGroup1Hz.RateGroupMemberOut[10] -> FileHandling.fileDownlink.Run rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run # doubles (20ms) rate group max time - rateGroup1Hz.RateGroupMemberOut[12] -> powerMonitor.run rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run - rateGroup1Hz.RateGroupMemberOut[14] -> adcs.run - rateGroup1Hz.RateGroupMemberOut[15] -> thermalManager.run + + rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn + rateGroup1_6Hz.RateGroupMemberOut[0] -> powerMonitor.run + + rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_10Hz] -> rateGroup1_10Hz.CycleIn + rateGroup1_10Hz.RateGroupMemberOut[0] -> imuManager.run + rateGroup1_10Hz.RateGroupMemberOut[1] -> adcs.run + rateGroup1_10Hz.RateGroupMemberOut[2] -> thermalManager.run } diff --git a/FprimeZephyrReference/project/config/AcConstants.fpp b/FprimeZephyrReference/project/config/AcConstants.fpp index 2c84297d..2408d32a 100644 --- a/FprimeZephyrReference/project/config/AcConstants.fpp +++ b/FprimeZephyrReference/project/config/AcConstants.fpp @@ -10,7 +10,7 @@ constant ActiveRateGroupOutputPorts = 16 constant PassiveRateGroupOutputPorts = 10 @ Used to drive rate groups -constant RateGroupDriverRateGroupPorts = 3 +constant RateGroupDriverRateGroupPorts = 4 @ Used for command and registration ports constant CmdDispatcherComponentCommandPorts = 35 From 9011012e97557a97232c78c04bae658d5a1a0202 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Thu, 4 Dec 2025 19:12:18 -0600 Subject: [PATCH 67/68] Fix for face4 BSOD --- .../Components/ADCS/ADCS.cpp | 12 +++++- .../Components/ADCS/ADCS.fpp | 8 +++- .../Components/LoadSwitch/LoadSwitch.cpp | 3 ++ .../Top/ReferenceDeploymentPackets.fppi | 30 +++++++------- .../Top/ReferenceDeploymentTopology.cpp | 6 ++- .../ReferenceDeployment/Top/topology.fpp | 41 +++++++++++++------ 6 files changed, 69 insertions(+), 31 deletions(-) diff --git a/FprimeZephyrReference/Components/ADCS/ADCS.cpp b/FprimeZephyrReference/Components/ADCS/ADCS.cpp index 8a756d83..2c3b4649 100644 --- a/FprimeZephyrReference/Components/ADCS/ADCS.cpp +++ b/FprimeZephyrReference/Components/ADCS/ADCS.cpp @@ -24,10 +24,20 @@ ADCS::~ADCS() {} void ADCS::run_handler(FwIndexType portNum, U32 context) { Fw::Success condition; - // Face light sensors + // Visible light for (FwIndexType i = 0; i < this->getNum_visibleLightGet_OutputPorts(); i++) { this->visibleLightGet_out(i, condition); } + + // Infra-red light + for (FwIndexType i = 0; i < this->getNum_infraRedLightGet_OutputPorts(); i++) { + this->infraRedLightGet_out(i, condition); + } + + // Ambient light + for (FwIndexType i = 0; i < this->getNum_ambientLightGet_OutputPorts(); i++) { + this->ambientLightGet_out(i, condition); + } } } // namespace Components diff --git a/FprimeZephyrReference/Components/ADCS/ADCS.fpp b/FprimeZephyrReference/Components/ADCS/ADCS.fpp index 57f2b661..8315f709 100644 --- a/FprimeZephyrReference/Components/ADCS/ADCS.fpp +++ b/FprimeZephyrReference/Components/ADCS/ADCS.fpp @@ -3,9 +3,15 @@ module Components { passive component ADCS { sync input port run: Svc.Sched - @ Port for face light sensors + @ Port for visible light from the light sensors output port visibleLightGet: [6] Drv.lightGet + @Port for infra-red light from the light sensors + output port infraRedLightGet: [6] Drv.lightGet + + @Port for ambient light from the light sensors + output port ambientLightGet: [6] Drv.lightGet + ############################################################################### # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # ############################################################################### diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 094cd976..f16f6834 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -60,6 +60,9 @@ void LoadSwitch ::setLoadSwitchState(Fw::On state) { // Inform downstream components of the state change for (FwIndexType i = 0; i < this->getNum_loadSwitchStateChanged_OutputPorts(); i++) { + if (!this->isConnected_loadSwitchStateChanged_OutputPort(i)) { + continue; + } this->loadSwitchStateChanged_out(i, state); } this->log_ACTIVITY_HI_StatusChanged(state); diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 619ebb6f..d3126da5 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -90,7 +90,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.powerMonitor.TotalPowerGenerated } - packet Thermal id 12 group 4 { + packet Thermal id 11 group 4 { ReferenceDeployment.tmp112Face0Manager.Temperature ReferenceDeployment.tmp112Face1Manager.Temperature ReferenceDeployment.tmp112Face2Manager.Temperature @@ -110,20 +110,6 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.veml6031Face5Manager.VisibleLight ReferenceDeployment.veml6031Face6Manager.VisibleLight ReferenceDeployment.veml6031Face7Manager.VisibleLight - ReferenceDeployment.veml6031Face0Manager.InfraRedLight - ReferenceDeployment.veml6031Face1Manager.InfraRedLight - ReferenceDeployment.veml6031Face2Manager.InfraRedLight - ReferenceDeployment.veml6031Face3Manager.InfraRedLight - ReferenceDeployment.veml6031Face5Manager.InfraRedLight - ReferenceDeployment.veml6031Face6Manager.InfraRedLight - ReferenceDeployment.veml6031Face7Manager.InfraRedLight - ReferenceDeployment.veml6031Face0Manager.AmbientLight - ReferenceDeployment.veml6031Face1Manager.AmbientLight - ReferenceDeployment.veml6031Face2Manager.AmbientLight - ReferenceDeployment.veml6031Face3Manager.AmbientLight - ReferenceDeployment.veml6031Face5Manager.AmbientLight - ReferenceDeployment.veml6031Face6Manager.AmbientLight - ReferenceDeployment.veml6031Face7Manager.AmbientLight } } omit { @@ -161,4 +147,18 @@ telemetry packets ReferenceDeploymentPackets { FileHandling.fileManager.Errors FileHandling.fileUplink.Warnings FileHandling.fileDownlink.Warnings + ReferenceDeployment.veml6031Face0Manager.InfraRedLight + ReferenceDeployment.veml6031Face1Manager.InfraRedLight + ReferenceDeployment.veml6031Face2Manager.InfraRedLight + ReferenceDeployment.veml6031Face3Manager.InfraRedLight + ReferenceDeployment.veml6031Face5Manager.InfraRedLight + ReferenceDeployment.veml6031Face6Manager.InfraRedLight + ReferenceDeployment.veml6031Face7Manager.InfraRedLight + ReferenceDeployment.veml6031Face0Manager.AmbientLight + ReferenceDeployment.veml6031Face1Manager.AmbientLight + ReferenceDeployment.veml6031Face2Manager.AmbientLight + ReferenceDeployment.veml6031Face3Manager.AmbientLight + ReferenceDeployment.veml6031Face5Manager.AmbientLight + ReferenceDeployment.veml6031Face6Manager.AmbientLight + ReferenceDeployment.veml6031Face7Manager.AmbientLight } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 9f3eef19..e8ae548e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -42,8 +42,10 @@ constexpr FwSizeType getRateGroupPeriod(const FwSizeType hz) { // The reference topology divides the incoming clock signal (1Hz) into sub-signals: 1Hz, 1/2Hz, and 1/4Hz with 0 offset Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{ // Array of divider objects - {getRateGroupPeriod(10), 0}, // 10Hz - {getRateGroupPeriod(1), 0}, // 1Hz + {getRateGroupPeriod(10), 0}, // 10Hz = 100ms + {getRateGroupPeriod(1), 0}, // 1Hz = 1s + {6000, 0}, // 1/6Hz = 6s + {12000, 0} // 1/10Hz = 10s }}; // Rate groups may supply a context token to each of the attached children whose purpose is set by the project. The diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index af4cef97..5c80fb1c 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -186,23 +186,23 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn - rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run - rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run - rateGroup1Hz.RateGroupMemberOut[6] -> comDelay.run - rateGroup1Hz.RateGroupMemberOut[7] -> burnwire.schedIn - rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn - rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run - rateGroup1Hz.RateGroupMemberOut[10] -> FileHandling.fileDownlink.Run - rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run # doubles (20ms) rate group max time - rateGroup1Hz.RateGroupMemberOut[13] -> modeManager.run + rateGroup1Hz.RateGroupMemberOut[3] -> watchdog.run + rateGroup1Hz.RateGroupMemberOut[4] -> comDelay.run + rateGroup1Hz.RateGroupMemberOut[5] -> burnwire.schedIn + rateGroup1Hz.RateGroupMemberOut[6] -> antennaDeployer.schedIn + rateGroup1Hz.RateGroupMemberOut[7] -> fsSpace.run + rateGroup1Hz.RateGroupMemberOut[8] -> FileHandling.fileDownlink.Run + rateGroup1Hz.RateGroupMemberOut[9] -> startupManager.run # doubles (20ms) rate group max time + rateGroup1Hz.RateGroupMemberOut[10] -> modeManager.run rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn rateGroup1_6Hz.RateGroupMemberOut[0] -> powerMonitor.run + rateGroup1_6Hz.RateGroupMemberOut[1] -> imuManager.run + rateGroup1_6Hz.RateGroupMemberOut[2] -> adcs.run + rateGroup1_6Hz.RateGroupMemberOut[3] -> thermalManager.run rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_10Hz] -> rateGroup1_10Hz.CycleIn - rateGroup1_10Hz.RateGroupMemberOut[0] -> imuManager.run - rateGroup1_10Hz.RateGroupMemberOut[1] -> adcs.run - rateGroup1_10Hz.RateGroupMemberOut[2] -> thermalManager.run + rateGroup1_10Hz.RateGroupMemberOut[0] -> CdhCore.tlmSend.Run } @@ -297,11 +297,28 @@ module ReferenceDeployment { connections adcs { adcs.visibleLightGet[0] -> veml6031Face0Manager.visibleLightGet + adcs.infraRedLightGet[0] -> veml6031Face0Manager.infraRedLightGet + adcs.ambientLightGet[0] -> veml6031Face0Manager.ambientLightGet + adcs.visibleLightGet[1] -> veml6031Face1Manager.visibleLightGet + adcs.infraRedLightGet[1] -> veml6031Face1Manager.infraRedLightGet + adcs.ambientLightGet[1] -> veml6031Face1Manager.ambientLightGet + adcs.visibleLightGet[2] -> veml6031Face2Manager.visibleLightGet + adcs.infraRedLightGet[2] -> veml6031Face2Manager.infraRedLightGet + adcs.ambientLightGet[2] -> veml6031Face2Manager.ambientLightGet + adcs.visibleLightGet[3] -> veml6031Face3Manager.visibleLightGet + adcs.infraRedLightGet[3] -> veml6031Face3Manager.infraRedLightGet + adcs.ambientLightGet[3] -> veml6031Face3Manager.ambientLightGet + adcs.visibleLightGet[4] -> veml6031Face5Manager.visibleLightGet + adcs.infraRedLightGet[4] -> veml6031Face5Manager.infraRedLightGet + adcs.ambientLightGet[4] -> veml6031Face5Manager.ambientLightGet + adcs.visibleLightGet[5] -> veml6031Face6Manager.visibleLightGet + adcs.infraRedLightGet[5] -> veml6031Face6Manager.infraRedLightGet + adcs.ambientLightGet[5] -> veml6031Face6Manager.ambientLightGet } connections ModeManager { From a0dcb056af472f1d515504cb162d35da083c35dd Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Thu, 4 Dec 2025 19:48:00 -0600 Subject: [PATCH 68/68] with topology --- .../ReferenceDeployment/Top/topology.fpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 5c80fb1c..7f467bcd 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -186,14 +186,15 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn - rateGroup1Hz.RateGroupMemberOut[3] -> watchdog.run - rateGroup1Hz.RateGroupMemberOut[4] -> comDelay.run - rateGroup1Hz.RateGroupMemberOut[5] -> burnwire.schedIn - rateGroup1Hz.RateGroupMemberOut[6] -> antennaDeployer.schedIn - rateGroup1Hz.RateGroupMemberOut[7] -> fsSpace.run - rateGroup1Hz.RateGroupMemberOut[8] -> FileHandling.fileDownlink.Run - rateGroup1Hz.RateGroupMemberOut[9] -> startupManager.run # doubles (20ms) rate group max time - rateGroup1Hz.RateGroupMemberOut[10] -> modeManager.run + rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run + rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run + rateGroup1Hz.RateGroupMemberOut[5] -> comDelay.run + rateGroup1Hz.RateGroupMemberOut[6] -> burnwire.schedIn + rateGroup1Hz.RateGroupMemberOut[7] -> antennaDeployer.schedIn + rateGroup1Hz.RateGroupMemberOut[8] -> fsSpace.run + rateGroup1Hz.RateGroupMemberOut[9] -> FileHandling.fileDownlink.Run + rateGroup1Hz.RateGroupMemberOut[10] -> startupManager.run # doubles (20ms) rate group max time + rateGroup1Hz.RateGroupMemberOut[11] -> modeManager.run rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_6Hz] -> rateGroup1_6Hz.CycleIn rateGroup1_6Hz.RateGroupMemberOut[0] -> powerMonitor.run @@ -202,7 +203,6 @@ module ReferenceDeployment { rateGroup1_6Hz.RateGroupMemberOut[3] -> thermalManager.run rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1_10Hz] -> rateGroup1_10Hz.CycleIn - rateGroup1_10Hz.RateGroupMemberOut[0] -> CdhCore.tlmSend.Run }