Skip to content

Commit 95faeb9

Browse files
LeStarchineskhouMikefly123nateinaction
authored
Radio (LoRa) Integration (#40)
* updated fprime zephyr version * Initial radio addition * Add LoRa transmit * Add com delay component * Create custom_space_data_link.py this is for a patch for the gds accepting da packages * Allows Makefile with F Prime version and run GDS with camera * Add circuit pass-through * Update to use aggregation * Update to use aggregation * Appease Linter * Ran Linter * Fix Submodules * try * Apply suggestion from @nateinaction * changed the aggregator * Revert bootloadertrigger change * spacing * updated instrcutions and flow to run the circuitpython radio example * Add in com splitter and UART com * Fix format errors * letting ComIn be valid * Update to correct miss-aggregations * Fix LoRa beaconing * Update code.py * Lint * change back to do bc broncospace is out of cs and need to run integration test on lav sorry nate!!! --------- Co-authored-by: ineskhou <[email protected]> Co-authored-by: ineskhou <[email protected]> Co-authored-by: Michael Pham <[email protected]> Co-authored-by: Nate Gay <[email protected]> Co-authored-by: Nate Gay <[email protected]>
1 parent b92c946 commit 95faeb9

30 files changed

+444
-228
lines changed

.codespell-ignore-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comIn

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repos:
1212
rev: v2.4.1
1313
hooks:
1414
- id: codespell
15+
args: [--ignore-words=.codespell-ignore-words.txt]
1516

1617
- repo: https://github.com/pre-commit/mirrors-clang-format
1718
rev: v20.1.8
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This CMake file is intended to register project-wide objects.
22
# This allows for reuse between deployments, or other projects.
33

4+
# Keep me first
45
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/project/config")
56
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Components")
7+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComCcsdsUart/")
68
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ReferenceDeployment/")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
register_fprime_module(
3+
EXCLUDE_FROM_ALL
4+
AUTOCODER_INPUTS
5+
"${CMAKE_CURRENT_LIST_DIR}/ComCcsds.fpp"
6+
HEADERS
7+
"${CMAKE_CURRENT_LIST_DIR}/SubtopologyTopologyDefs.hpp"
8+
"${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp"
9+
DEPENDS
10+
Svc_Subtopologies_ComCcsds_ComCcsdsConfig
11+
INTERFACE
12+
)
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
module ComCcsdsUart {
2+
3+
# ComPacket Queue enum for queue types
4+
enum Ports_ComPacketQueue {
5+
EVENTS,
6+
TELEMETRY
7+
}
8+
9+
enum Ports_ComBufferQueue {
10+
FILE
11+
}
12+
13+
# ----------------------------------------------------------------------
14+
# Active Components
15+
# ----------------------------------------------------------------------
16+
instance comQueue: Svc.ComQueue base id ComCcsdsConfig.BASE_ID_UART + 0x00000 \
17+
queue size ComCcsdsConfig.QueueSizes.comQueue \
18+
stack size ComCcsdsConfig.StackSizes.comQueue \
19+
priority ComCcsdsConfig.Priorities.comQueue \
20+
{
21+
phase Fpp.ToCpp.Phases.configComponents """
22+
using namespace ComCcsdsUart;
23+
Svc::ComQueue::QueueConfigurationTable configurationTableUart;
24+
25+
// Events (highest-priority)
26+
configurationTableUart.entries[Ports_ComPacketQueue::EVENTS].depth = ComCcsdsConfig::QueueDepths::events;
27+
configurationTableUart.entries[Ports_ComPacketQueue::EVENTS].priority = ComCcsdsConfig::QueuePriorities::events;
28+
29+
// Telemetry
30+
configurationTableUart.entries[Ports_ComPacketQueue::TELEMETRY].depth = ComCcsdsConfig::QueueDepths::tlm;
31+
configurationTableUart.entries[Ports_ComPacketQueue::TELEMETRY].priority = ComCcsdsConfig::QueuePriorities::tlm;
32+
33+
// File Downlink Queue (buffer queue using NUM_CONSTANTS offset)
34+
configurationTableUart.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].depth = ComCcsdsConfig::QueueDepths::file;
35+
configurationTableUart.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].priority = ComCcsdsConfig::QueuePriorities::file;
36+
37+
// Allocation identifier is 0 as the MallocAllocator discards it
38+
ComCcsdsUart::comQueue.configure(configurationTableUart, 0, ComCcsds::Allocation::memAllocator);
39+
"""
40+
phase Fpp.ToCpp.Phases.tearDownComponents """
41+
ComCcsdsUart::comQueue.cleanup();
42+
"""
43+
}
44+
45+
instance aggregator: Svc.ComAggregator base id ComCcsdsConfig.BASE_ID_UART + 0x06000 \
46+
queue size ComCcsdsConfig.QueueSizes.aggregator \
47+
stack size ComCcsdsConfig.StackSizes.aggregator
48+
49+
# ----------------------------------------------------------------------
50+
# Passive Components
51+
# ----------------------------------------------------------------------
52+
instance frameAccumulator: Svc.FrameAccumulator base id ComCcsdsConfig.BASE_ID_UART + 0x01000 \
53+
{
54+
55+
phase Fpp.ToCpp.Phases.configObjects """
56+
Svc::FrameDetectors::CcsdsTcFrameDetector frameDetector;
57+
"""
58+
phase Fpp.ToCpp.Phases.configComponents """
59+
ComCcsdsUart::frameAccumulator.configure(
60+
ConfigObjects::ComCcsdsUart_frameAccumulator::frameDetector,
61+
1,
62+
ComCcsds::Allocation::memAllocator,
63+
ComCcsdsConfig::BuffMgr::frameAccumulatorSize
64+
);
65+
"""
66+
67+
phase Fpp.ToCpp.Phases.tearDownComponents """
68+
ComCcsdsUart::frameAccumulator.cleanup();
69+
"""
70+
}
71+
72+
instance commsBufferManager: Svc.BufferManager base id ComCcsdsConfig.BASE_ID_UART + 0x02000 \
73+
{
74+
phase Fpp.ToCpp.Phases.configObjects """
75+
Svc::BufferManager::BufferBins bins;
76+
"""
77+
78+
phase Fpp.ToCpp.Phases.configComponents """
79+
memset(&ConfigObjects::ComCcsdsUart_commsBufferManager::bins, 0, sizeof(ConfigObjects::ComCcsdsUart_commsBufferManager::bins));
80+
ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[0].bufferSize = ComCcsdsConfig::BuffMgr::commsBuffSize;
81+
ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[0].numBuffers = ComCcsdsConfig::BuffMgr::commsBuffCount;
82+
ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[1].bufferSize = ComCcsdsConfig::BuffMgr::commsFileBuffSize;
83+
ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[1].numBuffers = ComCcsdsConfig::BuffMgr::commsFileBuffCount;
84+
ComCcsdsUart::commsBufferManager.setup(
85+
ComCcsdsConfig::BuffMgr::commsBuffMgrId,
86+
0,
87+
ComCcsds::Allocation::memAllocator,
88+
ConfigObjects::ComCcsdsUart_commsBufferManager::bins
89+
);
90+
"""
91+
92+
phase Fpp.ToCpp.Phases.tearDownComponents """
93+
ComCcsdsUart::commsBufferManager.cleanup();
94+
"""
95+
}
96+
97+
instance fprimeRouter: Svc.FprimeRouter base id ComCcsdsConfig.BASE_ID_UART + 0x03000
98+
99+
instance tcDeframer: Svc.Ccsds.TcDeframer base id ComCcsdsConfig.BASE_ID_UART + 0x04000
100+
101+
instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer base id ComCcsdsConfig.BASE_ID_UART + 0x05000
102+
103+
# NOTE: name 'framer' is used for the framer that connects to the Com Adapter Interface for better subtopology interoperability
104+
instance framer: Svc.Ccsds.TmFramer base id ComCcsdsConfig.BASE_ID_UART + 0x07000
105+
106+
instance spacePacketFramer: Svc.Ccsds.SpacePacketFramer base id ComCcsdsConfig.BASE_ID_UART + 0x08000
107+
108+
instance apidManager: Svc.Ccsds.ApidManager base id ComCcsdsConfig.BASE_ID_UART + 0x09000
109+
110+
instance comStub: Svc.ComStub base id ComCcsdsConfig.BASE_ID_UART + 0x0A000
111+
112+
topology FramingSubtopology {
113+
# Usage Note:
114+
#
115+
# When importing this subtopology, users shall establish 5 port connections with a component implementing
116+
# the Svc.Com (Svc/Interfaces/Com.fpp) interface. They are as follows:
117+
#
118+
# 1) Outputs:
119+
# - ComCcsds.framer.dataOut -> [Svc.Com].dataIn
120+
# - ComCcsds.frameAccumulator.dataReturnOut -> [Svc.Com].dataReturnIn
121+
# 2) Inputs:
122+
# - [Svc.Com].dataReturnOut -> ComCcsds.framer.dataReturnIn
123+
# - [Svc.Com].comStatusOut -> ComCcsds.framer.comStatusIn
124+
# - [Svc.Com].dataOut -> ComCcsds.frameAccumulator.dataIn
125+
126+
127+
# Active Components
128+
instance comQueue
129+
130+
# Passive Components
131+
instance commsBufferManager
132+
instance frameAccumulator
133+
instance fprimeRouter
134+
instance tcDeframer
135+
instance spacePacketDeframer
136+
instance framer
137+
instance spacePacketFramer
138+
instance apidManager
139+
instance aggregator
140+
141+
connections Downlink {
142+
# ComQueue <-> SpacePacketFramer
143+
comQueue.dataOut -> spacePacketFramer.dataIn
144+
spacePacketFramer.dataReturnOut -> comQueue.dataReturnIn
145+
# SpacePacketFramer buffer and APID management
146+
spacePacketFramer.bufferAllocate -> commsBufferManager.bufferGetCallee
147+
spacePacketFramer.bufferDeallocate -> commsBufferManager.bufferSendIn
148+
spacePacketFramer.getApidSeqCount -> apidManager.getApidSeqCountIn
149+
# SpacePacketFramer <-> TmFramer
150+
spacePacketFramer.dataOut -> aggregator.dataIn
151+
aggregator.dataOut -> framer.dataIn
152+
153+
framer.dataReturnOut -> aggregator.dataReturnIn
154+
aggregator.dataReturnOut -> spacePacketFramer.dataReturnIn
155+
156+
# ComStatus
157+
framer.comStatusOut -> aggregator.comStatusIn
158+
aggregator.comStatusOut -> spacePacketFramer.comStatusIn
159+
spacePacketFramer.comStatusOut -> comQueue.comStatusIn
160+
# (Outgoing) Framer <-> ComInterface connections shall be established by the user
161+
}
162+
163+
connections Uplink {
164+
# (Incoming) ComInterface <-> FrameAccumulator connections shall be established by the user
165+
# FrameAccumulator buffer allocations
166+
frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn
167+
frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee
168+
# FrameAccumulator <-> TcDeframer
169+
frameAccumulator.dataOut -> tcDeframer.dataIn
170+
tcDeframer.dataReturnOut -> frameAccumulator.dataReturnIn
171+
# TcDeframer <-> SpacePacketDeframer
172+
tcDeframer.dataOut -> spacePacketDeframer.dataIn
173+
spacePacketDeframer.dataReturnOut -> tcDeframer.dataReturnIn
174+
# SpacePacketDeframer APID validation
175+
spacePacketDeframer.validateApidSeqCount -> apidManager.validateApidSeqCountIn
176+
# SpacePacketDeframer <-> Router
177+
spacePacketDeframer.dataOut -> fprimeRouter.dataIn
178+
fprimeRouter.dataReturnOut -> spacePacketDeframer.dataReturnIn
179+
# Router buffer allocations
180+
fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee
181+
fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn
182+
}
183+
} # end FramingSubtopology
184+
185+
# This subtopology uses FramingSubtopology with a ComStub component for Com Interface
186+
topology Subtopology {
187+
import FramingSubtopology
188+
189+
instance comStub
190+
191+
connections ComStub {
192+
# Framer <-> ComStub (Downlink)
193+
framer.dataOut -> comStub.dataIn
194+
comStub.dataReturnOut -> framer.dataReturnIn
195+
comStub.comStatusOut -> framer.comStatusIn
196+
197+
# ComStub <-> FrameAccumulator (Uplink)
198+
comStub.dataOut -> frameAccumulator.dataIn
199+
frameAccumulator.dataReturnOut -> comStub.dataReturnIn
200+
}
201+
} # end Subtopology
202+
203+
} # end ComCcsds
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
#ifndef COMCCSDS_PINGENTRIES_HPP
3+
#define COMCCSDS_PINGENTRIES_HPP
4+
5+
namespace PingEntries {
6+
// No ping-enabled components in ComCcsds subtopology
7+
}
8+
9+
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef COMCCSDSSUBTOPOLOGY_DEFS_HPP
2+
#define COMCCSDSSUBTOPOLOGY_DEFS_HPP
3+
4+
#include <Fw/Types/MallocAllocator.hpp>
5+
#include <Svc/BufferManager/BufferManager.hpp>
6+
#include <Svc/FrameAccumulator/FrameDetector/CcsdsTcFrameDetector.hpp>
7+
#include "ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp"
8+
#include "Svc/Subtopologies/ComCcsds/ComCcsdsConfig/FppConstantsAc.hpp"
9+
10+
namespace ComCcsds {
11+
struct SubtopologyState {
12+
// Empty - no external state needed for ComCcsds subtopology
13+
};
14+
15+
struct TopologyState {
16+
SubtopologyState comCcsds;
17+
};
18+
} // namespace ComCcsds
19+
20+
#endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ComCcsdsUart
2+
3+
This is a clone with a renamed module of the F Prime's Svc::ComCcsds.
4+
5+
See: [Svc::ComCcsds](../../../lib/fprime/Svc/Subtopologies/ComCcsds/docs/sdd.md)

FprimeZephyrReference/Components/ComDelay/ComDelay.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ void ComDelay ::run_handler(FwIndexType portNum, U32 context) {
5151
bool valid = this->m_last_status_valid.compare_exchange_strong(expected, false);
5252
if (valid) {
5353
this->comStatusOut_out(0, this->m_last_status);
54-
this->timeout_out(0, 0);
5554
}
5655
}
5756

FprimeZephyrReference/Components/ComDelay/ComDelay.fpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ module Components {
55
@ Rate schedule port used to trigger radio transmission
66
sync input port run: Svc.Sched
77

8-
@ Rate schedule port used to trigger aggregation timeout
9-
output port timeout: Svc.Sched
10-
118
@ Input comStatus from radio component
129
sync input port comStatusIn: Fw.SuccessCondition
1310

0 commit comments

Comments
 (0)