[hpsdr] Question about I and Q position in protocol
John Marvin
jm-hpsdr at themarvins.org
Mon Dec 3 13:40:53 PST 2012
So I've been trying to play around with direct access to the Hermes
data, but I wasn't getting the data I expected. I spent some time
trying to figure out what was going on, but eventually decided to create
a test file with samples in HPSDR protocol order and then inject them
into PowerSDR to help visualize what was going on (I just opened the
file and substituted the samples coming from Hermes with the samples
from my file in a loop). I created the test file by taking 4 songs,
band limiting them to 6 Khz mono and putting them in a -48 to 48 Khz
range using libfftw. If everything worked as I expected I would have got
each song in order from left to right, each in a 6Khz range with a 6 Khz
blank range between them. Instead what I got was everything backwards.
Luckily it was easy to verify that, since LSB reads everything
backwards. I must admit I spent close to an hour just playing around in
PowerSDR with the sub receiver feature and listening to my four songs.
Part of that was just listening to the four songs I happened to choose,
since they were old favorites I hadn't listened to in a long time;
however, there was something strangely fascinating about using PowerSDR
to switch between four (low quality) songs by changing VFO frequencies.
Here's a screen capture for those who are curious:
http://www.themarvins.org/hpsdr/foursongs.jpg
So, the answer appeared simple. Somewhere I must have switched I and Q.
But I couldn't find where I had gone wrong. So I eventually tried
tracking the source in PowerSDR, from where samples were received from
Hermes until they were made into complex samples. I finally wound up in
process_samples() in DttSP/sdr.c, where I found the following code:
CXBimag (rx[thread][k].buf.i, i) =
bufl[i], CXBreal (rx[thread][k].buf.i, i) = bufr[i];
I have carefully followed the path and believe that bufl was the "left"
sample from Hermes and bufr was the "right" sample from Hermes, and here
the code is assigning the left sample to the imaginary component and the
right sample to the real component. The protocol document indicates
that left is the I (in phase or real) sample and right is the Q
(quadrature out of phase or imaginary) sample. So, am I missing
something, or should the I and Q positions be switched in the protocol
document?
Thanks,
John
More information about the Hpsdr
mailing list