I am using iio-oscilloscope to do loopback sample capture. I have created a custom profile using
matlab profile generator for ad9371. Please find the profile here.
I load this profile and use a .mat data file generated for transmission.
However I think the packets are not transmitted properly since I have intentionally created zeros and power variations within the transmit samples which I cannot see in the loopback captured samples.
Could you please let me know if I have to follow any format while loading/generating mat files? Should the number of samples be a function of transmit/receive sample rate?
I have seen the instructions here
however sometimes when I load the .mat file the osc crashes. So I think I am missing something more than what is described in the above link.
Thanks and Regards
Provide data in your .MAT file as one vector per channel. If OSC is crashing you might be loading data that is too large. Generally, you should not exceed 2^20 samples per channel. This is the default DMA/CMU limit. Number of samples has no relation to the sample rate.
So if I wanted to transmit only on TX1, my mat file will be a matrix of 2 columns and N rows, where N is the sample size, where each column corresponds to I and Q respectively?
Can I also transmit a complex vecor instead, in which case the mat file will be 1 column and N rows?
Also does capturing M time domain samples in iio oscilloscope ensure that these M samples are continuous?That is there is no sample drop in between?
Thanks in advance
Yes for the transceivers successive vectors will be mapped to I and Q.
Yes complex is supported.
A capture is contiguous but not successive captures.
I transmit a symmetric preamble(digital samples in which first K1 samples are identical to next K2 samples), receive them and then perform a correlation(schmidl cox algorithm for timing synchronisation) to detect the preamble all within a single capture.
What I notice is that the received peaks are more frequent than the transmit peaks. I am not sure why this happens. Do you have any idea on what could go wrong?
I would verify the hardware is running at the desired rates and the signal bandwidth is as expected.
You could also verify this in the data by resampling it (by probably 2 or 1/2) and check your successive peak distances.
Is there a way to verify if the hardware is running at the desired rates? I use the AD9371 reference design without any modification
The custom profile that I use has tx and rx sampling rates to be same. I upsample the transmit signal by a factor of 3 to ensure that the RF signal bandwidth is within the filter bandwidths.
I had checked the signal bandwidth and it is as expected.
You can read out the rates manually from the IIO attributes: https://wiki.analog.com/resources/tools-software/linux-drivers/iio-transceiver/ad9371
Are you upsampling before you transmit?
I have read out the rates manually as mentioned in that link. They are as expected.
The data in the .mat file is already upsampled by a factor of 3.
Is there any code or test setup to do a sanity check on the loopback samples obtained using iio oscilloscope, then I could give that a try to figure out where the problem is (Hardware or in my programs)
Simplest thing is to transmit a sinewave generated in MATLAB and check if it appears at the desired frequency at the receiver.
Are you downsampling at the receiver?
I tried generating a 1MHz tone but loading this to iio oscilloscope fails. It says "Unable to create buffer due to sample size and number of samples". Please find attached the screenshot.
The mat file is a single column vector with complex samples.
Is there any recommended way to share the mat file, because I cant attach this here.re.
Fixed the above issue. When I generate a sinewave with 10001 samples the error occurs, whereas if the sinewave size is 10000 samples there is no error and it loads correctly. Is this a known issue?
Now I see something interesting in the received samples. The spectrum is at 1 MHz, so there is no rate mismatch, however there are discontinuities in the received time domain waveform. I would expect discontinuities at every 10000 samples since that is the transmit data size. However I see discontinuity at approximately every 1500 samples. PFA the images. The left side plot is transmit data and right side plot is captured data. I see the discontinuity in iio scope also, but used matlab to plot since I can plot tx and rx side by side.
I dont know why this is happening. I am suspecting some samples are getting dropped. Could you please help me fix this.
It may be an issue with the discontinuity when IIO tries to play the signal continuously. (like a circular buffer)
Can you generate Tone in Matlab for exactly one cycle or multiple cycles and load in IIO? The samples created should have exact 1 cycle or multiple cycles but not the discontinuity.