I want to use bladeRF with PocketSDR AP, part 2

categories: gnss
tags: pocketsdr qzss sdr

The first quasi-zenith satellite, Michibiki, will stop signal transmission soon

After the operation of the quasi-zenith satellite 1 replacement (QZS-1R: quasi-zenith satellite 1 replacement) started on March 24, 2022, the radiowave transmission of the first satellite (QZS-1) will be stopped. By then, I would like to record the signal when all QZS-1, 2, 3, 4, and 1R are in the visible state.

qzs-1 signal termination announcement

Signal disturbance on bladeRF

Professor Ebinuma of Chubu University has succeeded in recording GPS L1 band signals using bladeRF, a software defined radio hardware[].

In addition, the playback of the recorded signal has been successful, which is awesome. Professor Ebinuma used a low noise amplifier (LNA) with a gain of 40 dB and a ramdisk. It was also mentioned in the value of RXVGA2 (receiver variable gain amplifier 2) that I was worried about.

Therefore, I will try to record the signal again. I connected my LNA, Anritsu MA8610A, between the receiving antenna and bladeRF. The gain of this LNA is 20 dB, the frequency range is 9 kHz to 2.2 GHz, and the noise figure (NF) is 5 dB. This connection has increased the significant number of bits.

pre-amplifier and bladeRF

The next issue is signal missing, but I decided to reuse the ramdisk area already prepared in Ubuntu. With a capacity of 779 megabytes, it is sufficient for this experiments.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           779M     0  779M   0% /run/user/1000

I wrote the signal recording file to this /run/user/1000 and checked the histogram with pocket_psd.py of the PocketSDR AP. As a result, the histogram and spectrum seemed to be disturbed less frequently, but they were still disturbed about once every few seconds.

Next, I tried OS downgrade from Ubuntu 20.04 LTS to Ubuntu 18.04 LTS. I thought that I might restore the OS later, so I replaced the SSD itself and installed a new OS.

Ubuntu 18.04 LTS installation

Ubuntu 18.04 LTS cannot use Nuand PPA files, so I built it from the source code. Since the firmware was new, I tried the latest combination of firmware v.2.4.0 and FPGA bitstream v.0.14.0.

bladeRF-cli --flash-firmware bladeRF_fw_v2.4.0.img
bladeRF-cli -l hostedx40-v.0.14.0.rbf

However, I failed to run cal lms and went back to the shell in my environment.

bladeRF> cal lms
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1090] Transfer timed out for buffer 0x562e9f639380
[WARNING @ fpga_common/src/lms.c:3032] DC Calibration (module=1) failed to converge.

When I revert the firmware version to v.2.3.1 and used FPGA bitstream version v0.11.0, DC offset cancellation was possible, so I will try it under these conditions. As a result, the histogram and spectrum were still disturbed once every few seconds.

Signal recording with USRP B205mini-i

I also try recording with USRP B205mini-i。

/usr/lib/uhd/examples/rx_samples_to_file --freq 1575420000 --bw 2500000 --rate 4000000 --duration 1 --gain 60 --wirefmt sc8

Even with this B205 mini-i, there was a spectral disturbance once every few seconds. I changed my PC from Latte Panda to HP Z210, but the spectral distortion did not go away.

The same phenomenon appears on different radios and different PCs, so I may be doing something wrong. I like trial and error, so I’ll do my best.

Measurement script code of trial and error

When repeating signal observation and processing, it tends to forget the specifications and date and time notes. So I wrote the Python code measure.py to semi-automate measurement and recording. It records the date and time when the code was executed, creates a bladeRF configuration file with a file name that represents the specifications, executes the measurement, and adds the file name and specifications to the readme.txt file. am. If executed as it is, the signal of GPS L1 band will be recorded, but the signal of other frequency band can be recorded by the -band option.


#! /usr/bin/env python3
# -*- coding: utf-8 -*-

