kopia lustrzana https://github.com/rs1729/RS
LMS6-ECC: FRAME 300 / RS-BLOCK (255+5)
rodzic
0dcb0c2aa6
commit
cea60ead2b
|
@ -2,6 +2,7 @@
|
||||||
Lockheed Martin Sippican LMS6
|
Lockheed Martin Sippican LMS6
|
||||||
(403 MHz)
|
(403 MHz)
|
||||||
|
|
||||||
|
|
||||||
FSK 4800 baud
|
FSK 4800 baud
|
||||||
NRZ-S, convolutional code R=1/2
|
NRZ-S, convolutional code R=1/2
|
||||||
K=8: 0x95: pA = x^7+x^4+x^2+1 = (x+1)(x^6+x^5+x^4+x+1) = (x+1)qA
|
K=8: 0x95: pA = x^7+x^4+x^2+1 = (x+1)(x^6+x^5+x^4+x+1) = (x+1)qA
|
||||||
|
@ -12,11 +13,29 @@ NRZ-S, convolutional code R=1/2
|
||||||
bits: little endian
|
bits: little endian
|
||||||
bytes: big endian
|
bytes: big endian
|
||||||
|
|
||||||
Reed-Solomon RS(223,32)-CCSDS
|
|
||||||
(msg[223],par[32]): 223+32 byte vor 5-byte-Block [00 58 f3 3f b8] (ring-buffer!)
|
|
||||||
|
|
||||||
|
4800 bit/s: rate=1/2: 300 byte/s
|
||||||
|
|
||||||
|
Reed-Solomon RS(223,32)-CCSDS blocks
|
||||||
|
block format: SYNC (5 byte) + RS-codeword (255 byte) (-> block size: 260 byte)
|
||||||
|
SYNC: 0x0058f33fb8
|
||||||
|
RS-codeword: RS-MSG (223 byte) + RS-PAR (32 byte)
|
||||||
|
|
||||||
|
260:300 = 13:15 - every 13 sec block-position repeats,
|
||||||
|
full-frame length 13 sec (data-frames): 13*300 byte = 15 blocks
|
||||||
|
|
||||||
|
1 data-frame per sec: 223 DATA bytes ( + fill)
|
||||||
|
DATA = 221 byte + 2 byte CRC16
|
||||||
|
DATA: 24 54 00 00 .. (len=221+2)
|
||||||
CRC16: poly 0x1021
|
CRC16: poly 0x1021
|
||||||
crc-frame: 24 54 00 00 00 .. (len=221)
|
|
||||||
|
synchronisation:
|
||||||
|
a) (24)54 00 00 .. (DATA-frame)
|
||||||
|
b) (00)58 f3 3f b8 (RS-block)
|
||||||
|
|
||||||
|
every 6/7 sec: DATA=RS-MSG | SYNC | ...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sync/header:
|
sync/header:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(403 MHz)
|
(403 MHz)
|
||||||
|
|
||||||
gcc lms6ecc.c -lm -o lms6ecc
|
gcc lms6ecc.c -lm -o lms6ecc
|
||||||
./lms6ecc -v -b --ecc <audio.wav>
|
./lms6ecc -v -b --ecc2 <audio.wav>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -228,6 +228,12 @@ ui8_t *frame_bytes = frame+OFS; // { 0x00, 0x7A, ... }
|
||||||
|
|
||||||
ui8_t *p_frame = frame;
|
ui8_t *p_frame = frame;
|
||||||
|
|
||||||
|
// RS-SYNC
|
||||||
|
// (00) 58 f3 3f b8
|
||||||
|
// ................ 0000001011110011 1110110100100011 0110100000001011 0101110001011110
|
||||||
|
ui8_t rs_sync[] = { 0x00, 0x58, 0xf3, 0x3f, 0xb8};
|
||||||
|
|
||||||
|
|
||||||
char buf[HEADLEN];
|
char buf[HEADLEN];
|
||||||
int bufpos = -1;
|
int bufpos = -1;
|
||||||
|
|
||||||
|
@ -748,16 +754,13 @@ int get_GPSvel24() {
|
||||||
#define rs_K 223
|
#define rs_K 223
|
||||||
#define rs_R (rs_N-rs_K) // 32
|
#define rs_R (rs_N-rs_K) // 32
|
||||||
ui8_t rs_cw[rs_N];
|
ui8_t rs_cw[rs_N];
|
||||||
int eccnt = 0;
|
|
||||||
|
|
||||||
ui8_t rs_ecc32end[] = { 0x00, 0x58, 0xf3, 0x3f, 0xb8};
|
|
||||||
|
|
||||||
ui8_t frm_bytes[FRAME_LEN+OVERLAP +8];
|
|
||||||
|
|
||||||
#define ECCBUF_LEN (3*FRAME_LEN+32)
|
#define ECCBUF_LEN (3*FRAME_LEN+32)
|
||||||
ui8_t ecc_buf[ECCBUF_LEN];
|
ui8_t ecc_buf[ECCBUF_LEN];
|
||||||
int bufidx = 0;
|
int bufidx = 0;
|
||||||
|
|
||||||
|
ui8_t frm_bytes[FRAME_LEN+OVERLAP +8];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int pos;
|
int pos;
|
||||||
ui8_t bytes[FRAME_LEN+OVERLAP+5 +8];
|
ui8_t bytes[FRAME_LEN+OVERLAP+5 +8];
|
||||||
|
@ -890,7 +893,7 @@ void proc_frame(int len) {
|
||||||
pos = 0;
|
pos = 0;
|
||||||
for (n = 0; n < flen-rs_R-5; n++) {
|
for (n = 0; n < flen-rs_R-5; n++) {
|
||||||
int bf = 0;
|
int bf = 0;
|
||||||
for (j = 0; j < 5; j++) bf += (frm_bytes[n+rs_R+j] == rs_ecc32end[j]);
|
for (j = 0; j < 5; j++) bf += (frm_bytes[n+rs_R+j] == rs_sync[j]);
|
||||||
if (bf == 5) {
|
if (bf == 5) {
|
||||||
if (k < kMAX) {
|
if (k < kMAX) {
|
||||||
rsbf[k].epos = rs_R + n;
|
rsbf[k].epos = rs_R + n;
|
||||||
|
|
Ładowanie…
Reference in New Issue