Problems with TX using C# and LMS API

I’m writing a 64-bit C# application making calls to a 64-bit version of LimeSuite.dll. I’m trying to transmit some signal using Lime SDR Mini. I’m using latest releases of both LimeSuite library and Lime SDR Mini firmware.

I tried to follow three examples:

I reproduced them in C# making same API calls in same order with same parameters, but couldn’t get them to work.

Each time I call LMS_Calibrate(…) I get the following error:

Tx Calibration: MCU error 3 (SXR tune failed)

In the last example no calibration is performed, but then each call to LMS_SendStream(…) returns -1 and I can’t retrieve any error message.

The Lime SDR Mini board works fine with all other software, it is just my application which fails. What am I doing wrong?


When I select the TX frequency below 1375MHz, TX Calibration succeeds. Trying to calibrate any TX frequency above 1375MHz fails. I need to transmit on 1575.42MHz.

Anyway, even when using lower frequency (e.g. 1000MHz) every single call to LMS_SendStream(…) returns -1 with no error message.

This is what I do (I stripped out all error checks, etc.):

int txChannel = 1;
int frequency = 1575420000;
int sampleRate = 5000000;
int bandwidth = 5000000;

LMS_Open(out IntPtr device, null, null);
LMS_EnableChannel(device, txDirection, txChannel, true)
LMS_SetNormalizedGain(device, txDirection, txChannel, 1.0);
LMS_SetLOFrequency(device, txDirection, txChannel, frequency);
LMS_SetSampleRate(device, sampleRate, 0u);
LMS_Calibrate(device, txDirection, txChannel, bandwidth, 0u);

LmsStream txStream = new LmsStream
    IsTx = true,
    Channel = txChannel,
    FifoSize = 256u * 1024u,
    ThroughputVsLatency = 0.5f,
    DataFormat = DataFormat.F32,
IntPtr txStreamHandle = Marshal.AllocHGlobal(Marshal.SizeOf(txStream));
Marshal.StructureToPtr(txStream, txStreamHandle, false);
LMS_SetupStream(device, txStreamHandle);

//some loop
    LMS_SendStream(txStreamHandle, floatsPointer, sampleCount, IntPtr.Zero, 1000);

You also must set gain for receiver.

Didn’t help…

If I have a good understanding of LMS_Calibrate function you need both RX and TX side configured and enabled in order to internally loop TX to RX. Setting normalized gain is not enough, you must twiddle with LNA, PGA and TIA gain on RX side. Also TX channel on Mini should be 0 because only one RX and TX with two antennas (RXH=1 and RXW=3 on RX side, TX1=1 and TX2=2 on TX side, txChannel=0).
Tested on my app and working on 2.3GHz (13cm band) but not yet on 3.4GHz (9cm band).

Is there any working example anywhere? The examples I published in my first message don’t have the stuff you mentioned.

I now use txChannel 0, set up also the RX channel, use first available antennas for RX and TX. What should be the values of LNA, PGA and TIA gain? I tried using defaults from the PowerSDR project (LNA=15, PGA=11, TIA=3), but I end up with the same error “MCU error 3 (SXR tune failed)” when performing either RX or TX calibration.

I’m still working on my C# TX code. Use SDR# plugin code for RX example and simple add TX part: