Commit graph

47 commits

Author SHA1 Message Date
Thomas Kolb fd17ef3c1e Use full preamble for frequency estimation 2024-06-08 01:57:43 +02:00
Thomas Kolb 26a2558535 Add differential part to coarse frequency control 2024-06-08 01:54:42 +02:00
Thomas Kolb f6404dd0ea Move payload CRC to layer 2
Layer 1 only does decoding of the FEC, but the CRC check for data integrity is
done in layer 2 now.
2024-05-31 17:25:50 +02:00
Thomas Kolb 65daa182ef Use the new logging system everywhere 2024-05-30 10:49:43 +02:00
Thomas Kolb d6eaef91cd Switch to new logging system
The new system supports:

- time-tagging of log messages
- message priority levels with a threshold below which they are not printed
- colored output of the message priority for easy identification
- compile-time disabling of all logging per C module

So far, it is integrated in the main and rx modules which generate most
messages. Other modules will be migrated in the future.
2024-05-28 23:53:11 +02:00
Thomas Kolb 91facbf699 rx: reset internal state when restarting after a transmission 2024-05-28 19:55:21 +02:00
Thomas Kolb 33df7132ef rx: tag most debug messages with the sample index 2024-05-25 18:24:40 +02:00
Thomas Kolb 5f8346d290 agc: update squelch threshold more often
This fixes the noise level tracking in test cases like the loopback
test where the signal has already ramped up before the first noise level
update.
2024-05-25 18:16:24 +02:00
Thomas Kolb ca241f266b rx: add monotonic sample counter for debug messages 2024-05-25 18:15:23 +02:00
Thomas Kolb a42d795002 Dump debug info from the RX via jsonlogger 2024-05-07 21:40:29 +02:00
Thomas Kolb 033c26bcae preamble: invert symbols to match BPSK convention 2024-04-27 22:42:32 +02:00
Simon Ruderich a3928d0ad0 Fix compiler warnings
- passing argument 2 of 'crc_generate_key' discards ‘const’ qualifier;
  a bit ugly but signature of crc_generate_key() is wrong
- variable 'linearized_history' set but not used
- typedef is unused
- superfluous arguments to DEBUG_LOG() and fprintf()
- implicit declaration of function 'memset'
- unused arguments
2024-04-27 12:22:33 +02:00
Simon Ruderich b3ceb50b23 Fix one-byte buffer-overflow in layer1_rx_process() 2024-04-27 12:17:58 +02:00
Thomas Kolb c250944d79 transmission: fix ramp-down length calculation 2024-04-26 22:40:41 +02:00
Thomas Kolb e22b9ed4c5 rx: fix squelch level tracking
Thanks to rudi_s for reporting this.
2024-04-26 21:50:07 +02:00
Thomas Kolb d3b0ac1e0a rx: signal busy as long as squelch is open 2024-04-26 21:47:41 +02:00
Thomas Kolb 1f5f922cdf Adjust squelch level and rampup 2024-04-12 21:50:49 +02:00
Thomas Kolb 91db4e1f75 rx: implement squelch + symsync reset
Whenever the squelch opens, the symsync is reset to prevent lock-up in
that module due to noise.
2024-04-08 22:03:09 +02:00
Thomas Kolb 4b46d87edb Add missing variable declaration 2024-03-31 22:26:34 +02:00
Thomas Kolb 93fd8aebbc Lock TX to RX frequency for clients
Central nodes (“base stations”) do no longer do coarse frequency estimation,
but do only use the preamble + PLL for fine offset tracking.
2024-03-31 22:23:04 +02:00
Thomas Kolb 8441b12fbd rx: delay frequency estimation until history was fully refreshed 2024-03-30 22:10:13 +01:00
Thomas Kolb 171a4a369c rx: fix header checksum verification 2024-03-30 22:07:08 +01:00
Thomas Kolb 79d7f74dfc rx: use different PLL BW for header and data 2024-03-30 22:06:13 +01:00
Thomas Kolb 07555edfdf Add CRC8 to the header
This should prevent wrong decodings of modcod and packet length, which may disrupt decoding of directly following packets.
2024-01-07 00:02:26 +01:00
Thomas Kolb 16aa2ce92c correlator: improved phase estimation
The phase is now calculated based on the preamble correlation directly instead
of the method of the frequency estimator.
2024-01-06 23:54:41 +01:00
Thomas Kolb 84c172abc7 Fixed iterative frequency refinement; count header errors 2024-01-05 21:28:38 +01:00
Thomas Kolb 3a4be428b5 sdr: stop reading packets if the TX buffer is too full 2024-01-05 14:13:11 +01:00
Thomas Kolb e807f0617b rx: skip zero-length packets
If passed on, these cause a segmentation fault in the channel decoder. As
zero-length packets currently make no real sense in this protocol, they are
ignored now.
2024-01-05 13:49:50 +01:00
Thomas Kolb 497498acd2 rx: fix overflow in symbol buffer 2024-01-03 00:01:27 +01:00
Thomas Kolb 112a8a1215 Improved logging and soapy stream handling 2023-05-20 22:01:26 +02:00
Thomas Kolb f5a367464f Optimized one-shot frequency synchronization
- Ramp-up length increased to 128 symbols (here is room for
  improvement!)
- Try to detect the frequency once during ramp-up. To do so, every
  second symbol is inverted (to remove the +/-1 symbol toggling) and the
  phase difference between neigboring resulting symbols is checked. When
  it is low enough for all symbols, the frequency is estimated and
  corrected. When frequency estimation was done, it is not retried for a
  number of incoming symbols in order to allow the timing estimator to
  converge again.
- This approach was verified in a simulated loopback test with frequency
  offset and AWGN.
2023-05-17 22:28:18 +02:00
Thomas Kolb e42602633e freq_est: implement L&R-based symbol-independent frequency estimation
The RX chain uses this to acquire an initial estimate of the carrier frequency. The estimate is adjusted on every incoming symbol until a preamble is found.
2023-05-14 15:53:14 +02:00
Thomas Kolb d17b7b3309 RX: added some asserts 2023-05-12 13:48:18 +02:00
Thomas Kolb 886a78018f RX: write correct sample rate to debug file 2022-05-07 20:13:01 +02:00
Thomas Kolb ec99cedaf4 rx: improvements made during on-air testing
- limit frequency adjustment range
- pre-filter the baseband signal to remove out-of-band interference
- reset the frequency acquisition periodically (every 30s) if no preamble is found
2022-04-10 21:58:32 +02:00
Thomas Kolb 88145d74ba rx: added function to determine whether rx is busy 2022-03-01 21:51:41 +01:00
Thomas Kolb 9817896914 rx: make receiver more robust 2022-02-27 21:25:33 +01:00
Thomas Kolb 934b18e382 Integrate TUN device interface
Packets are now read from the TUN device and transmitted. The signal
goes through a channel emulator and is then received + decoded. If
decoding is successful, the result is written back to the TUN device
(which does not make much sense, but works for testing).

Unfortunately, there still seems to be a problem in the receiver: packet
loss is very high even at extremely high SNRs.
2022-02-27 20:21:14 +01:00
Thomas Kolb 890baf577f Moved config.h to src/ top level 2022-02-27 18:41:16 +01:00
Thomas Kolb 8a8ddc5ea3 rx: integrate AGC 2022-02-27 16:59:14 +01:00
Thomas Kolb a60b8b1f87 Moved results.h to src/ top level 2022-02-27 16:02:51 +01:00
Thomas Kolb 1787d0d351 layer1: implement per-packet modulation/coding
This allows a higher layer to adjust data rate based on the current
channel conditions. For example, the SNR could be measured and if it
becomes too low for the current modulation/code, a lower-order
modulation or stronger code could be used.
2022-02-17 21:39:18 +01:00
Thomas Kolb 0ed7109335 Clean up debug output 2022-02-16 21:46:56 +01:00
Thomas Kolb 876bafd6f9 Moved receiver to separate module 2022-02-16 20:52:46 +01:00
Thomas Kolb a5634ed736 Move the transmission chain to a separate "tx" module 2022-02-13 21:29:35 +01:00
Thomas Kolb 97772fa12b Removed unused packet_demod 2022-02-13 20:06:14 +01:00
Thomas Kolb 513a399ae4 Refactoring: moved layer1-related stuff to subdirectory 2022-02-13 20:05:47 +01:00