Skip to content

Commit 985a08d

Browse files
committed
updated
1 parent d023395 commit 985a08d

File tree

1 file changed

+69
-33
lines changed

1 file changed

+69
-33
lines changed

README.md

Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,36 @@
11
# python_bladerf
22

3-
python_bladerf is a cython wrapper for bladerf (https://github.com/Nuand/bladeRF). It also contains some additional tools.
3+
python_bladerf is a cython wrapper for [bladerf](https://github.com/Nuand/bladeRF). It also contains some additional tools.
4+
5+
Before installing python_bladerf library, you must have bladerf host software installed. Because this library uses dynamic linking with an existing library file.
46

57
You can install this library using
68
```
79
pip install python_bladerf
810
```
9-
Or assemble it manually using the following steps:
1011

11-
In order to build the library you need to go to the python_bladerf directory
12-
```
13-
cd python_bladerf
14-
```
15-
call
16-
```
17-
python setup.py build_ext --inplace.
18-
```
19-
If the build fails, you will need to specify the paths for the libusb library.
12+
If your bladerf files are in non-standard paths and during installation the python_bladerf cannot find libbladeRF.h and bladeRF2.h or the library files, you can specify the paths via environment variables
2013
```
21-
CFLAGS="-I/path to libusb.h -I/path to libbladeRF.h" \
22-
LDFLAGS="-L/path to libusb-1.0.so -L/path to libBladeRF.so" \
23-
python setup.py build_ext --inplace
14+
export PYTHON_BLADERF_CFLAGS=path_to_libbladeRF.h_andbladeRF2.h
15+
export PYTHON_BLADERF_LDFLAGS=path_to_libbladerf.(so, dylib, dll)
2416
```
2517

2618
## Requirements:
2719
* libusb-1.0 (https://github.com/libusb/libusb)
2820
* libBladeRF (https://github.com/Nuand/bladeRF)
29-
* Cython==0.29.36
30-
* Numpy>=1.26
21+
* Cython==0.29.37
22+
* Numpy>=2.2.1
3123
* Scipy (optional, for faster work)
3224
* pyFFTW (optional, for faster work)
25+
* pyjnius and android (only for android)
3326

3427
## bladerf:
35-
Almost all the functionality of the standard library is implemented. Some features will be added later. (async recieve and transmit).
28+
The library supports all bladerf2 functions, some of the functions can also work on the first versions.If there is a demand for full support of the first version, I will add it.
3629

3730
## pybladerf tools:
3831
* pybladerf_info.py - Reading information about found devices.
39-
* pybladerf_sweep.py - Possibility to get extended range fft ( same as hackrf_sweep)
32+
* pybladerf_sweep.pyx - a function that allows you to obtain a sweep over a given frequency range ( same as hackrf_sweep)
33+
* pybladerf_transfer.pyx - a function that allows you to record and play back samples
4034

4135
## usage
4236
```
@@ -48,9 +42,10 @@ options:
4842
-h, --help show this help message and exit
4943
5044
Available commands:
51-
{info,sweep}
45+
{info,sweep,transfer}
5246
info Read device information from Bladerf such as serial number and FPGA version.
5347
sweep a command-line spectrum analyzer.
48+
transfer Send and receive signals using BladeRF. Input/output files consist of complex64 quadrature samples.
5449
```
5550
```
5651
usage: python_bladerf info [-h] [-f] [-s]
@@ -62,26 +57,67 @@ options:
6257
show only founded device_identifiers
6358
```
6459
```
65-
usage: python_bladerf sweep [-h] [-d] [-f] [-g] [-w] [-ch] [-1] [-N] [-o] [-B] [-s] [-SR] [-BW] -[FIR] [-r]
60+
usage: python_bladerf sweep [-h] [-d] [-f] [-g] [-w] [-c] [-1] [-N] [-o] [-B] [-S] [-s] [-b] [-r]
6661
6762
options:
6863
-h, --help show this help message and exit
69-
-d device_identifier. device identifier of desired BladeRF
70-
-f freq_min:freq_max. minimum and maximum frequencies in MHz start:stop. Default is 71:5999
71-
-g gain_db. RX gain, -15 - 60dB, 1dB steps
72-
-w bin_width. FFT bin width (frequency resolution) in Hz, 245-30000000
73-
-ch RX channel. which channel to use (0, 1). Default is 0
64+
-d device identifier of desired BladeRF
65+
-f freq_min:freq_max. minimum and maximum frequencies in MHz start:stop or start1:stop1,start2:stop2. Default
66+
-g RX gain, -15 - 60dB, 1dB steps
67+
-w FFT bin width (frequency resolution) in Hz
68+
-c RX channel. which channel to use (0, 1). Default is 0
7469
-1 one shot mode. If specified = Enable
75-
-N num_sweeps. Number of sweeps to perform
70+
-N Number of sweeps to perform
7671
-o oversample. If specified = Enable
7772
-B binary output. If specified = Enable
78-
-s sweep style ("L" - LINEAR, "I" - INTERLEAVED). Default is INTERLEAVED
79-
-SR sample rate in Hz (0.5 MHz - 122 MHz). Default is 57. To use a sample rate higher than 61, specify oversample
80-
-BW bandwidth in Hz (0.2 MHz - 56 MHz). Default is 56000000
81-
-FIR RFIC RX FIR filter ("1" - Enable, "0" - Disable). Default is Disable
73+
-S sweep style ("L" - LINEAR, "I" - INTERLEAVED). Default is INTERLEAVED
74+
-s sample rate in MHz (0.5 MHz - 122 MHz). Default is 61. To use a sample rate higher than 61, specify oversample
75+
-b baseband filter bandwidth in MHz (0.2 MHz - 56 MHz). Default .75 * sample rate
8276
-r filename. output file
8377
```
84-
## Note
85-
This library probably can work on android. To do this, go to the android directory and download two recipes for p4a.
78+
```
79+
python_bladerf transfer [-h] [-d] [-r] [-t] [-f] [-p] [-c] [-g] [-N] [-R] [-s] -[b] [-H] -[o]
80+
81+
options:
82+
-d serial number of desired HackRF
83+
-r <filename> receive data into file (use "-" for stdout)
84+
-t <filename> transmit data from file (use "-" for stdout)
85+
-f, --freq_hz frequency in Hz (0MHz to 6000MHz supported). Default is 900MHz
86+
-p antenna port power. If specified = Enable
87+
-c RX or TX channel. which channel to use (0, 1). Default is 0
88+
-g RX or TX gain, RX: -15 - 60dB, 1dB steps, TX: -24 - 66 dB, 1dB steps
89+
-N number of samples to transfer (default is unlimited)
90+
-R repeat TX mode. Fefault is off
91+
-s sample rate in MHz (0.5 MHz - 122 MHz). Default is 61. To use a sample rate higher than 61, specify oversample'
92+
-b baseband filter bandwidth in MHz (0.2 MHz - 56 MHz). Default .75 * sample rate
93+
-H synchronize RX/TX to external trigger input
94+
-o oversample. If specified = Enable
95+
```
96+
97+
## Android
98+
This library can work on android. To do this, go to the android directory and download 3 recipes for [p4a](https://github.com/kivy/python-for-android).
99+
100+
buildozer.spec
101+
```
102+
requirements = python3,android,pyjnius,numpy,libusb,libbladerf,python_bladerf
103+
p4a.local_recipes = path_to_pythonforandroidrecipes_folder
104+
```
105+
106+
#### Your recipes folder should contain at least the following files:
107+
```
108+
pythonforandroidrecipes/
109+
__init__.py
110+
libusb/
111+
__init__.py
112+
python_bladerf/
113+
__init__.py
114+
libbladerf/
115+
__init__.py
116+
jni/
117+
Android.mk
118+
Application.mk
119+
libbladerf.mk
120+
```
121+
86122
## Examples
87-
Examples will be added later.
123+
Please use the original bladerf documentation

0 commit comments

Comments
 (0)