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.