2853 Commits

Author SHA1 Message Date
Michael Ossmann
f4202d1163 hackrf_transfer: Don't skip preload stats in RX
Fixes a bug introduced in 8a9af7a: Statistics skipped for initial
buffers not only when preloaded in TX mode but also in RX mode with no
preloading.

The total bytes transferred may appear inflated in RX mode when
receiving a small number of samples with -n, but the stats represent
data transferred over USB, some of which may have been discarded by the
host.
2022-09-18 13:27:51 -04:00
Michael Ossmann
82ecfce414 hackrf_transfer: simplify hardware sync mode logic
The -H option now requires no argument.
2022-09-18 05:49:03 -04:00
Michael Ossmann
22635bf07d libhackrf: update hackrf_transfer struct comment 2022-09-18 05:13:25 -04:00
Michael Ossmann
9181cbe049 hackrf_transfer: send signal to own PID
Instead of sending a signal to the process group, get our own process ID
and send the signal to it. This fixes a bug that prevented termination
when called from a script.
2022-09-18 05:07:09 -04:00
Michael Ossmann
ca5049fcd3 Merge pull request #1156 from martinling/tx-transfer-sizing
Fix handling of the final <256KiB of data transmitted with `hackrf_transfer`
2022-09-18 04:31:47 -04:00
Martin Ling
6ab17209d7 Disable flush when cancelling transfers. 2022-09-16 15:55:20 +01:00
Martin Ling
55fdddd81e Merge remote-tracking branch 'origin/master' into tx-transfer-sizing 2022-09-15 15:32:20 +01:00
Martin Ling
1b166a5b05 Pad the last data in a transmission to the next 512 byte boundary. 2022-09-15 15:27:53 +01:00
Martin Ling
69823397b1 Submit flush transfer as soon as end of data is reached. 2022-09-15 15:12:41 +01:00
Michael Ossmann
2b1aa545f8 Merge pull request #1157 from martinling/standardise-dbfs
Standardise dBFS level
2022-09-15 04:59:45 -04:00
Martin Ling
09c6030ec9 Start TX/RX in hackrf_transfer after all other requests.
This avoids glitches and lost samples at the start of a transmission.
2022-09-15 09:51:11 +01:00
Danylo Ulianych
a2c30a8896 Update firmware/README
Co-authored-by: Martin Ling <martin-github@earth.li>
2022-09-15 07:39:48 +03:00
Michael Ossmann
75e3137d55 Merge pull request #1155 from greatscottgadgets/platform-detect
Detect hardware platform at run-time.
2022-09-14 17:45:58 -04:00
Michael Ossmann
4f779aae7a Merge pull request #1154 from greatscottgadgets/clkout-source
firmware: use consistent clock source
2022-09-14 17:43:28 -04:00
Martin Ling
f1e34b7cea Correct the calculation of dBfs signal level.
dBFS is defined in AES Standard AES17-1998, IEC 61606, and ITU-T Recs.
P.381 and P.382, such that the RMS value of a full-scale sine wave is
designated 0 dBFS.

A full scale sine wave on HackRF has the range -127 to 127.

We calculate the full scale ratio relative to a signal in which both I
and Q are held at 127. This represents a signal with sqrt(2) times
the amplitude, and thus twice the power, of a full scale sine wave.

Therefore to obtain dBfs by the above definition, we add 3dB.
2022-09-14 18:21:07 +01:00
Martin Ling
66fa76c550 In CW mode, set only the I component to the specified amplitude. 2022-09-14 18:14:59 +01:00
Martin Ling
d5d2b09fe8 Restrict CW mode amplitude to 127. 2022-09-14 18:14:23 +01:00
Martin Ling
f2d00adab8 Add commentary to TX callback. 2022-09-14 15:55:07 +01:00
Martin Ling
e38534b99d Don't return -1 from the TX callback that provides the last data. 2022-09-14 15:55:07 +01:00
Martin Ling
5ad08cfd96 Set valid_length correctly in hackrf_transfer TX callback. 2022-09-14 15:55:04 +01:00
Martin Ling
22846b5682 Make libhackrf honour the valid_length set by TX callback. 2022-09-14 15:48:34 +01:00
Martin Ling
9905e960a4 Rearrange to avoid duplicating sample limit return path. 2022-09-14 15:16:18 +01:00
Martin Ling
16f93d9b27 Move duplicated code to one place. 2022-09-14 15:15:34 +01:00
Martin Ling
29787cd291 Clarify variables used in TX callback.
The power measurement depends on the number of bytes that were valid
from the previous use of the transfer buffer.

