How to generate a .wfm file?

I want to generate an LTE TM3.1a signal to evaluate the 256 QAM EVM performance of LimeSDR. I can generate the TM signal use the LTE tool in MATLAB. What should I do to process the mat file to the wfm file?

We use the same 16bit big endian format as Keysight signal generators.
Here is typical octave/matlab code.

% Assuming x is a vector of complex numbers (I + j Q,…) with max amplitude |1.0|
% convert to interleaved integer vector (I,Q,…) and binary write as big endian 16 bit signed integer
fwrite(fid, buf, ‘int16’, ‘ieee-be’ );

Hi Danny,
Thanks for your code.
Above all, I can get the normal 10Mhz FDD TM3.1 spectrum using the LTE_DL_TM31_20MHZ.wfm provided by Lime.
However, I can’t get a normal wfm file using your code in MATLAB. I first generate a TM3.1 20MHz FDD signal in the wireless waveform generator tool. Then I give the waveform in generated structure to your code and feed the wfm file to the WFM loader. After I change the same sample rate as the generator (30.72e6), the LimeSDR output spectrum is not what I wanted.

I also try the TM3.1 wfm file using in my 5182A generator, the spectrum seems wrong too.

Sorry for the wrong picture.

Can you double check that your Matlab object is a vector of complex numbers, and that the amplitude is <=1.0 using abs(max(x)). Please note the waveform will be invalid if abs(max(x))>1.0. I have double checked my code with simple SSB example and keysight MXG signal generator and spectrum analyser, all is correct. Here is the full example:
x=0.99exp(i(322pi/4096)(0:4095))+0.01; % clock 30.72MHz, SSB with DC 40dB down.
x(1:10) % view sample of complex number format
abs(max(x)) % display peak amplitude of waveform, should be <=1.0
fwrite(fid, buf, ‘int16’, ‘ieee-be’ );

Hi Danny,
Your SSB sample just work fine.
I’m checking my code.

Hi Danny,
I transpose the variable generated by the wireless signal generator tool and it works fine.
However, I found another issue. I can generator a 30.72Msps single tone signal and play it with the LimeSuiteGUI. When I try to generate a 61.44Msps signal, the signal can be loaded in LimeSuiteGUI, but the output spectrum is strange. There are many glitches spread all the spectrum. In the meanwhile, the LimeSDR can’t update the sample rate and output errors:

[16:06:34] WARNING: SetPllFrequency: error configuring phase
[16:06:34] ERROR: LML TX phase search FAIL

Have you tested a signal with a 61.44Msps sample rate? My settings are like this:

And I also tried settings like this:

Thank you very much for helping!

61.44MS/s is too fast for USB3 link. Our LimeSDR-QPCIe and LimeSDR-PCIe solutions allow 61.44MS/s MIMO if you need this at baseband (e.g. digital predistortion). Otherwise, make use of interpolation and decimation to up the DAC/ADC rates. On LMS7002M, DAC can go up to 640MS/s and ADC can go up to 160MS/s. So x8 interpolation would give you 245.76MS/s at DAC, and x4 decimation would give you 122.88MS/s at ADC, whilst your USB rate would still be 30.72MS/s.

Hi Danny,
I can understand the USB3 speed throttle, but the LimeSDR can properly used in 61.44MHz bandwidth in several SDR app like SDR console, gqrx. Do you have any idea why that happened?

Hi Danny,

What should I modify in your code to get a 40MHz occupied BW signal at 2.4GHz center Frequency. Right now its occupying 10 MHz? Sorry I am new to DSP world.

Hi Farhan, a ‘wfm’ file is simply a collection of IQ samples, and can be played back at any sample rate up to the max DAC frequency. To change the playback rate, you will need to change your CLKGEN frequency. You may also need to reduce your interpolation and decimation settings if these are faster than max ADC and DAC frequencies. I find it useful to have a frequency plan: CLKGEN, DAC, ADC, USB to help set up the various dividers on the 7002. So for your example, you could initially try this: CLKGEN=320MHz, DAC=160MS/s, ADC=80MS/s, USB=40MS/s. => HBI=4, HBD=2, CLK_OVH_OVL=2 (=> DAC=CLKGEN/2), ADC=CLKGEN/4. If you are using LimeSuite, don’t forget to press “tune” in CLKGEN tab afterwards to update all the clocks properly.

1 Like