warning
🚧 This document is still being actively worked on and is subject to change. 🚧
| Responsible |
|
| Last Updated | 10/12/2025, 12:48:54 PM |
| Last Author | Kai Berszin |
Communication
This document outlines the communication with other subsystems. It shall detail what the communication interfaces with the OBC provide and how they work.
CSP​
Reference​
- OBC uses the release version
libcsp-v2.0. - Implementation of libcsp is covered by the files
application/Inc/csp.happlication/Src/csp.c
- Protocol: UDP
- There is exactly one interface for the entire OBC.
- FreeRTOS Tasks (see code/doxygen for details):
vCSPClientTask: Responsible of sendingvCSPServerTask: Responsible of receivingvCSPRouterTask: Responsible of tracking packet assembly
- Functions:
CspSend()for sending data
- The following defines must figure somewhere, in order to maintain consistency with other subsystems:
#define CSP_OBC_PORT 10
#define CSP_OUR_ADDRESS 2
- Relevant SBUS topics:
TOPIC_CSP_SENDTOPIC_CSP_RCV
Usage​
Sending bytes of data.​
The CspSend() function may be used for sending data over CSP to a specified address. For sending, the user must ensure that the buffer-pointer provided as input points to an allocated region of the length specified by the user containing data to be sent over CSP.
Sending may fail in case CSP's internal packet buffer queue is full. This case must be considered when using the interface.
Behavior​
Upon send​
CspSend(), running in the domain of the calling task, allocates a packet in the CSP system, then sends its address through an SBUS packet.- The FreeRTOS task
vCSPClientTaskis subscribed to the topicTOPIC_CSP_SEND. It sends packets whose addresses were received over the SBUS through CSP.
Upon receive​
- While packets get assembled fragment by fragment (see CFP in the libcsp documentation),
vRouterTaskwaits on a packet queue fed by the CFP layer of CSP. If a packet is added to the queue, the task routes this packet to the OBC CSP interface. vCSPServerTaskwaits for incoming packets at the CSP interface. If a packet is received, the task sends its address over the SBUS- Tasks subscribe to the topic
TOPIC_CSP_RCVto receive the memory address of incoming packets.
TODO​
- More sophisticated routing for intercommunication between PAY, COM and OBC.
- Proper user framework for receiving data, abstracting packets away like in
CspSend().