GnuRadio и все все все
Блог о ЦОС. И не только.
Обзор HackRf One: Часть 2 Настройка софта
Мы подключили HackRf к ноутбуку, и увидели что он определяется корректно. Настала пора разобраться с программной частью. Для начала нам нужно установить ПО для HackRf. К счастью все необходимое ПО уже имеется в репозитории Ubuntu. Посмотрим что там есть.
igor@ghost64:
$ apt-cache search hackrf
gqrx-sdr — Software defined radio receiver
hackrf — Software defined radio peripheral
libhackrf-dev — Software defined radio peripheral
libhackrf0 — Software defined radio peripheral
gqrx — Software defined radio receiver
gr-osmosdr — Gnuradio blocks from the OsmoSDR project
Давай разберемся кто есть кто.
hackrf — утилиты для взаимодействия с приемником
libhackrf0 — библиотека для поддержки управления HackRf сторонними приложениями
libhackrf-dev — пакет содержащий заголовочные файлы, и прочие вещи, необходимые нам, если мы сами захотим скомпилировать какую-нибудь программу с поддержкой HackRf
Нам потребуется это все. Устанавливаем ПО командой:
$ sudo apt-get install hackrf libhackrf0 libhackrf-dev
Посмотрим что за утилиты мы установили. Пакет hackrf содержит следующие программы:
hackrf_info — вывод информации о устройстве.
hackrf_spiflash — программа для обновления прошивки в контроллере
hackrf_cpldjtag — программа для обновления прошивки в CLPD микросхеме.
hackrf_transfer — многофункциональная программа для передачи/приема данных
hackrf_max2837, hackrf_rffc5071, hackrf_si5351c — насколько я понял, данные программы служат для модификаций значений регистров в микросхемах. Возможно они нужны для разработиков прошивок в отладочных целях.
Запустим уже что-нибудь? Что попроще, к примеру hackrf_info
$ hackrf_info
Found HackRF board.
Board ID Number: 2 (HackRF One)
Firmware Version: 2014.08.1
Part ID Number: 0x00584f5e 0x00584f5e
Serial Number: 0x00000000 0x00000000 0x15d463dc 0x186ca825
Вся информация о оборудовании как на ладони. Наиболее полезное тут для нас это Firmware Version. Сейчас в HackRf прошита самая последняя версия 2014.08.1. Проверять наличие новых прошивок нужно тут http://sourceforge.net/projects/hackrf/files/
Если в результате запуска команды вы получили ошибку:
hackrf_open() failed: HACKRF_ERROR_NOT_FOUND (-5)
то причины могут быть в следующем:
1. Отсутствие прав доступа к USB устройствам у текущего пользователя.
Проверить это можно запустив утилиту hackrf_info от имени root пользователя. Если от имени рута программа успешно считывает информацию с HackRf, а от пользователя не хочет, то значит проблема с правами. Исправить это можно, написав правило для udev
Создайте файл /etc/udev/rules.d/52-hackrf.rules , и впишите в него следующие правила:
ATTR
, MODE=»660″, GROUP=»plugdev»
ATTR
«660», GROUP=»plugdev»
ATTR
«660», GROUP=»plugdev»
Сохраните файл, и либо перезагрузите компьютер, либо перезапустите демон udev командой udevadm control —reload-rules . Как вы уже догадались, этими тремя правилами мы задаем для устройств с определенными VendorID и ProductID права доступа 660, и доступ членам группы plugdev.
2. Другая причина — устаревшая версия программ и библиотек для HackRf
HackRf One поддерживается ПО версии 2014.04.1 и новее. Может получиться так, что в репозитории окажется старая версия ПО. Проверить версию установленного ПО в Debian/Ubuntu можно при помощи команды apt-cache show hackrf
Вот небольшая иллюстрация.
Ноут с Ubuntu 14.04 LTS
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION=»Ubuntu 14.04.2 LTS»
В репозитории — устаревший софт.
$ apt-cache show hackrf
Package: hackrf
Priority: extra
Section: universe/libs
Installed-Size: 120
Maintainer: Ubuntu Developers
Original-Maintainer: A. Maitland Bottoms
Architecture: i386
Version: 2013.07.1.16.d5cebd-2 — с этой версией жизни нет!
Depends: libhackrf0 (= 2013.07.1.16.d5cebd-2), libc6 (>= 2.7)
Filename: pool/universe/h/hackrf/hackrf_2013.07.1.16.d5cebd-2_i386.deb
Size: 29708
MD5sum: e4e8542460419a3c0e577dbd6f26ffe9
SHA1: 777ef6d304f2c5606d755291dc123c7c800ab42e
SHA256: 3200d2819cf3f67614f3dd1d2b81fe7adb5443be89e577d0499ae464ab931b21
А вот другой ноут с относительно свежей системой
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.10
DISTRIB_CODENAME=utopic
DISTRIB_DESCRIPTION=»Ubuntu 14.10″
$ apt-cache show hackrf
Package: hackrf
Priority: extra
Section: universe/libs
Installed-Size: 124
Maintainer: Ubuntu Developers
Original-Maintainer: A. Maitland Bottoms
Architecture: i386
Version: 2014.04.1-2 — тут в репозитории свежая версия.
Depends: libhackrf0 (= 2014.04.1-2), libc6 (>= 2.7)
Filename: pool/universe/h/hackrf/hackrf_2014.04.1-2_i386.deb
Size: 26718
MD5sum: 2658d15c2d09328049850cc41fb4e643
Выхода из этой ситуации два: либо ждать когда обновят софт в репозитории (ждать этого можно вечно ) или собрать свежий софт самому.
Собираем его так:
1. Ставим нужный для сборки софт
sudo apt-get install build-essential cmake libusb-1.0-0-dev
2. Удаляем неактуальный софт.
sudo apt-get remove hackrf libhackrf-dev libhackrf0
3. Получаем свежие версии исходников:
git clone https://github.com/mossmann/hackrf.git
4. Идем в папку host
cd hackrf/host/
5. Выполняем следующие команды
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
6. Теперь попытаемся выполнить команду hackrf_info (если у вас на эту команду bash выругался что-то вроде «команда не найдена», то просто откройте новое терминальное окно, и выполните в нем)
$ hackrf_info
Found HackRF board.
Board ID Number: 2 (HackRF One)
Firmware Version: 2014.08.1
Part ID Number: 0xa000cb3c 0x00584f5e
Serial Number: 0x00000000 0x00000000 0x15d463dc 0x186ca825
Ура! Работает!
Итак, софт мы поставили, и оборудование успешно определяется. Настала пора попробовать использовать HackRf как источник сигнала в GnuRadio.
Поддержку HackRf в GnuRadio обеспечивает OsmoSDR source (тот самый, что используется для работы с RTL донглами). Даже если у вас он уже был установлен ранее, то его надо будет пересобрать для поддержки HackRF. Сборка выполняется по инструкции из этой статьи . При сборке следует обратить внимание на вывод команды cmake. В ней он указывает какие компоненты он обнаружил и активировал. Запись о HackRF должна присутствовать в разделе «gr-osmosdr enabled components»
— ######################################################
— # gr-osmosdr enabled components
— ######################################################
— * Python support
— * FUNcube Dongle
— * IQ File Source
— * Osmocom RTLSDR
— * RTLSDR TCP Client
— * HackRF Jawbreaker
— * RFSPACE Receivers
После пересборки/установки OsmoSDR можно попробовать проверить работу HackRF с GnuRadio послушав FM станции с помощью графа приемника fm_radio_rx.grc Не забудьте поменять в этом графе частоту семплирования с 5 миллионов, до 8 (минимально поддерживаемую HackRF)
Вот как-то так оно работает. Не следует удивляться уровню сигнала, так как это принималось все квартире на антенну от Baofeng.
Hack rf one windows
mossmann released this Mar 20, 2021
To upgrade to this release, you must update libhackrf and hackrf-tools on your host computer. You must also update firmware on your HackRF.
Major changes in this release include:
- CPLD bitstreams are now included in and loaded automatically by the firmware. There is no longer a need to update the CPLD separately.
- The clock output (CLKOUT) is now turned off by default.
- A new utility, hackrf_clock, provides a way to inspect and modify configuration of hardware clocks, including turning on and off CLKOUT.
- The rad1o badge is now supported by firmware in this release. Firmware from the HackRF release/repository is different than the original CCCamp firmware and only supports operation as a USB SDR peripheral.
- When using a HackRF One with a PortaPack in «HackRF Mode» (operating as a USB peripheral), the PortaPack display now indicates operational status and settings.
There have been many more enhancements and bug fixes. For a full list of changes, see the git log.
Thanks to Jared Boone, Dominic Spill, schneider, and Mike Walters for major contributions to this release!
mossmann released this Jan 29, 2018
HackRF 2018.01.1 Release Notes
This is a firmware maintenance release that improves reliability of HackRF One when booting from the DFU bootloader. If you do not frequently use DFU boot, there is no reason to upgrade to this release.
mossmann released this Feb 11, 2017
HackRF 2017.02.1 Release Notes
To upgrade to this release, you must update libhackrf and hackrf-tools on your host computer. You must also update firmware on your HackRF. It is important to update both the host code and firmware for this release to work properly. If you only update one or the other, you may experience unpredictable behavior.
Major changes in this release include:
- Sweep mode: A new firmware function enables wideband spectrum monitoring by rapidly retuning the radio without requiring individual tuning requests from the host computer. The new hackrf_sweep utility demonstrates this function, allowing you to collect spectrum measurements at a sweep rate of 8 GHz per second. Thanks to Mike Walters, author of inspectrum, for getting this feature working!
- Hardware synchronization: It is now possible to wire the expansion headers of two or more HackRF Ones together so that they start sampling at the same time. This is advantageous during phase coherent operation with clock synchronized HackRFs. See the -H option of hackrf_transfer. Thank you, Mike Davis!
- A new utility, hackrf_debug, replaces three older debug utilities, hackrf_si5351c, hackrf_max2837, and hackrf_rffc5071.
- Power consumption has been reduced by turning off some microcontroller features we weren’t using.
There have been many more enhancements and bug fixes. For a full list of changes, see the git log.
Special thanks to Dominic Spill who has taken over much of the software development effort and has helped with nearly every improvement since the previous release!
HackRF Sweep Spectrum Analyzer for Windows
A few weeks ago the HackRF drivers and firmware were updated and one new feature added was hackrf_sweep. This new feature allows us to scan across the spectrum at up to 8 GHz per second, which means that a full 0 – 6 GHz scan can complete in under a second.
Previously only Linux software such as QSpectrumAnalyzer was compatible with hackrf_sweep, but now over on GitHub user pavsa has released a new Windows based Spectrum Analzyer which is compatible with hackrf_sweep.
We gave the software a test and it ran flawlessly with our HackRF. The features include:
- Optimized for only one purpose – to use HackRF as a spectrum analyzer
- All changes in settings restart hackrf_sweep automatically
- Easy retuning
- hackrf_sweep integrated as a shared library
- Peak display
- High resolution waterfall plot
Remember that to run the software you will need to have updated your HackRF to the latest firmware. The spectrum analyzer software is also Java based, so you’ll need to have the Java JRE for Windows x64 installed.
Related posts:
21 comments
Hi all, need some help. I’m using POPOS and I have managed to install this software. But my waterfall has no resolution or actually looks scrambled. Can someone tell me why this is happening? Here’s a example of what it looks like. https://i.postimg.cc/8z0PTmgP/spectrum.jpg
I am trying to setup this app before I get my HACKrf ONE device (replacing my RTL-SDR dongle). I have…
Downloaded & unzipped the app file
Added Java x64
I do NOT add the HACKrf under Zadig as I don’t have the hardware yet.
when I run “hackrf_sweep_spectrum_analyzer_windows.cmd” from Windows 10 CMD window it says it does “‘hackrf_sweep_spectrum_analyzer_windows.cmd’ is not recognized as an internal or external command,
operable program or batch file.”, Will the install not run until I do the ZADIG step or have I missed some obvious step to getting HACKrf Sweep Analyzer to run?
Were you able to solve this problem? I have the same problem.
Monitoring 2.4G wifi area, putting a phone (playing youtube video) next to antenna makes no difference, although so close to antenna signal should be MUCH stronger than any other far away device.
Should the Y scale be logarithmic so its easier to see close by devices using the band?
I you try to find a “jammer” etc. the spectrum is just not visual enough to help. Close or far away, looks just random.
Will the ADALM PLUTO be supported in the future?
It seems it’s also a great tool.
Nice piece of software! One question — Is there a way to save the current settings so the next time I start the analyzer it knows what bandwidth, sample rate etc… to use?
Sorry I forgot…. will be also very nice to have Frequency reading, on the vertical cursor, at least with a 1 khz resolution (as Mhz98,236). This will help a lot to measure the deviation on the FM signal or to measure the bandwidth occupation od a signal. Thanks again for you job.
The Spectrum Analyze Software is excellent, I test it on Windows 10, thanks for let we use it. I’m a professional Spectrum Analyser user and I love the products. Very usefull the Spur Filter.
The Amplitude scale of 130 dB of dinamic need to be “settable” from user.
Also a Frequency span less than 1 Mhz will be much appreciated.
I do not understand how to change the Waterfall speed.
Any possibility to decode and recorder the spectrum selected ?
many thanks again.
alberto
Is there any description available to upgrade the firmware so that the spectrum analyzer software can work with windows
qspecrumamalyzer does not work with kackrf_sweep and Win 10 – 64bit. Crashes already at the start !! What to do??
is there a possibility to implement a “peak hold” option? I find it very useful to sweep 2.4 and 5 Ghz wifi band to detect analog jammers.
You could use qspectrumanalyzer if you need the peak
https://www.rtl-sdr.com/qspectrumanalyzer-updated-to-version-1-4-0/
It also uses hackrf_sweep
I would also urgently need a peack-hold feature. Is it possible to install the software under Win 10- 32 Bit?
Has anyone tested it with a decent RF signal generator for how accurate the amplitude measurements are? How about the resolution bandwidth…how narrow a signal can it resolve?
Is there an equivalent solution for MacOS?
Doesn’t work – tried it on a Win 7 and Win 8.1 computer. Asks for Java 8 every time I try to start it, however I already have Java 8 installed.
Disregard – I got it working – have to install 64-bit Java
Pretty cool. Thanks for the port!
can hackrf sweep be compatible with airspy ?
If someone writes patches to the Airspy firmware (and library and tools) to add new functionality similar to the code changes to hackrf firmware (and library and host tools) which “enables a new firmware function – wideband spectrum monitoring by rapidly retuning the radio without requiring individual tuning requests from the host computer” ?
The firmware and host tools for both devices are fully open source so, at least in theory, it is possible if someone wanted to do it, they could write new code. On paper the change sounds really simple (we all know it never is), chop out the USB delays, retune in the firmware in a repetitive loop.
Post a comment Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.