MATLAB Answers

Zynq SDR: sustained transfer of data from picozed?

1 view (last 30 days)
WLT
WLT on 7 Apr 2017
Answered: Neil MacEwen on 20 Apr 2017
Has anyone managed to achieve sustained data transfer from the picozed to a host PC without dropping frames? I followed the example by using a frame size of 3660 to 500000 but was never able to get data from the picozed for more than 0.1 or 0.2 of a second. Anything after that will return datalength of 0 when I run the step function repeatedly. Using the same way, I was able to transfer a few MHz of int16 continuously for the USRP N210 but not the picozed.
rx=sdrrx('PicoZed SDR', 'Gain Source', 'manual', 'Gain', 71, 'BasebandSampleRate', 2e6, 'SamplesPerFrame', 3660*100);
Log = dsp.SignalSink;
for seconds=1:5
for counter=1:round(2e6/3600/100)
[data datalength lostsample]=step(rx);
if lostsample~=1
if datalength==rx.SamplesPerFrame
step(Log,data);
else
disp(['datalength = ' num2str(datalength)]);
end
else
disp('data lost');
end
end
end

Answers (1)

Neil MacEwen
Neil MacEwen on 20 Apr 2017
Hi,
The N210 and PicoZed SDR are based on different infrastructure, so may behave in different ways. For the PicoZed SDR, the reception of data is non-blocking, which means dataLength may return 0, but no samples have been dropped. The lost samples output is what you should use to verify no samples have been dropped. The code below may help you get better results.
SamplingRate = 2e6;
SamplesPerFrame = 3660*100;
NoSecondsToLog = 5;
rx=sdrrx('PicoZed SDR', 'GainSource', 'manual', 'Gain', 71, 'BasebandSampleRate', SamplingRate, 'SamplesPerFrame', SamplesPerFrame);
Log = dsp.SignalSink;
NoSamplesDesired = NoSecondsToLog*SamplingRate;
NoFramesDesired = ceil(NoSamplesDesired/SamplesPerFrame);
frameCounter = 0;
while (frameCounter < NoFramesDesired)
datalength = 0;
while datalength == 0
[data, datalength, lostsample] = rx();
if lostsample == 1
disp('data lost');
else
if datalength==SamplesPerFrame
Log(data);
disp('ok');
else
disp(['datalength = ' num2str(datalength)]);
end
end
end
frameCounter = frameCounter + 1;
end
release(rx);
Note that you can also use burst mode to capture guaranteed contiguous samples. I would recommend using burst mode for this use case.
Kind regards,
Neil

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by