LimeSuiteNG Support for C programs

I have a suite of C programs (such as LimeSDR BandViewer -

) that run on a Raspberry Pi 4 using LimeSuite. I am trying to migrate these programs to use LimeSuiteNG, but cannot find a C-compatible header file. Many of the header files referenced by “limesuiteng/limesuiteng.hpp” are only compatible with C++.

Migrating these complex programs to C++ is not an option. Do I have stick with legacy LimeSuite or is there a migration path to LimeSuiteNG for existing C programs?

Or am I missing something simple?

Thanks

Dave, G8GKQ

LimeSuiteNG provides backwards compatibility to the lime/LimeSuite.h C header, so you should be able just relink your code to the liblimesuiteng library, and it should work without any code changes necessary.
https://limesuiteng.myriadrf.org/development/migration/lms/changes

Hi @ricardas Thanks for getting back to me, sorry for the delayed reply - I had to rebuild as I had given up and reverted to the legacy LimeSuite.

I now have it working, but there are a few issues:

  • I had to use #include “/home/pi/LimeSuiteNG/src/include/lime/LimeSuite.h” as LimeSuite.h is not installed to /usr/local/include/limesuiteng/.

  • The call LMS_GetChipTemperature(device, 0, &Temperature); failed with a LimeSDR Mini V1.2 with the error message terminate called after throwing an instance of 'std::logic_error' what(): LimeSDR-Mini v1 doesn't have a temperature sensor This call works and returns a sensible temperature in legacy LimeSuite.

  • The call LMS_GetDeviceInfo(device); returns a gateware version of v1 whereas legacy LimeSuite returns v1.30 with the same hardware.

  • Lastly, a comment for anyone else using c and migrating to LimeSuiteNG, the makefile libflags needs to be -llimesuiteng , all lower case, not CamelCase as was required by legacy LimeSuite.

I hope that you don’t think that I am being too critical at this early stage, but it would be good if you were able to document (or fix) some of these points.

I’ll add any more issues that I find to this topic.

Thanks again

Dave

1 Like

Not at all and thanks for the feedback, this is really helpful.

A few more (minor) observations:

  • During compile with gcc (Debian 12.2.0-14) 12.2.0 on a Raspberry Pi 4, I get this warning:
In file included from lime.c:13:
/home/pi/LimeSuiteNG/src/include/lime/LimeSuite.h:785:69: warning: ‘struct LMS7002MCSR’ declared inside parameter list will not be visible outside of this definition or declaration
  785 | API_EXPORT int CALL_CONV LMS_ReadParam(lms_device_t* device, struct LMS7002MCSR param, uint16_t* val);
      |                                                                     ^~~~~~~~~~~
/home/pi/LimeSuiteNG/src/include/lime/LimeSuite.h:796:70: warning: ‘struct LMS7002MCSR’ declared inside parameter list will not be visible outside of this definition or declaration
  796 | API_EXPORT int CALL_CONV LMS_WriteParam(lms_device_t* device, struct LMS7002MCSR param, uint16_t val);
      |                                                                      ^~~~~~~~~~~

  • The command n = LMS_GetDeviceList(list) gives a warning of:
ls: cannot access '/sys/class/litepcie': No such file or directory

  • LMS_Open(&device, list[0], NULL) also gives the same warinng:
ls: cannot access '/sys/class/litepcie': No such file or directory
  • LMS_GetDeviceInfo(device) returns 0x0000000000000000 for the device_info->boardSerialNumber

Nothing serious here - my application works!

Thanks

Dave

Today I have been trying to get transmit to work, but without any success. I recompiled the programs that I use with legacy LimeSuite and got them to the stage where they would run, but have ended up with no RF output and no error messages,

So, I tried with the example basicTX program compiled during LimeSuiteNG install. That does not appear to work with a LimeSDR Mini (V1) either:

pi@raspberrypi:~/LimeSuiteNG/build/bin/examples $ ./basicTX
Devices found :
0: LimeSDR Mini, media=USB 3.0, addr=0403:601f, serial=1D4C2CAE8C28A4

terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)
Aborted

Grateful for any pointers as to what might be causing this.

(LimeSuite NG commit 752ffea, Raspberry Pi OS Debian bookworm lite, 64 bit)

Dave, G8GKQ

My bad, the exception in the example was caused by bad device index. FIxed it.
Thanks for the feedback. I’ve added the legacy headers installation, and fixed the Mini board regressions.

Thanks @ricardas

I now have the basicTX program running and also see that the header location, temperature and gateware version fixes work.

Now to try to make it generate DVB-S2!

Dave

I’m finding a number of issues with the TX side of the legacy LimeSuite support. The first is Antenna selection. I have not yet succeeded in switching to the correct TX antenna path for a LimeSDR Mini at 437 MHz.

One issue is that LMS_GetAntennaList(device, is_tx, channel, list) returns the following:

i = 0, Antenna = NONE
i = 1, Antenna = Band1
i = 2, Antenna = Band2
i = 3, Antenna = Auto

Whereas legacy LimeSuite returns

i = 0, Antenna = NONE
i = 1, Antenna = BAND1
i = 2, Antenna = BAND2
i = 3, Antenna = Auto

So text matches against antenna bands fail.

However, even by setting the antenna manually to 0, 1, 2 or 3, I see no difference in the (very low) output power. I am sure that the antenna selection is not working.

A lesser problem is that in legacy LimeSuite, LMS_GetAntennaList(device, is_tx, channel, NULL) would return the number of available antenna options. In LimeSuiteNG it terminates the program.

I will reply separately on other issues.

Dave, G8GKQ

The next issue is that FIR filtering does not seem to work.

DVB-S2 signals which would usually have a square spectrum shape have a sinx/x spectrum shape as though no filtering is applied. The spectrum does generate a valid DVB-S2 decode, but is totally unsuitable for transmission.

Attempts to use oversampling and introduce a custom filter using
LMS_SetGFIR(device, LMS_CH_TX, 0, LMS_GFIR3, true)
result in no RF output at all. I have checked that the correct coefficients are being applied through
LMS_SetGFIRCoeff(device, LMS_CH_TX, 0, LMS_GFIR3, xcoeffs, 119)
by using
LMS_GetGFIRCoeff(device, LMS_CH_TX, 0, LMS_GFIR3, xcoeffsout)
to read them out.

The exact same code works with legacy LimeSuite on the same platform (Raspberry Pi 4 64-bit bookworm) perfectly.

Dave, G8GKQ

Hi Dave,

Thanks for reporting these. I’m sure @ricardas will take a look, but also where something clearly looks like a bug, feel free to raise an issue on the tracker: