Mixing APIs


In the same process, I’m trying to use API calls from both LimeSuite LMS_ and lime:LMS7002M – @joshblum @IgnasJ is this possible? The reason why is that there are no functions to set the amplifiers gain levels individually (LNA, TIA, PGA) in the LMS API, but there are in in the LMS7002M functions. And there are functions in the LMS APi, (e.g. SetAntenna and GetAntenna), that don’t exist in the LMS7002M one.
After I set up the device using the examples approach and then instantiate a lime:LMS7002M object, setting any gain level doesn’t change the gain as reported by LMS::GetGaindB and observing streaming results.

lms_device_t* device = NULL;   
LMS_Open(&device, list[0], NULL);

uint16_t lna = 13; //15 = Gmax, 13 = Gmax -2
uint16_t pga = 0;
uint16_t tia = 1; //3= Gmax, 1 = Gmax-12
unsigned int gain;
printf("gain 1 %d (dB)\n",gain);
//the below calls work, but are commented out to test the LMS7002 calls.
//int result = LMS_WriteParam(device,LMS7param(G_LNA_RFE),lna);
//result = LMS_WriteParam(device,LMS7param(G_TIA_RFE),tia);
//result = LMS_WriteParam(device,LMS7param(G_PGA_RBB),pga);

//try the other API
lime::LMS7002M lms;

float pga_dba = lms.GetRBBPGA_dB();
printf("LMS7002M GetRBBPGA_dB %.1f\n",pga_dba);
printf("LMS7002M GetRFELNA_db %.1f\n",lms.GetRFELNA_dB());
printf("gain 2 %d (dB)\n",gain);


gain 1 70 (dB)
LMS7002M GetRBBPGA_dB -12.0
LMS7002M GetRFELNA_db 27.0
gain 2 70 (dB)

Clearly those did not work, at least with how the device is being driven.


Whats wrong with using these calls?

it did not work because lime::LMS7002M object is not connected to hardware. I guess you could get LMS7002M object that is used by ‘device’ or get connection object from ‘device’ and pass it to your LMS7002M but using LMS_WriteParam() seems much simpler.

Nothing is wrong with the calls per se. But I sought to avoid register writing and in this case you can’t directly write dB values, so there are opportunities for error. Since the amplification occurs in 3 different stages, I expected high level LMS call for each, so that one could, for example, try to control intermodulation. I do see that the TIA amplification level is set to minimum for gain requests <= 39 in the SetGain RX section.

Thank you for the device connection advice. I had hoped that just instantiating the object would magically set up connection, but the ConnectionRegistry is built around the idea that you must choose a device among potentially more than one.