The number of bytes to be read to fill the next transfer, is the full
size of the buffer.
2022-09-14 15:10:13 +01:00
Michael Ossmann
9329c5e44e Detect hardware platform at run-time.
Firmware now detects the hardware it is running on at startup and
refuses to run if it is compiled for the wrong platform. The board ID
returned by firmware to the host is now derived from run-time detection
rather than a compile-time value. A separate method to retrieve
compile-time supported platform is added.

On HackRF One, pin straps are checked to determine hardware revision.
This is informational to aid troubleshooting and does not affect any
function.
2022-09-14 07:08:47 -04:00
Michael Ossmann
fdfe310f9a Merge pull request #1139 from martinling/tx-flush
Support flushing the device TX buffer before ending transmission
2022-09-14 05:45:40 -04:00
Martin Ling
7650236839 Flush buffer when CW mode is used with -n. 2022-09-12 16:50:53 +01:00
Martin Ling
0142ae6da9 Don't await buffer flush if interrupted by Ctrl-C. 2022-09-12 16:32:11 +01:00
Michael Ossmann
2104291594 firmware: use consistent clock source
CLKOUT now switches to the active clock source whenever the internal
clocks change source. It previously did so only when (re)enabled.
2022-09-10 06:54:51 -04:00
Michael Ossmann
57d51fd042 Merge pull request #1153 from greatscottgadgets/measure-power
Measure digital signal power, not amplitude in hackrf_transfer
2022-09-09 20:11:08 -04:00
Michael Ossmann
8a9af7a1ad hackrf_transfer: report on only actual transfers
The statistics reported to the user now reflect only completed USB
transfers and do not include information about the empty buffers that
are preloaded with data at the start of a TX operation.
2022-09-09 16:32:07 -04:00
Michael Ossmann
70a04855ac libhackrf: add transfer buffer size access calls
Applications may need to learn the size of the USB transfer buffer
queue, for example to determine how many bytes will be preloaded with
calls to the TX callback.
2022-09-09 16:16:24 -04:00
Michael Ossmann
c1e65778bc Merge pull request #1149 from grvvy/operacake_time_mode_fix
operacake: disable the usage of time mode when a portapack is installed
2022-09-09 12:46:45 -04:00
Michael Ossmann
e7b19ef2c2 hackrf_transfer: accept CW amplitude up to 128 2022-09-09 05:17:28 -04:00
Michael Ossmann
755ca960e5 hackrf_transfer: report power, not amplitude
improve accuracy and reliability of digital signal power measurement
2022-09-09 05:15:15 -04:00
Michael Ossmann
5b4be3e078 Merge pull request #1138 from martinling/preload-tx-transfers
Preload TX transfers
2022-09-05 11:41:05 -04:00
Michael Ossmann
ad5398d92c Merge pull request #1132 from martinling/hackrf-transfer-short-files
Support repeating short files in `hackrf_transfer`
2022-09-05 10:37:29 -04:00
grvvy
5d7b203058 operacake: disable the usage of time mode when a portapack is installed 2022-09-01 14:03:18 -06:00
Straithe
e41b4c5116 change checkboxes to text area for OS technical support question (#1148) 2022-08-28 19:55:50 -04:00
Straithe
0a85acf27a Add quotes to yes and no (#1147) 2022-08-28 19:18:44 -04:00
Straithe
783899b06f address hash issues in technical support issue template (#1146) 2022-08-28 19:06:46 -04:00
Straithe
e0b6978634 fix technical support template (#1145) 2022-08-28 18:47:13 -04:00
Straithe
e5e1507b4f remove yaml errors (#1144) 2022-08-28 18:29:48 -04:00
Straithe
a2ff44f0fd converted issue templates to .yml instead of .md (#1143) 2022-08-28 18:07:52 -04:00
Straithe
6e38a68234 Add issue templates (#1122)
* Add issue templates

* Update templates based on feedback

* Update feature request issue template

* update templates based on suggestions
2022-08-28 17:45:09 -04:00
Martin Ling
8f60e6b66f Wait for TX buffer flush at end of hackrf_transfer. 2022-08-24 23:48:24 +01:00
Martin Ling
d556f0abab Add API to support flushing the device buffer when TX finishes. 2022-08-24 23:48:22 +01:00
Martin Ling
9d2e163a2d Call TX callback to fill transfers before initial submission. 2022-08-23 13:21:43 +01:00
Martin Ling
8bd8dedddc Use an early return to reduce indentation in prepare_transfers. 2022-08-23 13:03:53 +01:00
Martin Ling
5881b3b6a1 Add defines for TX and RX endpoint addresses. 2022-08-23 12:24:00 +01:00