SEDSAT-2 Communications Design Notes 20080602
From SEDSWiki
Communications MCU development/simulation
The comms MCU will be based on a Microchip PIC 18F42420 and we will program the MCU using a C compiler. The MCU has various jobs, some of these include:
- perform the powerup sequence
- control when to start/stop transmitting
- add error correction/checksums to data we want to transmit
- perform link multiplexing so that we don't try and transmit while the ground station is transmitting
- perform packet retransmission, if the Ground station report previously transmitted packets as missing
- various other tasks
We need to design some protocols and algorithms to perform the above tasks, but if we try to design them on the MCU itself, then we've got two problems to solve at the same time: how to design the protocols/algorithms, and how to program/test/debug the MCU hardware. It is useful to split these problems into two. First, we design/prototype the protocols/algorithms using a software MCU simulator. This lets us focus on getting the protocols working without worrying about MCU test hardware such as programming/test boards. Second, once we have prototyped our protocols/algorithms in the simulator and we are happy that they work, we can then start implementing them on MCU itself, in the C language.
SimEngine overview
A small Java MCU simulator has been developed, it is in the SVN repository in: comm/design/MCU/SimEngine/. It uses an event-driven programming style, so things in the program only happen when events occur. Events could be receiving some data from the uplink channel, or receiving a control command from CDH. At all other times, the program just waits for an event to occur. This is what the final MCU will do too.
The files currently in the SimEngine directory are: CubeSat.java, Link.java, Packet.java, Ground.java, Node.java and SimCore.java.
- SimCore.java: this is the central piece of the simulator. This implements the event-handling code, and allows an Object to instruct the SimCore that it wants to be executed at a certain time. When that time is reached, the SimCore looks for a run() method in that Object, and executes it.
- Node.java: this is an abstract class which represents nodes in the network. A node is anything which handles information, it could be a ground station or a satellite for example. Each node can have one outgoing link attached to it.
- Link.java: this class represents links between nodes. It specifies the destination node for a link. If Node A puts some data in a link (which is connected to Node B), then after the link delay, the data will appear at Node B - and Node B's run() method will be executed, because an event has occured!
- Packet.java: this class specifies the packet format for data that is transmitted between the satellite and ground station (and vice-versa)
- Ground.java: this Object is an instance of the Node class, it represents the Ground station and should implement all the Ground station tasks.
- CubeSat.java: this Object is another instance of the Node class, and it represents our CubeSat, and should implement all the CubeSat protocols/algorithms.
Tasks
Here is the current task-list for the MCU simulator: these are the things we need to implement. Not everything we need to do is listed here, but as I think of more things, I'll add them to this list.
- Create a Packet class and define fields that we need, then modify the simulator to send Packets rather than Strings.
- Add packet-damage functionality to the Link (so we can simulate packet errors)
- Stop-and-Wait ARQ, on-top of the base simulator, so that the satellite doesn't try transmitting when the ground station is transmitting
- Sliding-window protocol, on-top of the Stop-and-Wait ARQ protocol, so that we can retransmit damaged/corrupted packets
- Transmit multiplexing - we just need to port the existing code over to the simulator
Feel free to take one of the above tasks and start implementing it. If you've got any questions, contact me (Steve) on Yahoo IM, on Skype, or if I'm not online, e-mail me and suggest a time when we could meet on Skype/Yahoo and I'll get back to you as soon as possible.