fn_readme = 'readme.txt'
fn_blade  = 'blade_'
cmd_bladerf = 'bladeRF-cli'
dict_gnss_freq = {
# band: f_center [MHz] f_sample [MHz] f_bw [MHz]
  'L1' : '1575.42             4         2.5 ',
  'L2' : '1227.60             4         2.5 ',
  'L5' : '1176.45            24        20.0 ',
  'L6' : '1278.75            12         8.75',
  'B1I': '1561.098           12         3.84',
  'B2I': '1207.140           12         3.84',
  'B3I': '1268.520           24        14.0 ',
  'E1' : '1575.42            24         3.84',
  'E6b': '1207.14            24        14.0 ',
  'G1' : '1602.00            12         2.5 ',
  'G2' : '1246.00            12         2.5 ',
  'G3' : '1202.025           24        20.0 ',
blade_bw = [1.5, 2.5, 2.75, 3, 3.84, 5, 5.5, 6, 7, 8.75, 10, 12, 14, 20, 28]

import datetime
import subprocess
import sys

if __name__ == '__main__':
    gnss_band   = 'L1'
    f_center, f_sample, f_bw = dict_gnss_freq[gnss_band].split()
    i = 1
    while i < len (sys.argv):
        if sys.argv[i] == '-band':
            i += 1
            gnss_band = argv[i]
            f_center, f_sample, f_bw = dict_gnss_freq[gnss_band].split()
    if float(f_bw) not in blade_bw:
        print ('The bandwidth {} should be either '.format(f_bw), end='')
        print (blade_bw)
        sys.exit ()
    dt_now = datetime.datetime.utcnow ()
    # file path example: L1_20211202_084700_4MHz_IQ.bin
    fn_bin = gnss_band + '_' + dt_now.strftime ('%Y%m%d_%H%M%S') \
           + '_' + f_sample + 'MHz_IQ.bin'
    # conf file name example: pocket_L1L2_8MHz.conf
    fn_conf = fn_blade + gnss_band + '_' + f_sample + 'MHz.conf'

    entry_conf = '''
set frequency  rx {fc}MHz
set bandwidth  rx {fb}MHz
set samplerate rx {fs}MHz
set agc rx off
set gain rx 60
set rxvga2 18
cal lms
cal dc rx
rx config format=bin n=400k file={fn}
rx start
rx wait
    '''.format (
            fc = f_center,
            fb = f_bw,
            fs = f_sample,
            fn = fn_bin).strip()
    print (entry_conf)
    with open (fn_conf, 'w') as fp:
        fp.write (entry_conf)
    ret = subprocess.run ([cmd_bladerf, '-s', fn_conf])
    if ret.returncode != 0:
        print ("bladeRF error")
        sys.exit (1)

    entry_readme = '''
File Path   : {fn}
Date Time   : {dt} UTC
Duration    : {td} ms
Conf File   : {conf}
Channel     : 1
F_LO        : {fc:.3f} MHz
F_ADC       : {fs:.3f} MHz
Sampling    : IQ
F_IF        : 0.0 MHz
BW_IF       : {fb:.1f} MHz
    '''.format (
            fn   = fn_bin,
            dt   = dt_now.strftime ('%Y-%m-%d %H:%M:%S'),
            td   = t_dur,
            conf = fn_conf,
            fc   = float (f_center),
            fs   = float (f_sample),
            fb   = float (f_bw)).strip()
    print (entry_readme)
    with open (fn_readme, 'a') as fp:
        fp.write (entry_readme)

Preparing GPSDO

I bought a GPSDO (GPS disciplined oscillator) to supply a stable clock to a software defined radio. One is the Hewlett-Packard (HP) Z3805A, which I bought a long time ago, and the other is the TM5301 I bought recently.


Z3805A fails the GPS rollover and shows a wrong date (2002-07-31). The serial port bitrate is 9,600 bit/s and :syst:stat? is HP’s SCPI command. The article on LeapSecond.com was very helpful for use the Z3805A.

------------------------------- Receiver Status -------------------------------

SYNCHRONIZATION ............................................. [ Outputs Valid ]
SmartClock Mode ___________________________   Reference Outputs _______________
>> Locked to GPS                              TFOM     3             FFOM     0
   Recovery                                   1PPS TI +7.9 ns relative to GPS
   Holdover                                   HOLD THR 1.000 us
   Power-up                                   Holdover Uncertainty ____________
                                              Predict  10.0 us/initial 24 hrs

ACQUISITION ............................................ [ GPS 1PPS CLK Valid ]
Satellite Status __________________________   Time ____________________________
Tracking: 6        Not Tracking: 0            GPS      10:03:41     31 Jul 2002
PRN  El  Az   SS                              1PPS CLK Synchronized to GPS Time
  1  33  48  113                              ANT DLY  0 ns
  3  62  73  160                              Position ________________________
  6  29 265   71                              MODE     Hold
 14  60 220  127
 17  56 332  144                              LAT      N  34:24:xx.xxx
 19  36 314  102                              LON      E 132:26:xx.xxx
ELEV MASK 15 deg                              HGT               +xx.xx m  (MSL)
HEALTH MONITOR ......................................................... [ OK ]
Self Test: OK    Int Pwr: OK   Oven Pwr: OK   OCXO: OK   EFC: OK   GPS Rcv: OK
scpi >

For TM5301, an NMEA message with a bit rate of 9,600 bit/s was displayed on the USB output. There was no NMEA message about the training status. The output seems to be stable.


I will continue to solve the problem that the signal observation is disturbed once every few seconds. It seems that trial and error is required for the firmware version of the software defined radio.

The day of retirement of the first quasi-zenith satellite, which has worked hard for a long time, is approaching. By then, I would like to achieve a commemorative signal recording.

Related article(s):