I was trying out the AbstractSDRs.jl package with my LibreSDR and found that setting gain only affected the I samples while Q stayed close to 0. But it seems that the refillJuliaBufferRX implementation parses the IQ buffer incorrectly, which is a much worse problem. My monkey-patched version seems to be giving much better result. Below are two snapshots of IQs from center_freq=2.4 GHz and bandwidth=16 MHz.
From the repo:
With alternative refillJuliaBufferRX:
Compare to the waterfall from GNU Radio with PlutoSDR Source:

The GNU Radio output is definitely correct because I have working projects that rely on it and patching the refillJuliaBufferRX seems to be the solution.
Here is the version I used for producing the near-expected output with Julia:
function AdalmPluto.refillJuliaBufferRX(pluto::AdalmPluto.PlutoSDR)
nbytes = AdalmPluto.C_iio_buffer_refill(pluto.rx.buf.C_ptr)
if (nbytes < 0)
return nbytes;
end
# intermediary buffers from which complex values are computed
nbytes_i = AdalmPluto.C_iio_channel_read!(pluto.rx.iio.rx0_i, pluto.rx.buf.C_ptr, pluto.rx.buf.i_raw_samples)
nbytes_q = AdalmPluto.C_iio_channel_read!(pluto.rx.iio.rx0_q, pluto.rx.buf.C_ptr, pluto.rx.buf.q_raw_samples)
# find the appropriate types and their max values for normalization
bytes_per_value = pluto.rx.buf.C_step ÷ 2
_, type, _, type_norm = AdalmPluto.nbytesToType(bytes_per_value)
i_samples = reinterpret(type, pluto.rx.buf.i_raw_samples)
q_samples = reinterpret(type, pluto.rx.buf.q_raw_samples)
pluto.rx.buf.samples = complex.(Float32.(i_samples), Float32.(q_samples)) / Float32(type_norm)
pluto.rx.buf.nb_samples = (nbytes_i + nbytes_q) ÷ pluto.rx.buf.C_step
return pluto.rx.buf.nb_samples
end
I was trying out the AbstractSDRs.jl package with my LibreSDR and found that setting gain only affected the I samples while Q stayed close to 0. But it seems that the
refillJuliaBufferRXimplementation parses the IQ buffer incorrectly, which is a much worse problem. My monkey-patched version seems to be giving much better result. Below are two snapshots of IQs from center_freq=2.4 GHz and bandwidth=16 MHz.From the repo:
With alternative
refillJuliaBufferRX:Compare to the waterfall from GNU Radio with PlutoSDR Source:

The GNU Radio output is definitely correct because I have working projects that rely on it and patching the
refillJuliaBufferRXseems to be the solution.Here is the version I used for producing the near-expected output with Julia: