Does lms_lib.cpp for OAI support selecting the external clock on the LimeSDR?

Hi,

From other posts in the forum the Lime GUI allows LimeSDR users to change the clock source to use the external reference clock (REF_CLK_IN).

I am using a LimeSDR with an OAI eNodeB. Does anyone know if the OAI eNodeB flag --external-clock will tell the LimeSDR to use the external clock source.

As far as I can see this does not appear to be implemented in lms_li.cpp in OAI so the clock_source will not get passed to the LimeSDR but I was hoping someone knowledgeable would confirm this.

If I wanted to add this functionality, what API call do I use in lms_lib.cpp (LMS_xyz) ?

Thanks!

Hi @mitch, I honestly couldn’t say, but one of the folks in this thread may be able to confirm:

I just did that recently - sorry for the delay :slight_smile: In
openairinterface5g/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
which of course loads the ini and wipes everything out I supposed, so it has to go in late - I put it here:

printf("Set TX frequency %f MHz\n",device->openair0_cfg[0].tx_freq[0]/1e6);

/* this was commented out */
printf("Override antenna settings to: RX1_H, TXA_2\n");
LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 1);
LMS_SetAntenna(lms_device, LMS_CH_TX, 0, 2);
/* */

// use external
printf(“Setting external clock \n”);
LMS_SetClockFreq(lms_device, LMS_CLOCK_EXTREF, 10000000);

for (int i = 0; i< device->openair0_cfg->rx_num_channels; i++)
{
    if (LMS_SetLPFBW(lms_device,LMS_CH_RX,i,device->openair0_cfg->rx_bw)!=0)
        printf("RX ch:%d filter calibration failed, bw:%fMHz\n%s\n",i,device->openair0_cfg->rx_bw/1e6,LMS_GetLastErrorMessage());

and the green light now comes on always. I don’t know how to make it cmd line switchable right off.

The author also has a magic number to trim their on board oscillator that may not apply to everyone else - just comment this out if using an external clock - this is how it gets reset back to internal anyway:

LMS_VCTCXOWrite(lms_device,129);

what kind of VCTCXO did you use? any link to buy it? on volt, what is the power input of the external vctcxo of limesdr?

The internal VCTCXO is described here: https://wiki.myriadrf.org/LimeSDR-USB_hardware_description

For GPSDO / GPSTM 10MHz clock I got one of these from ebay - https://www.ebay.com/itm/NORTEL-TRIMBLE-ERICSSON-CDMA-METROCELL-METRO-CELL-NTGS50AA-GPSTM-GPS-RECEIVER/173199872900