Thomas Kolb
576cdbfac5
Added ham64.c/.h to CMakeLists.txt
2024-07-20 22:32:01 +02:00
Thomas Kolb
77b24cf591
tests: Added variant of rx_file test for layer2 debugging
2024-07-20 22:31:13 +02:00
Thomas Kolb
38010ea672
rx-debugging: always dump symbols on packet boundaries
2024-07-20 22:30:27 +02:00
Thomas Kolb
12e727be00
packet_structs: add function to dump a packet header to the log
2024-07-20 22:29:04 +02:00
Thomas Kolb
3068db1d50
Handle retransmit timeouts
2024-07-20 01:04:03 +02:00
Thomas Kolb
fe684f7a1d
Fixed stack overflow in transmit()
2024-07-20 01:03:31 +02:00
Thomas Kolb
db2700c0f7
layer2_decode_packet_header: fixed rx_seq_nr readout
2024-07-20 01:02:42 +02:00
Thomas Kolb
bfe1cce6e3
packet_queue: wrap sequence number in packet_queue_delete()
2024-07-20 01:01:55 +02:00
Thomas Kolb
ac0fb54623
layer2_tx: fixed logging
2024-07-20 01:01:35 +02:00
Thomas Kolb
3b7d6baa74
layer2_tx: fixed packet size
2024-07-20 01:01:01 +02:00
Thomas Kolb
bcbcf5aeff
Layer 2: Added logging for retransmit handling
2024-07-20 00:26:53 +02:00
Thomas Kolb
d449e31586
logger: show module name
2024-07-20 00:04:32 +02:00
Thomas Kolb
041255e15f
layer2_tx: Fixed stack-use-after-return
2024-07-19 22:26:02 +02:00
Thomas Kolb
725a0ffd21
Ignore the squelch while receiving a packet
...
Before this commit, samples could be dropped during packet reception, which for
sure destroys the current packet and potentially the following one. Now samples
are stored even if the squelch „closes“, and decoding will potentially fail due
to high noise, but not due to missing samples.
2024-07-19 22:11:29 +02:00
Thomas Kolb
60d7fbf373
setup_tundev: limit TX queue len to 16
2024-07-19 21:59:38 +02:00
Thomas Kolb
48f061e334
Handle sequence numbers
...
This should enable basic retransmission handling.
2024-07-18 23:26:57 +02:00
Thomas Kolb
93aa429f4f
Fixed unused variable warning
2024-07-18 22:58:13 +02:00
Thomas Kolb
9bbac6ae95
Add new files to CMakeLists.txt
2024-07-18 22:57:22 +02:00
Thomas Kolb
a6464a28b8
Layer 2 received packet handling
2024-07-18 22:56:42 +02:00
Thomas Kolb
7381c7e808
Integrate new layer2 TX packet handling
2024-07-18 22:23:24 +02:00
Thomas Kolb
5adbbca786
Added functions for basic layer 2 transmission handling
2024-07-18 21:55:05 +02:00
Thomas Kolb
2348cd0c88
Implement a packet queue (incl. tests)
2024-07-11 23:23:18 +02:00
Thomas Kolb
402e36dda5
packet_structs: check data length in layer2_decode_packet_header()
2024-07-04 21:37:05 +02:00
Simon Ruderich
153ff61dcd
ham64: apply improvements suggested by rudi_s
2024-07-04 21:18:57 +02:00
Simon Ruderich
62d81fc2cc
test_ham64: check results using assertions
2024-07-04 21:16:20 +02:00
Thomas Kolb
9a151e0cbb
Rename layer2_structs -> packet_structs
2024-07-02 20:09:56 +02:00
Thomas Kolb
f17d5649fc
layer2_structs: use the new HAM-64 address structure
2024-07-01 21:25:49 +02:00
Thomas Kolb
4bb4017623
HAM-64 address format implementation
2024-07-01 21:03:43 +02:00
Thomas Kolb
546d86ffb0
Implement layer 2 header packing and unpacking
2024-07-01 21:03:43 +02:00
Thomas Kolb
27e2859090
Start defining layer2 structures
2024-07-01 21:03:43 +02:00
Thomas Kolb
090dff13d6
Tune TX back-off times
...
See comments in config.h for background info.
2024-07-01 21:02:53 +02:00
Simon Ruderich
6032cd471d
Fix compiler warnings
...
- implicit declaration of function ‘isprint’ [-Wimplicit-function-declaration]
- comparison between ‘result_t’ and ‘enum <anonymous>’ [-Wenum-compare]
2024-06-23 07:56:53 +02:00
Simon Ruderich
d54cd8a9a8
Remove unused variable debug_fd
2024-06-23 07:46:54 +02:00
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
2f2834026e
Fix size of transmitted packets
2024-06-01 16:47:10 +02:00
Thomas Kolb
de0f3620e6
Move hexdump() function to utils
2024-06-01 16:04:17 +02:00
Thomas Kolb
692780b313
setup_tundev.sh: fix shebang
2024-05-31 20:09:53 +02:00
Thomas Kolb
24bc1f8140
Fixed packet size with appended CRC
2024-05-31 18:36:16 +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
0e8e049e0a
Replace all perror() calls with LOG()
2024-05-30 11:02:08 +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
d60788b6ad
Config changes known to work with two directly connected HackRFs
2024-05-28 20:00:46 +02:00
Thomas Kolb
91facbf699
rx: reset internal state when restarting after a transmission
2024-05-28 19:55:21 +02:00
Simon Ruderich
d5aeb6c0bc
visualizer: make it optional to dup JSON to file
2024-05-28 08:59:06 +02:00
Simon Ruderich
570c379bc5
visualizer: always use === for comparisons
2024-05-28 08:51:56 +02:00
Simon Ruderich
21220deed7
visualizer: draw marker in history plot after selecting a packet
2024-05-28 08:51:56 +02:00
Simon Ruderich
7024964cae
visualizer: use multiple plots for history
2024-05-28 08:51:56 +02:00
Simon Ruderich
a2e23fceff
visualizer: limit history plot to 300 packets
...
The drawing gets slow with too many points.
2024-05-28 08:51:56 +02:00
Simon Ruderich
bc2f5ca76c
visualizer: assign id to identify packets
...
The id is displayed in the graph, the packet information and in the
trace (on mouse over).
2024-05-28 08:51:56 +02:00
Simon Ruderich
c5024a0b30
visualizer: skip redraws when they take too long
2024-05-28 08:51:56 +02:00
Simon Ruderich
c63f7e8b57
visualizer: treat -1e38 as NaN
...
I considered updating jsonlogger.c to represent NaN as "null" in the
JSON. However, this makes the hand-written JSON generator much more
complicated.
2024-05-28 08:51:56 +02:00
Simon Ruderich
53190cd17c
visualizer: don't use fixed scales
...
We might get (unexpected) input which is outside of the usual range.
2024-05-28 08:51:56 +02:00
Simon Ruderich
6fc4df205c
Add HTML/JS visualizer with plots and graphs
2024-05-28 08:51:56 +02:00
Simon Ruderich
5fb5a2908d
jsonlogger: increase pipe buffer to reduce likelihood of corrupted messages
...
Our JSON messages can get rather large which can cause a buffer overrun
when the reading program is not scheduled at the same time. When the
kernel returns EAGAIN we abort writing the current JSON message.
However, the unfinished (and thus invalid) JSON message is still in the
pipe and will be processed by the reading program.
Increase the pipe buffer from the default 65536 to reduce the likelihood
of this happening. It's difficult to completely prevent the issue as we
don't want to slow down the main program due to slow logging.
2024-05-28 08:51:56 +02:00
Simon Ruderich
657ac4faa3
test_rx_file: add JSON logging (controllable via JSONLOGGER define)
2024-05-28 08:51:56 +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
Simon Ruderich
0237ea6494
tests: fix compile
2024-05-09 18:32:51 +02:00
Simon Ruderich
a4e55f781b
Always NUL-terminate path in jsonlogger_init()
2024-05-09 18:32:26 +02:00
Simon Ruderich
f689c4ec15
Fix compiler warnings
...
- implicit declaration of built-in function 'strncpy'
- control reaches end of non-void function
- assignment to 'void (*)(int, siginfo_t *, void *)' from incompatible pointer type 'void (*)(int)'
2024-05-09 14:37:39 +02:00
Thomas Kolb
a42d795002
Dump debug info from the RX via jsonlogger
2024-05-07 21:40:29 +02:00
Thomas Kolb
5bcd3a6933
jsonlogger: add test file and improve open/close behaviour
2024-05-05 18:40:50 +02:00
Thomas Kolb
251aca7738
Basic implementation of a JSON logger module
2024-05-05 18:09:00 +02:00
Thomas Kolb
033c26bcae
preamble: invert symbols to match BPSK convention
2024-04-27 22:42:32 +02:00
Thomas Kolb
c6ea578808
sdr: fix loss of samples due to unaligned buffer reads
...
sdr_rf_to_baseband() processes samples in blocks of size SDR_OVERSAMPLING. If
the total number of samples does not align with this block size, the leftover
samples are lost and phase and timing glitches result.
To mitigate this, sdr_receive() now has an additional parameter that specifies
the alignment of the returned data. The number of samples returned is always a
multiple of this alignment factor. This feature is used to ensure that the
number of returned samples is a multiple of SDR_OVERSAMPLING and therefore no
samples are lost in sdr_rf_to_baseband().
sdr_rf_to_baseband() now has an additional check that makes the function fail
if the alignment is incorrect.
2024-04-27 20:08:04 +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
90ed7dc0a8
Re-add accidentally removed constants
2024-04-20 01:31:21 +02:00
Simon Ruderich
2768e21849
test_rx_file: set nco frequency
2024-04-20 01:14:17 +02:00
Simon Ruderich
79fc1c4f59
utils: fix numpy deprecation warnings
2024-04-20 01:14:17 +02:00
Thomas Kolb
7d1a927425
Calculate HackRF center frequency correctly
2024-04-20 01:07:21 +02:00
Thomas Kolb
32632914df
Prevent TX exception in QPSK mode
...
QPSK-modulated packets require more samples, which must be available in the TX
buffer. Therefore we increase the required free space.
2024-04-20 01:04:13 +02:00
Thomas Kolb
11f19c03a0
Fix TX handling for multiple packets
...
- (only) time-based end-of-transmission tracking
- removed tx_done flag
- count zero-buffers correctly in time-tracking
- add 10 ms of headroom so the transmission does not stop before buffer was
completely transmitted (race condition)
- fix race condition with tx_start_time in sdr_start_tx()
- simplified packet queuing (no chunking)
- read multiple packets before starting transmission (to fill buffers initially)
Thanks to rudi_s!
2024-04-20 00:55:39 +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
4f4128fbd3
test: fixed build errors
2024-03-31 18:01:00 +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
bbf7bcf2f0
test/freq_est: add channel simulation
2024-03-30 22:05:02 +01:00
Thomas Kolb
66c88bf889
Improvements to debug scripts
2024-03-30 22:04:26 +01:00
Thomas Kolb
d9707ac4a9
test: add test_rx_file
2024-03-30 21:56:00 +01:00
Thomas Kolb
dd5712eada
Add options parsing module
2024-03-30 21:51:27 +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
ef25ca2388
Enable Hamming 8/4 code for the header
2024-01-05 21:29: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
a6f12d876b
sdr: fixed RX sample data conversion
2024-01-05 13:48:41 +01:00
Thomas Kolb
be5fa06950
Handle SIGTERM and SIGINT for graceful shutdown
2024-01-03 22:03:19 +01:00
Thomas Kolb
ee63483b8f
sdr: scale sample for HackRF API
2024-01-03 17:41:35 +01:00