|
| 1 | +--- |
| 2 | +title: OBC Software Test File |
| 3 | +parent: For OBC Team Members |
| 4 | +nav_order: |
| 5 | +# permalink: "/obc/test-file" |
| 6 | +nav_exclude: false |
| 7 | +layout: default |
| 8 | +lang: en |
| 9 | +--- |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## 🛰️ Mission Command List Guide |
| 14 | + |
| 15 | +This guide explains how to structure and use UART commands sent to the COM PIC, which forwards them to the Main PIC. These commands are used for simulation and control during testing. While the actual command is **14 bytes**, the simulator expects **25 bytes**. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +### 📦 Command Packet Format |
| 20 | + |
| 21 | +Each **Mission Command** consists of the following: |
| 22 | + |
| 23 | +| Byte Index | Field | Description | |
| 24 | +| ---------- | --------------------- | --------------------------------------------------- | |
| 25 | +| 0 | `Header` | Always `0x42` | |
| 26 | +| 1 | `Satellite ID` | Always `0x57` | |
| 27 | +| 2 | `Reservation Time` | Set to `0x00` | |
| 28 | +| 3 | `Command ID0` | Set to `0xB4` | |
| 29 | +| 4 | `Command ID1` | Varies – defines the operation (see below) | |
| 30 | +| 5–11 | `Mission Mode / Data` | Payload (mode settings, packet numbers, etc.) | |
| 31 | +| 12–13 | `CRC` | CRC0 (LSB), CRC1 (MSB) – Checksum of first 12 bytes | |
| 32 | +| 14–24 | `Padding` (0x00) | Simulator requires 25-byte total length | |
| 33 | + |
| 34 | +**Note:** During actual command transmission, only the **first 14 bytes** are used. |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +### 🔧 Commands and Usage |
| 39 | + |
| 40 | +| # | Command ID1 | Description | Mission Data | Example Command | |
| 41 | +| - | ----------- | ------------------------------- | ------------ | ----------------------------------------------- | |
| 42 | +| 1 | `0x00` | **TURN OFF DP** | All `0x00` | `42 57 00 B4 00 00 00 00 00 00 00 00 CRC0 CRC1` | |
| 43 | +| 2 | `0x00` | **ACTIVATE DP** (Default Mode) | All `0x00` | `42 57 00 B4 00 00 00 00 00 00 00 00 CRC0 CRC1` | |
| 44 | +| 3 | `0x01` | **ACTIVATE SF Mode** | All `0x00` | `42 57 00 B4 01 00 00 00 00 00 00 00 CRC0 CRC1` | |
| 45 | +| 4 | `0x01` | **Transfer 1 data packet** | All `0x00` | `42 57 00 B4 01 00 00 00 00 00 00 00 CRC0 CRC1` | |
| 46 | +| 5 | `0x00` | **Transfer all packets** | All `0x00` | `42 57 00 B4 00 00 00 00 00 00 00 00 CRC0 CRC1` | |
| 47 | +| 6 | `0x00` | **Transfer N packets (custom)** | Byte 4 = N | `42 57 00 B4 NN 00 00 00 00 00 00 00 CRC0 CRC1` | |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +### 🧮 CRC Calculation |
| 52 | + |
| 53 | +Use CRC-16-CCITT (or your protocol-specific CRC) on the first 12 bytes (`[0]` to `[11]`) to generate: |
| 54 | + |
| 55 | +* **CRC0 (LSB)** |
| 56 | +* **CRC1 (MSB)** |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +### 💻 Sending Over UART |
| 61 | + |
| 62 | +1. Construct a 14-byte array: `[0] to [13]` |
| 63 | +2. Pad with 11 zeroes if needed for simulation: `[14] to [24]` |
| 64 | +3. Transmit the 25-byte buffer over UART to COM PIC |
| 65 | +4. COM PIC routes to MAIN PIC for action |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +### 📁 Add File Download |
| 70 | + |
| 71 | +To allow downloading of the `.c` file (e.g., command handler or reset script) from your website: |
| 72 | + |
| 73 | +```html |
| 74 | +<a href="/files/reset_pic_command.c" download>Download Reset PIC Command Code</a> |
| 75 | +``` |
| 76 | + |
| 77 | +> ✅ Ensure the file `reset_pic_command.c` is stored in the correct `/files/` directory on your web server. |
| 78 | +
|
| 79 | +--- |
| 80 | + |
| 81 | +### 📘 Summary |
| 82 | + |
| 83 | +* Actual command = 14 bytes (Header + Payload + CRC) |
| 84 | +* Simulated command = 25 bytes (padded with zeroes) |
| 85 | +* All commands go through COM PIC to MAIN PIC |
| 86 | +* Command ID1 and payload define the operation |
| 87 | +* CRC must be valid to accept command |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +Let me know if you want a Markdown or downloadable PDF version of this guide—or help with the actual `.c` file content. |
0 commit comments