summaryrefslogtreecommitdiff
path: root/md/writeup/bladerf_quick_guide.md
blob: 19af38ded18bab1d717cfe4e33b40769f4dd4649 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
title:BladerRF quick quide
keywords:sdr,bladerf,gnuradio,gqrx

# BladeRF quick guide


## Intro

BladeRF is SDR device capable to transmit in range 47-6000Mhz and receive in range 70-6000Mhz. 
With samplerate 0.52-61Mhz and max bandwidth 0.2-56MHz. As it capable to RX/TX on quite
wide range there is infinite possibilities what can be done with it.


## Quick test

Run
```bash
bladeRF-cli -p
```
Output will show if any BladeRF device is connected

### Ubuntu firmware

If no firmware located run

```bash
sudo bladeRF-install-firmware
```

this will install firmware to __/usr/share/Nuand/BladeRF/__ directory

## Running GQRX

Lunch any of command below  to start graphical SDR 
```bash
gqrx
gqrx-alsa //if first one fails with some pulse audio error
```

Choose device selection dialog and add to 
__Device string__ 

```bash
bladerf=0,fpga=/usr/share/bladerf/fpga/hostedxA4.rbf
```

This will set to first bladerf and load FPGA bitstream, find path to bitstream on your PC from distro package.
Now GQRX will ready to go

### Enable biastee
If there are attached LNA or LNB to BladeRF SMA ports you can enable biastee by adding to 
GQRX __Device string__ with comma separation between parameters
```bash
biastee=rx
```

## Running from command line

To start interactive commandline point to fpga bitstream, can be found in distro package. 

```bash
bladeRF-cli -i -l /usr/share/bladerf/fpga/hostedxA4.rbf
```


### Receive

Set frequency to AA Megaherz with sample rate BB bandwidth CC and write to file DD in signed complex 16 bit, with 20M entries

```bash
set frequency rx  AAM
set samplerate rx BBM
set bandwidth rx CCM
rx config file=DD.sc16q11 format=bin n=20M
rx start
rx wait
rx
```



### Transmit

Set frequency to AA Megaherz with sample rate BB bandwidth CC and read from file DD in signed complex 16 bit

```bash
set frequency tx AAM
set samplerate tx BBM
set bandwidth tx CCM
tx config file=DDsc16q11 format=bin
tx start
tx wait
tx
```


### Enable biastee

To enable/disable biastee set channel RX1/RX2/TX1/TX2 to 0/false to disable and 1/true to enable biastee on particular channel

```bash
set biastee RX1 true
```

## Gnuradio

Gnuradio is opensource tool that allows you to utilize DSP blocks and create
processing pipeline. It works like a block diagrams drawing tool, except the block are 
DSP processing steps and as output you get processed signal. Here is example how to
create FM radio listening design and as result you can hear to your local radio stations.

![BladerRF fm radio block diagram](/img/gnuradio/bladerf_fm_radio.png)


## Quartus

Steps how to install Quartus and make it compile BladeRF firmware

Get the version of Quartus 20.1.1 from Intel download page. Get the whole package or
2 packates Quartus,ModelSim and CycloneV device support package. Install the Quartus.


Get the BladeRF source:

```bash
git clone https://github.com/Nuand/bladeRF.git
cd bladeRF
git submodule init
git submodule update
```

go to *hdl/quartus*

so now set the environment 

```bash
export QSYS_ROOTDIR="/home/user/intelFPGA_lite/20.1.1/quartus/sopc_builder"
export QUARTUS_ROOTDIR=/home/user/intelFPGA_lite/20.1.1/quartus
export PATH=$PATH:/home/user/intelFPGA_lite/20.1.1/quartus/sopc_builder/bin
export PATH=$PATH:/home/user/intelFPGA_lite/20.1.1/quartus/bin
export PATH=$PATH:/home/user/intelFPGA_lite/20.1.1/nios2eds/bin
export PATH=$PATH:/home/user/intelFPGA_lite/20.1.1/nios2eds/sdk2/bin
export PATH=$PATH:/home/user/intelFPGA_lite/20.1.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/
export SOPC_KIT_NIOS2=/home/user/intelFPGA_lite/20.1.1/nios2eds
```

Get the license files from Intel self licensing page

```bash
export LM_LICENSE_FILE=/home/user/intelFPGA_lite/LR-174976_License.dat
export MGLS_LICENSE_FILE=/home/user/intelFPGA_lite/LR-174976_License.dat
```

Now in bladerf dir go to hdl/quartus and run command to build hosted firmware

```bash
./build_bladerf.sh -b bladeRF-micro -r hosted -s A4
```

## Modsim

How to make modsim to run, for simulating BladeRF code

Add dependencies for modsim

```bash
dpkg --add-architecture i386
apt update
apt install libxft2 libxft2:i386 libxext6 libext6:i386
```


Run vsim command from where its located inside the quartus install directory

```bash
./vsim
```


## Links

[https://www.nuand.com/bladerf-2-0-micro/](https://www.nuand.com/bladerf-2-0-micro/)  
[https://gqrx.dk/](https://gqrx.dk/)  
[https://www.nuand.com/product/bt-100/](https://www.nuand.com/product/bt-100/)  
[https://www.nuand.com/product/bt-200/](https://www.nuand.com/product/bt-200/)  
[https://github.com/Nuand/bladeRF/wiki/bladeRF-CLI-Tips-and-Tricks](https://github.com/Nuand/bladeRF/wiki/bladeRF-CLI-Tips-and-Tricks)  
[https://sites.google.com/site/sdrbladerf/home/bladerf-getting-started](https://sites.google.com/site/sdrbladerf/home/bladerf-getting-started)  
[https://www.gnuradio.org/](https://www.gnuradio.org/)  
[https://github.com/Nuand/bladeRF/wiki/Getting-Started%3A-Linux#user-content-Debianbased_distros_eg_Ubuntu](https://github.com/Nuand/bladeRF/wiki/Getting-Started%3A-Linux#user-content-Debianbased_distros_eg_Ubuntu)