-
Notifications
You must be signed in to change notification settings - Fork 78
FEP 004
| Name | Value |
|---|---|
| FEP ID | 004 |
| Title | FujiNet Protocol |
| Author | Andrew Diller / AI |
| Status | Draft |
| Type | Informational |
| Created | 2025-07-20 |
| Version | 1.0 |
| Input | CO, OS (Discord) |
This document outlines a structured, packet-based communication protocol designed specifically for efficient command and response exchanges between the RP2350 Programmable I/O (PIO) subsystem and an ESP32 microcontroller within a FujiNet system. The protocol utilizes a clearly defined packet structure with little-endian byte ordering to optimize parsing efficiency on embedded hardware. Each packet includes synchronization bytes, command identifiers, sequence numbering for tracking, payload length indicators, and an optional CRC16 checksum to ensure data integrity. This design facilitates robust, error-resistant, and extensible communication suited for embedded device interactions.
#pragma pack(push, 1)
typedef struct {
uint8_t start_byte; // 0xAA for packet synchronization
uint8_t packet_type; // Command = 0x01, Response = 0x02
uint8_t command_id; // Command identifier
uint8_t sequence_num; // Incremental packet sequence number
uint16_t payload_length; // Length of payload (little-endian)
uint8_t payload[]; // Variable-length payload
// uint16_t crc; // CRC16 checksum follows payload
} FujiNet_packet;
#pragma pack(pop)-
start_byte (
0xAA): Packet synchronization. -
packet_type: Command (
0x01), Response (0x02). - command_id: Identifies command type.
- sequence_num: Matches commands and responses.
- payload_length: Length of payload (little-endian).
- payload: Data payload (little-endian).
- crc: CRC16 checksum (optional but recommended).
Command Packet (status request, command_id = 0x10):
| start_byte | AA |
| packet_type | 01 |
| command_id | 10 |
| sequence_num | 05 |
| payload_length | 00 00 |
| crc | CRC16 |
Response Packet (with 4-byte payload):
| start_byte | AA |
| packet_type | 02 |
| command_id | 10 |
| sequence_num | 05 |
| payload_length | 04 00 |
| payload | [status data] |
| crc | CRC16 |
- Start byte (
0xAA) for packet framing. - CRC16 checksum recommended.
- Define packet structure.
- Implement serialization/deserialization.
- CRC16 checksum validation.
- Thorough synchronization tests.
- Incremental command extensions.
void serialize_packet(uint8_t *buffer, FujiNet_packet *pkt) {
buffer[0] = pkt->start_byte;
buffer[1] = pkt->packet_type;
buffer[2] = pkt->command_id;
buffer[3] = pkt->sequence_num;
buffer[4] = pkt->payload_length & 0xFF;
buffer[5] = (pkt->payload_length >> 8) & 0xFF;
memcpy(&buffer[6], pkt->payload, pkt->payload_length);
uint16_t crc = crc16_ccitt(buffer, 6 + pkt->payload_length);
buffer[6 + pkt->payload_length] = crc & 0xFF;
buffer[7 + pkt->payload_length] = (crc >> 8) & 0xFF;
}- Structured, efficient, and maintainable.
- Robust parsing and error checking.
- Extensible design.
Copyright 2024 Contributors to the FujiNetWIFI project.
Join us on Discord: https://discord.gg/7MfFTvD
- Home
- What is FujiNet?
- The Definition of Done
- Board bring up for FujiNet Platform.IO code
- The Complete Linux CLI Guide
- The Complete macOS CLI Guide
- Development Env for Apps
- FujiNet-Development-Guidelines
- System Quickstarts
- FujiNet Flasher
- Setting up a TNFS Server
- FujiNet Configuration File: fnconfig.ini
- AppKey Registry - SIO Command $DC Open App Key
- CP-M Support
- BBS
- Official Hardware Versions
- Prototype Board Revisions
- FujiNet Development Guidelines
- Atari Programming
- Apple Programming
- C64 Programming
- ADAM Programming
- Testing Plan
- Hacker List
- FujiNet VirtualMachine