Close

Control LimeSDR Tx Gains using Arduino Due and Analogue Slider

A project log for Cell Phone 4G LTE Repeater / Booster / Femtocell

An outside pole mounted aerial picks up 4G signals which are then filtered, amplified and re-transmitted through a second inside aerial.

capt-flatus-oflahertyCapt. Flatus O'Flaherty ☠ 07/03/2017 at 17:081 Comment

Please remember that this project has split into two - I'm exploring 2 possible solutions to the same problem, one using discrete components ie ICs and passives and the other a fully blown transceiver with built in FPGA - the LimeSDR.

So here I'm looking at option 2 - Using the LimeSDR.

The advantage of the Lime is that all the discrete components are located in one chip, the LimeLMS7002M, with an amazing array of registers that can be controlled using the SPI bus. As an example, register address 0x0100 can be set to a value of 0x7A94 to give a gains of 15 dB on the Tx pad. There's also a massive FPGA chip that has enough spare silicon inside to house a fairly powerful onboard Arduino (Work in progress) and even some basic signal processing.

Here, the limeSDR is programmed with a special FPGA configuration file: FILE and, when 'normal' operation is required, is programmed back with this, somewhat out of date, file: FILE. The Arduino Due is programmed with this file: FILE.

The main obstacle to success with this small step forward was getting the Arduino to replicate what I had previously achieved with the Limesuite software about a month ago. In theory, I should just be able to harvest all the register settings from Limesuite and copy and paste them into the Arduino program but ...... for a long while ...... No success. Eventually I narrowed it down to the fact that there is one particularly clever register that switches all subsequent register read/writes from one channel to the other ..... Confusing? Actually, the Lime LMS7002M datasheet explains it quite clearly and since I had already read the datasheet 5 times, it was no great surprise!

LMS7002M_WR(0x0020, 0xFFFD);  //This register sets the following registers back to Read and Write Channel A only:

Other than that there is a register to describe the DC correction, which is pretty essential:

LMS7002M_WR(0x0204, 0xF020); // DC Correction.

This code reads the slider value and spits out hex integers that the LMS7002M will recognise:

   int sliderValue = analogRead(A0);
   sliderValue = sliderValue/0x21;
   int gainValue = 0x7800 + sliderValue * 0x42;

And here is the nice simple SPI write:

// Write register value to LMS7002M via SPI
void LMS7002M_WR(int addr, int val)
{
  digitalWrite(LMS7_SS_Pin, LOW);
  SPI.transfer( ((addr >> 8) | 0x80) );
  SPI.transfer( (addr & 0xFF) );
  SPI.transfer( ((val >> 8) & 0xFF) );
  SPI.transfer( (val & 0xFF) );
  digitalWrite(LMS7_SS_Pin, HIGH);
}

Oh, there's also a spreadsheet HERE for converting the Limesuite register list to an Arduino 'register function list'. It does character analysis/manipulation to change everything in column 'A' to column 'F':Having a gain control slider on a 4G signal booster is pretty essential as the base station signal can vary in strength quite a bit depending on local weather conditions and, of course, we don't want too much gain or else we could get feedback between the local Rx and Tx antennae. Looking at some of the 'Black Box. signal boosters in the market place, I can't understand why they don't have a simple manual gain control so that systems can be tweaked to individual antennae setups. Actually, I think that some of them do 'appear' to have gain control, but actually it is fake!

Anyway, If the isolation between antennae can be made really high by, for example, separating them by 100m, then the gain could be turned up and greater coverage could be obtained. But ..... 100m ..... That's a lot of cable and probably a substantial antenna installation.

Especially for Ebrahim Bushehri, here's video of the Arduino Due controlling the LimeSDR Tx gain:

Discussions

random13 wrote 10/08/2017 at 12:55 point

@TegwynTwmffat what did you write on channel A register ? for example LMS7002M_WR(0x0021, 0x0E9F); what are you writing at address 0x0021 did you replicate limesuit default configuration value on channel registers? , LMS7002M_WR(0x0101,gainValue)   0x0101 address is always a fix address in limesdr for Gain? 

  Are you sure? yes | no