Add support for arbitraty descrambling polynomials on the FSK receiver

This commit is contained in:
Manolis Surligas 2017-04-15 01:23:47 +03:00
parent a94cf99a20
commit a8d0eae736
4 changed files with 252 additions and 211 deletions

View File

@ -3,7 +3,7 @@
<name>UPSAT FSK Frame Acquisition</name> <name>UPSAT FSK Frame Acquisition</name>
<key>satnogs_upsat_fsk_frame_acquisition</key> <key>satnogs_upsat_fsk_frame_acquisition</key>
<import>import satnogs</import> <import>import satnogs</import>
<make>satnogs.upsat_fsk_frame_acquisition($preamble, $sync_word, $whitening, $manchester, $check_crc, $ax_25)</make> <make>satnogs.upsat_fsk_frame_acquisition($preamble, $sync_word, $whitening, $manchester, $check_crc, $ax_25, $whitening_mask, $whitening_seed, $whitening_order)</make>
<param> <param>
<name>Frame Preamble</name> <name>Frame Preamble</name>
@ -73,6 +73,27 @@
</option> </option>
</param> </param>
<param>
<name>Whitening mask</name>
<key>whitening_mask</key>
<value>0x1001</value>
<type>int</type>
</param>
<param>
<name>Whitening seed</name>
<key>whitening_seed</key>
<value>0x1FF</value>
<type>int</type>
</param>
<param>
<name>Whitening order</name>
<key>whitening_order</key>
<value>17</value>
<type>int</type>
</param>
<sink> <sink>
<name>in</name> <name>in</name>
<type>float</type> <type>float</type>

View File

@ -2,7 +2,8 @@
/* /*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
* *
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/> * Copyright (C) 2016,2017,
* Libre Space Foundation <http://librespacefoundation.org/>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -63,12 +64,19 @@ namespace gr
* encoded payload. Prior producing the payload, AX.25 decoding * encoded payload. Prior producing the payload, AX.25 decoding
* will be performed. If set to false, the payload will be pushed * will be performed. If set to false, the payload will be pushed
* as it is. * as it is.
*
* @param whitening_mask the polynomial of the scrambler
* @param whitening_seed the initial seed of the scrambler
* @param whitening_order the size of the scrambler's LFSR
*/ */
static sptr static sptr
make (const std::vector<uint8_t> &preamble, make (const std::vector<uint8_t> &preamble,
const std::vector<uint8_t> &sync_word, bool whitening = false, const std::vector<uint8_t> &sync_word, bool whitening = false,
bool manchester = false, bool check_crc = true, bool manchester = false, bool check_crc = true,
bool ax25_format = false); bool ax25_format = false,
uint32_t whitening_mask = 0x1001,
uint32_t whitening_seed = 0x1FF,
uint32_t whitening_order = 17);
}; };
} // namespace satnogs } // namespace satnogs

View File

