How to decode IQIQ saved file from BladeRF

Discussions related to modulation techniques, filtering, error correction and detection, wireless link layer implementations, etc

Moderator: robert.ghilduta

Post Reply
Posts: 1
Joined: Thu Feb 14, 2019 10:36 am

How to decode IQIQ saved file from BladeRF

Post by markkrukar »


I am receiving a *.dat file with 2 separate signals saved from 2 separate antennas. ... sp=sharing

I built a script based on nuand GitHub tools.
python ...
matlab ... _sc16q11.m

I assumed that since file size from 2 antennas signals is twice as big as file produced by only one channel.
Based on that I assumed that the IQ signal from one channel occupies 4 bytes so from 2 channels will occupy 8 bytes saving consecutively IQIQ signal. Which would be 4bytes IQ first channel + 4bytes IQ second channel.

So I extended the python script from this:
for i in range(0, len(data), 4):
sig_i, = struct.unpack('<h', data[i:i+2])
sig_q, = struct.unpack('<h', data[i+2:i+4])
csvwriter.writerow( [sig_i, sig_q] )

to this:

for i in range(0, len(data), 8):
sig_i1, = struct.unpack('<h', data[i:i+2])
sig_q1, = struct.unpack('<h', data[i+2:i+4])
sig_i2, = struct.unpack('<h', data[i+4 :i+6])
sig_q2, = struct.unpack('<h', data[i+6:i+8])
csvwriter.writerow( [sig_i1, sig_q1, sig_i2, sig_q2)

Here is how the signal looks when I decoded it using my simple method

At the visual inspection, divided this way signals look correct. However, my colleague revied the script and informed me that the signal in the resulting *.bin is represented differently.

My question is how to recover the two separate signals IQ - antenna1 and IQ antenna 2 from the *.bin file. It is very important to separate both signals because they carry different pieces of information. The signals occupy the same frequency but are recorded simultaneously from 2 different sources.

Matlab, python, gnu radio, tutorial, any materials would help. It looks to me that this is a common problem but I couldn't find any definitive answers online.

Here is the configuration from BladeRF 2.0 Micro A4 I received.

Bias Tee (RX1): on
Bias Tee (RX2): on

RX1 Frequency: 1575419998 Hz (Range: [70000000, 6000000000])
RX2 Frequency: 1575419998 Hz (Range: [70000000, 6000000000])

RX1 Bandwidth: 5000000 Hz (Range: [200000, 56000000])
RX2 Bandwidth: 5000000 Hz (Range: [200000, 56000000])

Setting RX1 sample rate - req: 8000000 0/1Hz, actual: 8000000 0/1Hz
Setting RX2 sample rate - req: 8000000 0/1Hz, actual: 8000000 0/1Hz

State: Running
Channels: RX1
Last error: None
File: /home/sam/Desktop/GPS_IQ_recorded_data_1ch(SR8M_BW5M).bin
File format: SC16 Q11, Binary
# Samples: 503316480
# Buffers: 32
# Samples per buffer: 32768
# Transfers: 16
Timeout (ms): 1000
Post Reply