JuliaTelecom / SoapySDR.jl

Julia Wrappers for SoapySDR
https://juliatelecom.github.io/SoapySDR.jl/dev/
Other
14 stars 3 forks source link

Fragment issues with multiple buffers #34

Closed sjkelly closed 1 year ago

sjkelly commented 2 years ago

With the highlevel_loopback.jl example, some devices with a packet interface such as the USRP fail to produce the expected result when using multiple buffers. This seems to be addressed by using a single large buffer.

cc @mbaz who reported.

sjkelly commented 2 years ago

Note that there is a SOAPY_SDR_MORE_FRAGMENTS flag that is set in USRP: https://github.com/pothosware/SoapyUHD/blob/26b48cc11d3072b03b21793d980887a2e00091c8/SoapyUHDDevice.cpp#L292

It may be good to check this as well and modify our read loop accordingly.

mbaz commented 2 years ago

This is the result of a test where three blocks are looped back, using highlevel_loopback.jl. Each block is 10 ms and 10,000 samples long; sampling frequency is 1 MHz. The first and last blocks are all zeros, while the middle one is a sine wave. The plot is zoomed into the sine wave block: image Note that the sine wave lasts less than expected: it starts at sample 11,400 and ends at sample 19,200. Moreover, there is a glitch at sample 21,400, where the block should have ended.

If, instead of writeing three blocks, first one large block is built in Julia and then it is sent once to SoapySDR, then the sine wave has the expected duration, and there are no glitches.

Test code here: https://gist.github.com/mbaz/3f2edfcc5d33412f02dd145cd8b571a1

sjkelly commented 2 years ago

Note: the USRP drivers have been updated in Julia. This issue was specifically mentioned in the UHD patch notes. Hopefully this is now fixed

mbaz commented 1 year ago

Since the LFSR RF loopback is working, I think we can close this and re-open if the problem resurfaces.