@ -2,7 +2,8 @@
/* /*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
* *
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/> * Copyright (C) 2016,2017,
* Libre Space Foundation <http://librespacefoundation.org/>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -38,13 +39,17 @@ namespace gr
upsat_fsk_frame_acquisition::make (const std::vector<uint8_t> &preamble, upsat_fsk_frame_acquisition::make (const std::vector<uint8_t> &preamble,
const std::vector<uint8_t> &sync_word, const std::vector<uint8_t> &sync_word,
bool whitening, bool manchester, bool whitening, bool manchester,
bool check_crc, bool check_crc, bool ax25_format,
bool ax25_format) uint32_t whitening_mask,
uint32_t whitening_seed,
uint32_t whitening_order)
{ {
return gnuradio::get_initial_sptr ( return gnuradio::get_initial_sptr (
new upsat_fsk_frame_acquisition_impl (preamble, sync_word, whitening, new upsat_fsk_frame_acquisition_impl (preamble, sync_word, whitening,
manchester, check_crc, manchester, check_crc,
ax25_format)); ax25_format, whitening_mask,
whitening_seed,
whitening_order));
} }
/* /*
@ -53,7 +58,8 @@ namespace gr
upsat_fsk_frame_acquisition_impl::upsat_fsk_frame_acquisition_impl ( upsat_fsk_frame_acquisition_impl::upsat_fsk_frame_acquisition_impl (
const std::vector<uint8_t> &preamble, const std::vector<uint8_t> &preamble,
const std::vector<uint8_t> &sync_word, bool whitening, bool manchester, const std::vector<uint8_t> &sync_word, bool whitening, bool manchester,
bool check_crc, bool ax25_format) : bool check_crc, bool ax25_format, uint32_t whitening_mask,
uint32_t whitening_seed, uint32_t whitening_order) :
gr::sync_block ("upsat_fsk_frame_acquisition", gr::sync_block ("upsat_fsk_frame_acquisition",
gr::io_signature::make (1, 1, sizeof(float)), gr::io_signature::make (1, 1, sizeof(float)),
gr::io_signature::make (0, 0, 0)), gr::io_signature::make (0, 0, 0)),
@ -77,7 +83,7 @@ namespace gr
d_decoded_bytes (0), d_decoded_bytes (0),
d_decoded_bits (0), d_decoded_bits (0),
d_frame_len (0), d_frame_len (0),
d_descrambler(0x1001, 0x1FF, 17) d_descrambler (whitening_mask, whitening_seed, whitening_order)
{ {
size_t i; size_t i;
message_port_register_out (pmt::mp ("pdu")); message_port_register_out (pmt::mp ("pdu"));
@ -256,8 +262,9 @@ namespace gr
* If we decoded bytes have length greater than the preamble and * If we decoded bytes have length greater than the preamble and
* the SYNC word, we lost the frame... * the SYNC word, we lost the frame...
*/ */
if (d_decoded_bytes > d_preamble_len if (d_decoded_bytes
- d_search_for_sync_thrhld + d_sync_word_len) { > d_preamble_len - d_search_for_sync_thrhld
+ d_sync_word_len) {
reset_state (); reset_state ();
} }
} }
@ -314,7 +321,8 @@ namespace gr
/* Skip the AX.25 header */ /* Skip the AX.25 header */
message_port_pub ( message_port_pub (
pmt::mp ("pdu"), pmt::mp ("pdu"),
pmt::make_blob (d_ax25_buf + AX25_MIN_ADDR_LEN + 2, pmt::make_blob (
d_ax25_buf + AX25_MIN_ADDR_LEN + 2,
ax25_frame_len - AX25_MIN_ADDR_LEN - 2)); ax25_frame_len - AX25_MIN_ADDR_LEN - 2));
} }
@ -327,7 +335,8 @@ namespace gr
} }
if (d_whitening) { if (d_whitening) {
d_descrambler.descramble(d_pdu+1, d_pdu+1, d_frame_len - 1); d_descrambler.descramble (d_pdu + 1, d_pdu + 1,
d_frame_len - 1);
} }
if (!d_check_crc) { if (!d_check_crc) {

View File

@ -2,7 +2,8 @@
/* /*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
* *
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/> * Copyright (C) 2016,2017
* Libre Space Foundation <http://librespacefoundation.org/>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -88,8 +89,10 @@ namespace gr
upsat_fsk_frame_acquisition_impl (const std::vector<uint8_t> &preamble, upsat_fsk_frame_acquisition_impl (const std::vector<uint8_t> &preamble,
const std::vector<uint8_t> &sync_word, const std::vector<uint8_t> &sync_word,
bool whitening, bool manchester, bool whitening, bool manchester,
bool check_crc, bool check_crc, bool ax25_format,
bool ax25_format); uint32_t whitening_mask,
uint32_t whitening_seed,
uint32_t whitening_order);
~upsat_fsk_frame_acquisition_impl (); ~upsat_fsk_frame_acquisition_impl ();
// Where all the action really happens // Where all the action really happens