Tutorial : Software based on the SDR4All DLL to send training sequences

From Tools4SDR

Jump to: navigation, search
Tools: Software to generate digital communication signals
Linear modulations: training sequences transmission
Linear modulations: Image transmission

This page is a tutorial about the creation of a sofware based on the SDR4All DLL that sends in a continuous way training sequences. It can either be used as a basis to develop your own software based on the DLL, or to generate signals that can then be handled with Matlab or with another program based on the DLL.

This software has been programmed in C# and with Visual Studio express which can be downloaded here.

Contents

Code source and install script downloading

  • The code source of the solution is available for downloading here.
  • The install script is available here.

General presentation of the software

The software has the following interface:

If the serial number of the USRP is not printed, it is probably because the software is performing a firmware upgrade of the USRP. Click on the update button to make it appear.

The training sequence symbols has to be provided to the software with a filename.

This filename can be generated and read with matlab:

Generating the training sequence filename with Matlab

The following script is used to generate the training sequence file:

% QPSK constellation
u=0:3;
QPSK_Symb = [1+i 1-i -1+i -1-i];
Symb_Training = QPSK_Symb(floor(4*rand(200,1))+1);
fid = fopen('SeqQPSK.dat','w');
for (iSymb_QPSK=1:length(Symb_Training))
   fwrite(fid,real(Symb_Training(iSymb_QPSK)),'float'); 
   fwrite(fid,imag(Symb_Training(iSymb_QPSK)),'float'); 
end
fclose(fid); 

Reading the training sequence filename with Matlab

The following script can be used to read the training sequence with Matlab:

fid = fopen(filename,'r');
a = fread(fid,'float');
Appr_Seq = a(1:2:end)+i*a(2:2:end);
fclose(fid);

Which signal is sent ?

The sent signal has the following form:

Is it a succession of training sequences repeated several times, and silent periods.


How does it work ?

This software performs mainly two tasks:

  • Generate the signal to transmit
  • Send the signal

These tasks are detailled in the following:

Generation of the signal to transmit

The generation of the signal to transmit is done with a provided library linearmodulation.cs. It is used in the software as following:

LinearModulation = new BurstsOfTrainingSequences(); 
LinearModulation.LoadTrainingSequence(textBox3.Text,System.Convert.ToInt16(textBox2.Text));
LinearModulation.ApplyShapingFilter();
LinearModulation.FormatDataForTransmission();

It generates the data array LinearModulation.ByteToSend[BufferToSend] which is then transmitted to the USRP.

The signal generated is a linearly modulated sequence of the training symbols. It is shaped with a squared raised cosine with excess bandwith 0.22. The oversampling factor the 5, which means that the baudrate of the signal is 1/5 of the signal bandwidth.

Sending the signal

The signal is sent with the same process as the one used for the TX_bursts software.

1. Configuration of the USRP:

MySDR4All.ChangeTXGain(20);
Thread.Sleep(50);
MySDR4All.ChangeTXFreq(System.Convert.ToDouble(textBox1.Text) * 1e6);
Thread.Sleep(50);
switch (comboBox1.SelectedIndex)
{
  case 0: MySDR4All.ChangeInterpRate(256);break;
  case 1: MySDR4All.ChangeInterpRate(128);break;
  case 2: MySDR4All.ChangeInterpRate(64);break;
  case 3: MySDR4All.ChangeInterpRate(32);break;
}
Thread.Sleep(50);

2. Using a thread to performs the transmission

SendDataThread = new Thread(SendLoop);
SendDataThread.Priority = ThreadPriority.Highest;
SendDataThread.Start();

Where SendLoop is a function that performs the sending of the data to the USRP. It works as follows:

public void SendLoop()
{
  int BufferToSend = 0;
  while (true)
  {
    MySDR4All.TXOnce(LinearModulation.ByteToSend[BufferToSend]);
    BufferToSend++;
    if (BufferToSend == LinearModulation.ByteToSend.Length)
    {
      BufferToSend = 0;
    }
  }
}
Personal tools
Software defined radio