Forum

RTSA Suite PRO Release v2.2

Please or Register to create posts and topics.

How to import simple binary third party IQ files e.g. from HackRF?

I am using HackRF which generates simple binary files with 8 bit signed integer I and Q values. For those files we need to add the frequency and sample rate since they are not stored within the data file. How can i load those I/Q files to the SPECTRAN V6 IQ Vector Signal Generator or to the RTSA-Suite PRO software?

We are already supporting various IQ file formats e.g. .wav or .iq.tar but to support any I/Q data format we are simply adding an import script where you can setup the I/Q data format as needed.

This script can then import and stream the I/Q data directly into the SPECTRAN V6 signal generator or you can load it into the RTSA-Suite PRO where you could even save it to our own data format.

In this demo the I/Q file is named test.SDR located in c: (const FileName = "c:/test.SDR";):

import { File } from "fs.js"
import { DSPStream } from "dspstream.js"

const TimeDelay = 40.0e-3;
const SampleRate = 10.0e6;
const CenterFrequency = 2.42e9;
const FileName = "c:/test.SDR";

var StreamTimer; // Precise stream timer

// Sleep for a given number of milliseconds with a promise
function sleep(ms) {return new Promise(done => {setTimeout(done, ms);})}

// Play a raw IQ file
async function playFile(fname) {

// Open file
let file = await File.open(fname);

// Set start time for playback some milliseconds in the future
let startTime = StreamTimer() + TimeDelay;

let buffer;

// read file data in 16k chunks until completion
while ((buffer = await file.read(16384)).byteLength > 0) {

// Get the IQ data and scale it into a range of -1.0 to +1.0
let ba = new Int8Array(buffer);
let bf = IQ.mul(ba, 1.0/128.0);

// Current stream time
let streamTime = StreamTimer();

// Wait before sending, if too far in the future
if (startTime - streamTime > TimeDelay)
await sleep(1000 * (startTime - streamTime - TimeDelay));

// Calculate end time of packet based on start time, sample rate and number of samples
let endTime = startTime + ba.length / 2 / SampleRate;

// prepare the data packet
let packet = {
payload: "iq",
startFrequency: CenterFrequency - 0.5 * SampleRate,
endFrequency: CenterFrequency + 0.5 * SampleRate,
stepFrequency: SampleRate,
startTime: startTime,
endTime: endTime,
minValue: -2,
maxValue: 2,
samples: bf
};

// send the packet to output 0
DSPStream.sendPacket(0, packet);

// advanve time
startTime = endTime;
}

}

async function main() {

// get a stream timer
StreamTimer = await DSPStream.streamTimer();

playFile(FileName);

}

 

The attached mission will stream the HackRF IQ file to the SPECTRAN V6 Vector Signal Generator and at the same time will monitor the band to ckeck if the data file is transmitted correctly:

HackRF IQ File Import

 

The complete mission would look like attached:

Import HackRF IQ Data to the Vector Signal Generator

Uploaded files: