====== FPK data mode ====== This is a reverse-engineered description of the data mode used by [[Flare Pepper Kitchen]] option ''8''. ===== Modulation ===== FPK uses binary [[wp>Frequency-shift_keying#Audio_frequency-shift_keying|audio frequency-shift keying]] (AFSK). The default parameters are as follows: * Symbol rate: 300 Bd * Space (0) frequency: 1270 Hz * Mark (1) frequency: 1070 Hz ===== Bitstream ===== FPK transmissions consist of a series of bytes framed in the [[wp>8-N-1]] configuration. That is, each transmitted byte begins with a single ''0'' bit, followed by the eight data bits ordered least significant bit first, followed by a single ''1'' bit. The following sections describe unframed bytes in the conventional most significant bit first order. All multi-byte fields are big endian. ===== Packets ===== Each FPK transmission is a single packet. All packet types share the following structure: ^ Byte | 0 | 1 | 2 | 3 | ⋯ | N-6 | N-5 | N-4 | N-3 | N-2 | N-1 | ^ Value | ''0x5A5A5A5A'' |||| ::: | CRC || ''0x00000000'' |||| * **CRC** (16 bits): CRC-16-MODBUS computed from all preceding bytes in the packet, including the initial ''0x5A5A5A5A'' sequence. CRC-16-MODBUS is defined by the polynomial x16+x15+x2+1, initial state ''0xFFFF'', reflected input, and reflected output; for input bytes ''5A 5A 5A 5A 04 00 00'', the correct result is ''0xEBE6''. ==== Info packet ==== ^ Byte | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | ⋯ | N-7 | ^ Value | ''0x03'' | PC || ''0x00'' ||||||||||| MD5 |||||||||||||||| Filename ||| * **PC** (16 bits): Number of data packets in the file descriptor that have payload present. * **MD5** (128 bits): Binary [[wp>MD5]] hash of the transmitted file. * **Filename**: ASCII string terminated with a single ''0x00'' byte. ==== Data packet ==== ^ Byte | 4 | 5 | 6 | 7 | ⋯ | N-7 | ^ Value | ''0x04'' | BR || Payload ||| * **BR** (16 bits): Number of bytes remaining at this point in the transmission, excluding the current packet. In practical terms: * For the first data packet, this field is equal to the size of the file. * For the last data packet, this field is equal to the packet's payload length. * **Payload**: Bytes to copy into the file unmodified. Data packets with no payload are valid. ===== File descriptors ===== Each file descriptor is a series of numbered packets: * Packet ''0'' is always an [[#info packet]] with metadata on the transmitted file. * Packets ''1'', ''2'', ''3'', etc. are always [[#data packet|data packets]] with fragments of the file, in order from first to last. * Beyond the final data packet with payload present are empty data packets.