### FM Radio Receiver Example Source: https://github.com/greatscottgadgets/hackrf/wiki/Getting-Started-with-HackRF-and-GNU-Radio This Python script, when run with the provided GNU Radio Companion file, sets up an FM radio receiver. Ensure you have the necessary Python file and GNU Radio Companion installed. ```bash $ python ./fm_radio_rx.py ``` ```python import os import sys import signal import math from gnuradio import analog from gnuradio import blocks from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from gnuradio.wxgui import consts from gnuradio.wxgui import stdpenmetrics, colors from gnuradio.wxgui.controls import { ColorScale, ColorScaleWidget, EnumParameter, FloatingParameter, KeySink, LogParameter, Parameter, RadioParameter, ScalarType, Slider, ToggleButton, } from 'gnuradio.wxgui.controls' from gnuradio.wxgui.forms import { BlackBox, CheckBox, ComboBox, EditBox, FormBox, Label, RadioBox, RTLColorScale, Scale, ScrolledPanel, StaticBox, TextBox, } from 'gnuradio.wxgui.forms' from gnuradio.wxgui.std_grid import std_grid from gnuradio.wxgui.std_grid import std_grid from gnuradio.wxgui.window import: subwindow from datetime import datetime def main(top_block_cls=fm_radio_rx, options=None): if gr.enable_realtime_scheduling() != gr.RT_OK: print('Error: failed to enable realtime scheduling.') if yeardata.has_key('options'): extra_options = yeardata['options'] for key in extra_options: if yeardata.has_key(key): yeardata[key].update(extra_options[key]) else: yeardata[key] = extra_options[key] parser = OptionParser() (options, args) = parser.parse_args() tb = top_block_cls() tb.Start(False) tb.Wait() if __name__ == '__main__': main() ``` -------------------------------- ### Install OpenOCD with ST-LINK Support Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-Debugging Steps to clone, configure, and install OpenOCD with support for ST-LINK, buspirate, and jlink. This process requires root privileges for installation. ```bash # Cloned at hash a21affa42906f55311ec047782a427fcbcb98994 git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd cd openocd ./bootstrap ./configure --enable-stlink --enable-buspirate --enable-jlink --enable-maintainer-mode make sudo make install ``` -------------------------------- ### Install FFTW DLLs on Windows Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/hackrf-tools/src/CMakeLists.txt On Windows, this command installs FFTW DLL files from the build directory to the installation binary directory. ```cmake if(WIN32) install( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$/") DESTINATION ${CMAKE_INSTALL_BINDIR} FILES_MATCHING PATTERN "fftw*.dll") endif() ``` -------------------------------- ### Install HackRF Dependencies on Windows using vcpkg Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install necessary library dependencies for building HackRF on Windows using vcpkg. Ensure vcpkg is bootstrapped before installing packages. ```win-batch git clone https://github.com/microsoft/vcpkg cd vcpkg bootstrap-vcpkg.bat vcpkg install libusb fftw3 pthreads pkgconf ``` -------------------------------- ### Install dfu-util on Debian/Ubuntu Source: https://github.com/greatscottgadgets/hackrf/wiki/Updating-Firmware Use this command to install dfu-util from the package manager on Debian-based systems. ```bash sudo apt-get install dfu-util ``` -------------------------------- ### Install Linux Prerequisites Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/README.md Installs essential build tools and libraries for compiling the HackRF host software on Debian/Ubuntu-based systems. ```bash sudo apt-get install build-essential cmake libusb-1.0-0-dev pkg-config libfftw3-dev ``` -------------------------------- ### Build and Install HackRF with Cygwin Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Build and install the HackRF tools using Make after configuring the build for Cygwin. ```bash make make install ``` -------------------------------- ### Install HackRF on Gentoo Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install HackRF tools on Gentoo using the emerge package manager. ```bash emerge -a net-wireless/hackrf-tools ``` -------------------------------- ### Install HackRF Tools on Ubuntu/Debian Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Use apt to install the gqrx-sdr package on Ubuntu or Debian-based systems. ```bash sudo apt install gqrx-sdr ``` -------------------------------- ### Install HackRF Package on FreeBSD Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Install the hackrf package using pkg on FreeBSD. ```bash # pkg install hackrf ``` -------------------------------- ### Build and Install HackRF Tools Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/hackrf-tools/src/CMakeLists.txt This loop iterates through the defined tools, creates an executable for each, sets the C standard to C90, links the necessary libraries, and installs the executable to the binary directory. ```cmake foreach(tool ${TOOLS}) add_executable(${tool} ${tool}.c) target_compile_features(${tool} PRIVATE c_std_90) target_link_libraries(${tool} ${TOOLS_LINK_LIBS}) install(TARGETS ${tool} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach(tool) ``` -------------------------------- ### Build dfu-util from Source Source: https://github.com/greatscottgadgets/hackrf/wiki/Updating-Firmware Follow these steps to build dfu-util from source if a package is not available. Ensure you have build dependencies installed. ```bash cd ~ sudo apt-get build-dep dfu-util sudo apt-get install libusb-1.0-0-dev git clone git://git.code.sf.net/p/dfu-util/dfu-util cd dfu-util ./autogen.sh ./configure make sudo make install ``` -------------------------------- ### Setup, Initialization and Shutdown Source: https://github.com/greatscottgadgets/hackrf/wiki/libHackRF-API Functions for initializing, opening, listing, and closing HackRF devices, as well as shutting down the libHackRF library. ```APIDOC ## HackRF Init ### Description Initialize libHackRF, including global libUSB context to support multiple HackRF hardware devices. ### Syntax `int hackrf_init()` ### Returns: A value from the hackrf_error constants listed below. ``` ```APIDOC ## HackRF Open ### Description Opens a HackRF device. ### Syntax `int hackrf_open(hackrf_device** device)` ### Returns: A value from the hackrf_error constants listed below. ``` ```APIDOC ## HackRF Device List ### Description Retrieve a list of HackRF devices attached to the system. This function finds all devices, regardless of permissions or availability of the hardware. ### Syntax `hackrf_device_list_t* hackrf_device_list()` ### Returns: A pointer to a hackrf_device_list_t struct, a list of HackRF devices attached to the system. The contents of the hackrf_device_list_t struct are decribed in the data structures section below. ``` ```APIDOC ## HackRF Device List Open ### Description Open and acquire a handle on a device from the hackrf_device_list_t struct. ### Syntax `int hackrf_device_list_open(hackrf_device_list_t* list, int idx, hackrf_device** device)` ### Parameters: #### Path Parameters - **list** (hackrf_device_list_t*) - A pointer to a hackrf_device_list_t returned by `hackrf_device_list()` - **idx** (int) - The list index of the HackRF device to open - **device** (hackrf_device**) - Output location for hackrf_device pointer. Only valid when return value is HACKRF_SUCCESS. ### Returns: A value from the hackrf_error constants listed below. ``` ```APIDOC ## HackRF Device List Free ### Description Frees the memory associated with a hackrf_device_list_t struct. ### Syntax `void hackrf_device_list_free(hackrf_device_list_t* list)` ### Parameters: #### Path Parameters - **list** (hackrf_device_list_t*) - A pointer to a hackrf_device_list_t returned by `hackrf_device_list()` ``` ```APIDOC ## HackRF Open By Serial ### Description Opens a HackRF device using its serial number. ### Syntax `int hackrf_open_by_serial(const char* const desired_serial_number, hackrf_device** device)` ### Parameters: #### Path Parameters - **desired_serial_number** (const char* const) - The serial number of the HackRF device to open. - **device** (hackrf_device**) - Output location for hackrf_device pointer. Only valid when return value is HACKRF_SUCCESS. ### Returns: A value from the hackrf_error constants listed below. ``` ```APIDOC ## HackRF Close ### Description Closes the connection to a HackRF device. ### Syntax `int hackrf_close(hackrf_device* device)` ### Parameters: #### Path Parameters - **device** (hackrf_device*) - A pointer to the hackrf_device struct representing the device to close. ### Returns: A value from the hackrf_error constants listed below. ``` ```APIDOC ## HackRF Exit ### Description Cleanly shutdown libHackRF and the underlying USB context. This does not stop in progress transfers or close the HackRF hardware. `hackrf_close()` should be called before this to cleanly close the connection to the hardware. ### Syntax `int hackrf_exit()` ### Returns: A value from the hackrf_error constants listed below. ``` -------------------------------- ### Install HackRF on Ubuntu/Debian Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install HackRF on Ubuntu or Debian based systems using apt-get. ```bash sudo apt-get install hackrf ``` -------------------------------- ### Install HackRF Udev Rules Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/libhackrf/CMakeLists.txt When on Linux and udev rules installation is enabled, this block attempts to find a suitable group for the rules, configures the rules file, and installs it. It provides messages indicating the installation status or reasons for skipping. ```cmake if(SYSTEM_IS_LINUX) if(INSTALL_UDEV_RULES) if(NOT DEFINED UDEV_RULES_GROUP) foreach(group usb plugdev) execute_process( COMMAND "getent" group "${group}" RESULT_VARIABLE _GETENT_RESULT OUTPUT_QUIET ERROR_QUIET) if(NOT _GETENT_RESULT) message(STATUS "Setting udev rule group to - ${group}") set(UDEV_RULES_GROUP ${group}) break() endif(NOT _GETENT_RESULT) endforeach(group) endif(NOT DEFINED UDEV_RULES_GROUP) if(DEFINED UDEV_RULES_GROUP) set(HACKRF_GROUP "${UDEV_RULES_GROUP}" CACHE STRING "Group to associate HackRF devices with in udev rules") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/53-hackrf.rules.in ${CMAKE_CURRENT_BINARY_DIR}/53-hackrf.rules @ONLY) message( STATUS "HackRF udev rules will be installed to '${UDEV_RULES_PATH}'") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/53-hackrf.rules DESTINATION ${UDEV_RULES_PATH} COMPONENT "udev_rules") else(UDEV_RULES_GROUP) message( STATUS "HackRF udev rules will not be installed because no group was found") message(STATUS "A group can be specified with -DUDEV_RULES_GROUP=") endif(DEFINED UDEV_RULES_GROUP) else(INSTALL_UDEV_RULES) message( STATUS "HackRF udev rules will not be installed because INSTALL_UDEV_RULES=OFF" ) endif(INSTALL_UDEV_RULES) else(SYSTEM_IS_LINUX) if(INSTALL_UDEV_RULES) message(STATUS "udev rules not supported on this platform.") message(STATUS "Hide this message via -DINSTALL_UDEV_RULES=Off") endif(INSTALL_UDEV_RULES) endif(SYSTEM_IS_LINUX) ``` -------------------------------- ### Install gr-osmosdr using Homebrew Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Install the gr-osmosdr package using Homebrew on OS X. ```bash brew install gr-osmosdr ``` -------------------------------- ### Install HackRF Tools on Arch Linux Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Use pacman to install gnuradio, gnuradio-osmosdr, and gnuradio-companion on Arch Linux. ```bash pacman -S gnuradio gnuradio-osmosdr pacman -S gnuradio-companion ``` -------------------------------- ### CMake Project Setup Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/hackrf-tools/CMakeLists.txt Initializes the CMake build system for the hackrf-tools project, specifying the minimum required version and the project language. ```cmake cmake_minimum_required(VERSION 3.10.0) project(hackrf-tools LANGUAGES C) ``` -------------------------------- ### Install HackRF Tools on Fedora/Red Hat Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Use dnf to install gnuradio, gr-osmosdr, hackrf, and gqrx on Fedora or Red Hat systems. ```bash sudo dnf install gnuradio gr-osmosdr hackrf gqrx -y ``` -------------------------------- ### Compile and Load Firmware into RAM (HackRF One) Source: https://github.com/greatscottgadgets/hackrf/wiki/Updating-Firmware Alternative method to load firmware into RAM and start it using `make` command, specifically for HackRF One. This is useful for recovery scenarios. ```bash make -e BOARD=HACKRF_ONE RUN_FROM=RAM program ``` -------------------------------- ### Install HackRF on Arch Linux Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install HackRF on Arch Linux using the pacman package manager. ```bash pacman -S hackrf ``` -------------------------------- ### Build HackRF Host Software on Linux Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/README.md Compiles and installs the HackRF host software on Linux. This process includes creating a build directory, configuring with CMake, and making the installation. ```bash mkdir host/build cd host/build cmake .. make sudo make install sudo ldconfig ``` -------------------------------- ### Build HackRF Host Tools from Source Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Build the HackRF host tools from source using CMake and Make. Ensure to run ldconfig after installation. ```bash cd hackrf/host mkdir build cd build cmake .. make sudo make install sudo ldconfig ``` -------------------------------- ### Install HackRF Tools on Gentoo Linux Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Use emerge to install hackrf-tools and gr-osmosdr with the hackrf USE flag on Gentoo Linux. ```bash emerge -a net-wireless/hackrf-tools USE="hackrf" emerge -a net-wireless/gr-osmosdr ``` -------------------------------- ### Build HackRF Software from Source on Linux/OS X/*BSD Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Steps to build HackRF host tools from source on Unix-like systems. This involves cloning the repository, configuring with CMake, and installing. ```bash git clone https://github.com/greatscottgadgets/hackrf.git cd hackrf/host mkdir build cd build cmake .. make sudo make install sudo ldconfig ``` -------------------------------- ### Install HackRF on Fedora/Red Hat Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install HackRF on Fedora or Red Hat based systems using dnf. ```bash sudo dnf install hackrf -y ``` -------------------------------- ### Install HackRF on OS X using Homebrew Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install HackRF on OS X using the Homebrew package manager. ```bash brew install hackrf ``` -------------------------------- ### Build and Install HackRF Sweep Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/hackrf-tools/src/CMakeLists.txt This block builds the hackrf_sweep executable if FFTW3f is found and the ENABLE_HACKRF_SWEEP option is ON. It sets the C standard, links against FFTW3f and other tools, and installs the executable. ```cmake if(FFTW3f_FOUND AND ENABLE_HACKRF_SWEEP) add_executable(hackrf_sweep hackrf_sweep.c) target_compile_features(hackrf_sweep PRIVATE c_std_90) target_link_libraries(hackrf_sweep fftw3f::fftw3f ${TOOLS_LINK_LIBS}) install(TARGETS hackrf_sweep RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else() message( STATUS "Not building hackrf_sweep tool. (Install FFTW, set ENABLE_HACKRF_SWEEP)" ) endif() ``` -------------------------------- ### Add Subdirectory for Blinky Source: https://github.com/greatscottgadgets/hackrf/blob/main/firmware/CMakeLists.txt Includes the 'blinky' subdirectory, which likely contains source code and build configurations for a basic LED blinking example. ```cmake add_subdirectory(blinky) ``` -------------------------------- ### Build HackRF from Ports on FreeBSD Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Build and install hackrf from the ports tree on FreeBSD. ```bash # cd /usr/ports/comms/hackrf # make install ``` -------------------------------- ### Build HackRF Host Software on macOS Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/README.md Compiles and installs the HackRF host software on macOS. This process involves installing dependencies via Homebrew and then using CMake and make. ```bash mkdir host/build cd host/build cmake .. make sudo make install sudo update_dyld_shared_cache ``` -------------------------------- ### Si5351 Configure CLK0 Output Source: https://github.com/greatscottgadgets/hackrf/wiki/Lemondrop-Bring-Up Write to register 16 to configure CLK0. This example powers up CLK0, sets it to integer mode, uses PLLA as the source, and sets the output drive to 8mA. ```text [0xC0 16 0x43 0x80 0x80 0x80 0x80 0x80 0x80 0x80] ``` -------------------------------- ### Enable HackRF Sweep Tool Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/hackrf-tools/src/CMakeLists.txt This option enables the build and installation of the hackrf_sweep tool, which requires the FFTW3f library. Set ENABLE_HACKRF_SWEEP to ON to include it. ```cmake option(ENABLE_HACKRF_SWEEP "Build and Install hackrf_sweep tool (Requires FFTW3f)" ON) ``` -------------------------------- ### GDB with Black Magic Probe Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-Debugging Example GDB commands for debugging with a Black Magic Probe. Ensure the correct serial port and target attachment are used. ```bash arm-none-eabi-gdb -n blinky.elf target extended-remote /dev/ttyACM0 monitor swdp_scan attach 1 set {int}0x40043100 = 0x10000000 load cont ``` -------------------------------- ### Si5351 Set PLL Input Source Source: https://github.com/greatscottgadgets/hackrf/wiki/Lemondrop-Bring-Up Write to register 15 to configure the PLL input source. This example sets CLKIN_DIV to 1 and both PLLA and PLLB sources to XTAL input. ```text [0xC0 15 0x00] ``` -------------------------------- ### HackRF Sweep Example Results Table Source: https://github.com/greatscottgadgets/hackrf/wiki/hackrf_sweep Illustrates sample output from the hackrf_sweep tool, showing captured data for specific frequency ranges. The table details the timestamp, frequency bins, sample counts, and power levels detected. ```text | Date | Time | Hz Low | Hz High | Hz bin width | Num Samples | dB | dB | dB | dB | dB | |----------|----------------|-----------|-----------|--------------|-------------|----|----|----|----|----| |2019-01-03| 11:57:34.967805| 2400000000| 2405000000| 1000000.00| 20| -64.72| -63.36| -60.91| -61.74| -58.58| |2019-01-03| 11:57:34.967805| 2410000000| 2415000000| 1000000.00| 20| -69.22| -60.67| -59.50| -61.81| -58.16| |2019-01-03| 11:57:34.967805| 2405000000| 2410000000| 1000000.00| 20| -61.19| -70.14| -60.10| -57.91| -61.97| |2019-01-03| 11:57:34.967805| 2415000000| 2420000000| 1000000.00| 20| -72.93| -79.14| -68.79| -70.71| -82.78| |2019-01-03| 11:57:34.967805| 2420000000| 2425000000| 1000000.00| 20| -67.57| -61.61| -57.29| -61.90| -70.19| |2019-01-03| 11:57:34.967805| 2430000000| 2435000000| 1000000.00| 20| -56.04| -59.58| -66.24| -66.02| -62.12| ``` -------------------------------- ### Configure Udev Rules Installation on Linux Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/libhackrf/CMakeLists.txt This CMake script block determines if the system is Linux and sets a default for installing udev rules. It then defines an option to control the installation and specifies the target directory for the rules. ```cmake if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(SYSTEM_IS_LINUX TRUE) set(UDEV_OPTION_DEFAULT ON) else() set(SYSTEM_IS_LINUX FALSE) set(UDEV_OPTION_DEFAULT OFF) endif() option(INSTALL_UDEV_RULES "Install udev rules for the HackRF" ${UDEV_OPTION_DEFAULT}) set(UDEV_RULES_PATH "/etc/udev/rules.d" CACHE STRING "Target directory for udev rule installation. Ensure you have permissions to write to this directory.") ``` -------------------------------- ### Install gr-osmosdr using MacPorts Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Install the gr-osmosdr package using MacPorts on OS X. ```bash sudo port install gr-osmosdr ``` -------------------------------- ### Download Firmware via DFU Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-USB-DFU-Notes Downloads the prepared firmware file (load.dfu) to the connected device in DFU mode. Ensure the device is correctly identified by its Vendor ID (VID) and Product ID (PID). ```bash /usr/local/bin/dfu-util -d 1fc9:000c -a 0 -D load.dfu ``` -------------------------------- ### Install HackRF on OS X using MacPorts Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Install HackRF on OS X using the MacPorts package manager. ```bash sudo port install hackrf ``` -------------------------------- ### Create Library Definition for MSVC Source: https://github.com/greatscottgadgets/hackrf/wiki/Operating-System-Tips Create a library definition file for MSVC to link against the FFTW DLL on Windows. ```bash C:\fftw-3.3.5-dll64> lib /machine:x64 /def:libfftw3f-3.def ``` -------------------------------- ### Create DFU Header Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-USB-DFU-Notes Generates a binary header for DFU bootloader downloads. This header includes file length information and hash placeholders. The length calculation should be automated in practice. ```bash echo "0000000: da ff {blocksL} {blocksH} {hash0} {hash1} {hash2} {hash3}" | xxd -g1 -r > header.bin ``` -------------------------------- ### Run ARM GDB Session Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-Debugging Initiates an ARM GDB session, connects to a remote target, loads an ELF file, sets breakpoints, and begins execution. ```bash arm-none-eabi-gdb -n target extended-remote localhost:3333 set tdesc filename target.xml monitor reset init monitor mww 0x40043100 0x10000000 monitor mdw 0x40043100 # Verify 0x0 shadow register is set properly. file lpc4350-test.axf # This is an ELF file. load # Place image into RAM. monitor reset init break main # Set a breakpoint. continue # Run to breakpoint. continue # To continue from the breakpoint. step # Step-execute the next source line. stepi # Step-execute the next processor instruction. info reg # Show processor registers. ``` -------------------------------- ### Build HackRF Host Software for MinGW Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/README.md Builds the HackRF host software using MinGW. Ensure you have the correct paths for libusb headers. ```bash mkdir host/build cd host/build cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/ make make install ``` -------------------------------- ### HackRF Sweep Example Command Source: https://github.com/greatscottgadgets/hackrf/wiki/hackrf_sweep Example of running the hackrf_sweep tool to scan frequencies between 2400 and 2490 MHz. This command initiates a sweep operation within the specified range. ```bash hackrf_sweep -f 2400:2490 ``` -------------------------------- ### Bus Pirate Read 16 Si5351 Registers Starting at 16 Source: https://github.com/greatscottgadgets/hackrf/wiki/Lemondrop-Bring-Up Read 16 consecutive registers from the Si5351, starting from register 16. This is useful for accessing different configuration blocks. ```text I2C>[0xc0 16[0xc1 r:16]] ... READ: 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ``` -------------------------------- ### Bus Pirate Read 16 Si5351 Registers Starting at 0 Source: https://github.com/greatscottgadgets/hackrf/wiki/Lemondrop-Bring-Up Read 16 consecutive registers from the Si5351, starting from register 0. This provides a snapshot of multiple configuration values. ```text I2C>[0xc0 0[0xc1 r:16]] ... READ: 0x10 ACK 0xF8 ACK 0x03 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x8F ACK 0x01 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x90 ACK 0x00 ``` -------------------------------- ### HackRF Sweep Example Output Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/hackrf_tools.md Example output from the hackrf_sweep command when run with the -f 2400:2490 flag. Each row represents a sweep across a portion of the specified frequency range, with columns detailing date, time, frequency range, bin width, number of samples, and detected power levels in dB for multiple frequency bins. ```text Date, Time, Hz Low, Hz High, Hz bin width, Num Samples, dB, dB, dB, dB, dB 2019-01-03, 11:57:34.967805, 2400000000, 2405000000, 1e+06, 20, -64.72, -63.36, -60.91, -61.74, -58.58 2019-01-03, 11:57:34.967805, 2410000000, 2415000000, 1e+06, 20, -69.22, -60.67, -59.5, -61.81, -58.16 2019-01-03, 11:57:34.967805, 2405000000, 2410000000, 1e+06, 20, -61.19, -70.14, -60.1, -57.91, -61.97 2019-01-03, 11:57:34.967805, 2415000000, 2420000000, 1e+06, 20, -72.93, -79.14, -68.79, -70.71, -82.78 2019-01-03, 11:57:34.967805, 2420000000, 2425000000, 1e+06, 20, -67.57, -61.61, -57.29, -61.9, -70.19 2019-01-03, 11:57:34.967805, 2430000000, 2435000000, 1e+06, 20, -56.04, -59.58, -66.24, -66.02, -62.12 ``` -------------------------------- ### OpenOCD Configuration: Main Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-Debugging Main OpenOCD configuration file. It sources interface and target-specific configuration files. ```tcl #debug_level 3 source [find interface/stlink-v2.cfg] source ./lpc4350.cfg ``` -------------------------------- ### Configure and Build HackRF on Windows Source: https://github.com/greatscottgadgets/hackrf/blob/main/docs/source/installing_hackrf_software.md Configure and build the HackRF host tools on Windows using CMake and Visual Studio build tools. This requires setting environment variables for pkg-config. ```win-batch set PKG_CONFIG=C:\vcpkg\installed\x64-windows\tools\pkgconf\pkgconf.exe set PKG_CONFIG_PATH=C:\vcpkg\installed\x64-windows\lib\pkgconfig set CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake cmake -B host\build host cmake --build host\build ``` -------------------------------- ### Add Static Library for getopt on MSVC Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/hackrf-tools/src/CMakeLists.txt On Windows with MSVC, a static library for getopt is created from ../getopt/getopt.c and added to the linking libraries for tools. ```cmake if(MSVC) add_library(libgetopt_static STATIC ../getopt/getopt.c) list(APPEND TOOLS_LINK_LIBS libgetopt_static) endif() ``` -------------------------------- ### Invalid Opera Cake Port Configuration Source: https://github.com/greatscottgadgets/hackrf/wiki/Opera-Cake This example demonstrates an invalid port configuration where both inputs are attempted to be connected to the same bank (Bank A in this case). ```bash hackrf_operacake -o 24 -a 1 -b 2 ``` -------------------------------- ### Build HackRF Host Software for Cygwin Source: https://github.com/greatscottgadgets/hackrf/blob/main/host/README.md Builds the HackRF host software using Cygwin. Ensure you have the correct paths for libusb headers. ```bash mkdir host/build cd host/build cmake ../ -G "Unix Makefiles" -DCMAKE_LEGACY_CYGWIN_WIN32=1 -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/ make make install ``` -------------------------------- ### Load Firmware into RAM via DFU (HackRF One) Source: https://github.com/greatscottgadgets/hackrf/wiki/Updating-Firmware Use `dfu-util` to load a `.dfu` firmware image into RAM for HackRF One. This is typically used for initial programming or recovery when SPI flash is damaged. ```bash dfu-util --device 1fc9:000c --alt 0 --download hackrf_one_usb.dfu ``` -------------------------------- ### GDB: Examine Memory Range Source: https://github.com/greatscottgadgets/hackrf/wiki/LPC43xx-Debugging Prints the contents of a specified range of memory addresses, starting from 0x40050014 for 46 words, useful for inspecting peripherals. ```gdb x/46 0x40050014 ```