### Install build dependencies Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Install the required compiler and configuration tools for firmware development. ```bash sudo apt install sdcc pkgconf ``` -------------------------------- ### Build and install Debian package Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Commands to create and install the Debian package for the API. ```bash make deb ``` ```bash make debinstall ``` ```bash sudo dpkg -i `ls deb_dist/hantek6022api_*.deb | tail -1` ``` ```bash sudo dpkg -P hantek6022api ``` -------------------------------- ### Install Debian package dependencies Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Install necessary packages for building and installing the Debian package. ```bash sudo apt install python3-setuptools python3-stdeb dh-python python3-libusb1 sdcc libusb-1.0 libusb-1.0-0-dev; ``` -------------------------------- ### Capture and plot data Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Example command to capture scope traces and pipe them to the plotting utility. ```bash capture_6022.py -t 0.01 | plot_from_capture_6022.py ``` -------------------------------- ### Build firmware using make Source: https://github.com/ho-ro/hantek6022api/blob/main/Firmware/fx2lib/fw/readme.txt Commands to compile firmware into various formats including .ihx, .bix, and .iic. ```bash make # builds firmware.ihx make bix # builds firmware.bix make iic # builds firmware.iic ``` -------------------------------- ### Build firmware Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Compile the custom firmware from the top-level directory. ```bash make ``` -------------------------------- ### Initialize git submodules Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Pull the required fx2lib submodule into the repository. ```bash git submodule init git submodule update --remote ``` -------------------------------- ### Configure udev rules Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Copy the udev rules file to the system directory to allow non-root access to the device. ```bash sudo cp 60-hantek-6022-usb.rules /etc/udev/rules.d/ ``` -------------------------------- ### Complete Offset and Gain Calibration Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Performs a full calibration including gain measurement, creating a config file and updating the EEPROM. ```bash calibrate_6022.py -ceg ``` -------------------------------- ### Initialize and set calibration frequency Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Python script to initialize the oscilloscope, upload firmware if necessary, and set the calibration output frequency. ```python #!/usr/bin/python3 # get the python package from PyHT6022.LibUsbScope import Oscilloscope # create an Osclloscope object scope = Oscilloscope() # setup the scope scope.setup() # attach to the scope scope.open_handle() # upload firmware unless already uploaded if (not scope.is_device_firmware_present): scope.flash_firmware() # and now set the calibration frequency output to 400 Hz scope.set_calibration_frequency( 400 ) ``` -------------------------------- ### Calibration script usage Source: https://github.com/ho-ro/hantek6022api/blob/main/docs/README.md Displays the command-line arguments available for the calibrate.py utility. ```text usage: calibrate.py [-h] [-c] [-e] [-g] optional arguments: -h, --help show this help message and exit -c, --create_config create a config file -e, --eeprom store calibration values in eeprom -g, --measure_gain interactively measure gain (as well as offset) ``` -------------------------------- ### Upload Firmware from Hex File Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Uploads firmware from an Intel hex file to the device. ```text usage: upload_6022_firmware_from_hex.py HEXFILE ``` -------------------------------- ### Fast Offset Calibration Source: https://github.com/ho-ro/hantek6022api/blob/main/README.md Performs offset calibration by applying 0V to inputs and storing results in the EEPROM. ```bash calibrate_6022.py -e ``` -------------------------------- ### Upload Firmware to Hantek 6022 Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Uploads firmware to Hantek 6022 devices, supporting custom VID/PID and specific firmware types. ```text usage: upload_firmware_6022.py [-h] [-V VID] [-P PID] [--be | --bl] Upload firmware to Hantek6022 devices with different VID:PID options: -h, --help show this help message and exit -V VID, --VID VID set vendor id (hex) -P PID, --PID PID set product id (hex) --be, --6022be use DSO-6022BE firmware --bl, --6022bl use DSO-6022BL firmware ``` ```bash $ lsusb | grep Cypress Bus 002 Device 021: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit $ ./upload_firmware_6022.py --VID 04b4 --PID 8613 --6022be upload DSO-6022BE firmware FW version 0x210 Serial number CF81BA1F3532 $ lsusb | grep Hantek Bus 002 Device 022: ID 04b5:6022 ROHM LSI Systems USA, LLC Hantek DSO-6022BE ``` -------------------------------- ### Plot FFT from Capture Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Plots the FFT of captured data, defaulting to Hann windowing. ```text usage: fft_from_capture_6022.py [-h] [-i INFILE] [-f | -n] [-x] Plot FFT of output from capture_6022.py, use hann windowing as default options: -h, --help show this help message and exit -i INFILE, --infile INFILE read the data from INFILE, (default: stdin) -f, --flat_top use flat top window -n, --no_window use no window -x, --xkcd plot in XKCD style :) ``` -------------------------------- ### Plot Capture Over Time Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Plots the output of capture_6022.py over time. ```text usage: plot_from_capture_6022.py [-h] [-i INFILE] [-c CHANNEL] [-s [MAX_FREQ]] [-x] Plot output of capture_6022.py over time options: -h, --help show this help message and exit -i INFILE, --infile INFILE read the data from INFILE (default: stdin) -c CHANNEL, --channel CHANNEL show only CH1 or CH2, default: show both) -s [MAX_FREQ], --spectrum [MAX_FREQ] display the spectrum of the samples, optional up to MAX_FREQ -x, --xkcd plot in XKCD style :) ``` -------------------------------- ### Capture Data from Hantek 6022 Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Captures data from both channels of the Hantek 6022 oscilloscope. ```text usage: capture_6022.py [-h] [-d [DOWNSAMPLE]] [-g] [-o OUTFILE] [-r RATE] [-t TIME] [-x CH1] [-y CH2] Capture data from both channels of Hantek6022 options: -h, --help show this help message and exit -d [DOWNSAMPLE], --downsample [DOWNSAMPLE] downsample 256 x DOWNSAMPLE -g, --german use comma as decimal separator -o OUTFILE, --outfile OUTFILE write the data into OUTFILE (default: stdout) -r RATE, --rate RATE sample rate in kS/s (20, 32, 50, 64, 100, 128, 200, default: 20) -t TIME, --time TIME capture time in seconds (default: 1.0) -x CH1, --ch1 CH1 gain of channel 1 (1, 2, 5, 10, default: 1) -y CH2, --ch2 CH2 gain of channel 2 (1, 2, 5, 10, default: 1) ``` -------------------------------- ### Calibrate Hantek 6022 Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Measures offset and gain calibration values for the device. ```text usage: calibrate_6022.py [-h] [-c] [-e] [-g] Measure offset and gain calibration values options: -h, --help show this help message and exit -c, --create_config create a config file -e, --eeprom store calibration values in eeprom -g, --measure_gain interactively measure gain (as well as offset) ``` -------------------------------- ### Set Calibration Output Frequency Source: https://github.com/ho-ro/hantek6022api/blob/main/examples/README.md Sets the calibration output frequency between 32 Hz and 100 kHz. ```text usage: set_cal_out_freq_6022.py FREQ with 32 <= FREQ <= 100000 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.