Lately, I tried to read some signals with LimeSDR, but had some uncertainties about Bandwidth. When I use the setBandwidth function in code and set it to a value not equal to half sampling frequency is not really working.
My question is the following: if Bandwidth is not provided, will it always take fs/2 and if provided, is it usually works with a given value? Also, it will be great to know what exactly does setting BW do inside Lime.
I have LimeSDR USB.
Use the source Luke, use the source!
setBandwidth is to be found:
void SoapyLMS7::setBandwidth(const int direction, const size_t channel, const double bw) <=> https://github.com/myriadrf/LimeSuite/blob/master/SoapyLMS7/Settings.cpp#L543
Which calls setBBLPF which is to to be found:
int SoapyLMS7::setBBLPF(bool direction, size_t channel, double bw) <=> https://github.com/myriadrf/LimeSuite/blob/master/SoapyLMS7/Settings.cpp#L522
Which calls SetLPF which is to to be found:
int LMS7_Device::SetLPF(bool tx,unsigned chan, bool en, double bandwidth) <=> https://github.com/myriadrf/LimeSuite/blob/master/src/API/lms7_device.cpp#L742
Which calls GetLPFRange to find out the valid values for bandwidth,
if your bandwidth is too low, then the minimum is selected.
if your bandwidth is too high, then the maximum valid bandwidth is selected
Once a valid bandwidth is found then TuneRxFilter is called to set it
LMS7_Device::Range LMS7_Device::GetLPFRange(bool tx, unsigned chan) const <=> https://github.com/myriadrf/LimeSuite/blob/master/src/API/lms7_device.cpp#L788
For TX min bandwidth is: 5e6 Hz
For RX min bandwidth is: 1.4001e6 Hz
int LMS7002M::TuneRxFilter(float_type rx_lpf_freq_RF) <=> https://github.com/myriadrf/LimeSuite/blob/master/src/lms7002m/LMS7002M_filtersCalibration.cpp#L77
This talks to the MCU and asks it to set the bandwidth:
Afterwards it reads the SPI registers from the LMS7002M, the ones that would have been updated by the actions of the MCU. So that the cached SPI resisters in the computers memory are synced with the state inside the the SDR hardware.
void MCU_BD::SetParameter(MCU_Parameter param, float value) <=> https://github.com/myriadrf/LimeSuite/blob/master/src/lms7002m_mcu/MCU_BD.cpp#L1039
The MCU talks over SPI to the LMS7002M chip and configures registers to do with bandwidth inside the chip, a document describing the SPI registers*** can be found:
LMS7002Mr2-SPIRegs-2-2r0.pdf @ https://github.com/myriadrf/LMS7002M-docs
There are a fixed number of bandwidths for the analogue lowpass filters inside the LMS7002M chip. See plots in sections 10.3,10.4,10.5,10.6 of the datasheet https://wiki.myriadrf.org/LimeMicro:LMS7002M_Datasheet#TX_and_RX_low-pass_filters - at a guess hidden in the maths the filter size that is the nearest match to your required bandwidth will be selected
*** I always feel like that document is missing some registers.