[LimeSDR-USB] Synchronization and Toggle TDD/FDD Mode

Hi,

I’m having issues that I believe might be caused by being in FDD mode rather than TDD mode (I’m using the same frequency for RX and TX); I go into detail about these in this thread..

In order to try and get TDD working, I inserted the following code at the end of the SoapyLMS7 constructor here:

//Beginning of added section SID
SoapySDR::logf(SOAPY_SDR_INFO, "SID almost end of Constructor"); //SID
SoapySDR::logf(SOAPY_SDR_INFO, "Enabling TDD");

SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x0020 before is %x", readRegister("RFIC0", 0x0020)); //MAC
SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x011C before is %x", readRegister("RFIC0", 0x011C)); //PD_LOCH_T2RBUF, PD_VCO
for (size_t channel = 0; channel < 1; channel++)
{
    auto rfic = getRFIC(channel);
    rfic->Modify_SPI_Reg_bits(LMS7param(MAC),2);
    SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x0020 after (MAC,2) is %x", readRegister("RFIC0", 0x0020)); //MAC
    rfic->Modify_SPI_Reg_bits(LMS7param(PD_LOCH_T2RBUF),0);
    SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x011C after (PD_LOCH_T2RBUF,0) is %x", readRegister("RFIC0", 0x011C));
    rfic->Modify_SPI_Reg_bits(LMS7param(MAC),1);
    SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x0020 after (MAC,1) is %x", readRegister("RFIC0", 0x0020)); //MAC
    rfic->Modify_SPI_Reg_bits(LMS7param(PD_VCO),1);
    SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x011C after (PD_VCO,1) is %x", readRegister("RFIC0", 0x011C));
}

SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x0020 after all changes is %x", readRegister("RFIC0", 0x0020)); //MAC
SoapySDR::logf(SOAPY_SDR_INFO, "Register at 0x011C after call changes is %x", readRegister("RFIC0", 0x011C)); //PD_LOCH_T2RBUF, PD_VCO
    
SoapySDR::logf(SOAPY_SDR_INFO, "SID end of Constructor"); //SID
//End of added section SID

I get the following output:

linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_003.010.002.000-3-g122bfae1

gr-osmosdr v0.1.4-98-gc653754d (0.1.5git) gnuradio 3.7.11.1
built-in source types: file fcd rtl rtl_tcp uhd hackrf bladerf rfspace airspy soapy redpitaya 
[INFO] Make connection: 'LimeSDR-USB [USB 3.0] 9062000C41E13'
[INFO] Reference clock 30.720 MHz
[INFO] Device name: LimeSDR-USB
[INFO] Reference: 30.72 MHz
[INFO] Init LMS7002M(0)
[INFO] Ver=7, Rev=1, Mask=1
[INFO] LMS7002M calibration values caching Disable
[INFO] SID almost end of Constructor
[INFO] Enabling TDD
[INFO] Register at 0x0020 before is fffe
[INFO] Register at 0x011C before is ad43
[INFO] Register at 0x0020 after (MAC,2) is fffe
[INFO] Register at 0x011C after (PD_LOCH_T2RBUF,0) is ad03
[INFO] Register at 0x0020 after (MAC,1) is fffd
[INFO] Register at 0x011C after (PD_VCO,1) is ad43
[INFO] Register at 0x0020 after all changes is fffd
[INFO] Register at 0x011C after call changes is ad43
[INFO] SID end of Constructor
gr-osmosdr v0.1.4-98-gc653754d (0.1.5git) gnuradio 3.7.11.1
built-in sink types: uhd hackrf bladerf soapy redpitaya file 
'Q' to quit 
[INFO] L
q

From the above, it looks to me like the call to set PD_LOCH_T2RBUF to 0 is working as intended (bit 6 is being set to 0, which seems correct to me according to LMS7002M_parameters.h). The register changes after the two MAC register changes also make sense. However, after setting PD_VCO to 1, the register 0x011C is now back to 0xad43, which doesn’t make sense to me, as it should be changing different bits. What am I doing wrong here? Making these changes didn’t seem to fix my issues, but that may be because TDD mode isn’t being enabled successfully due to the above (is there an easy way to check?)

Thanks and regards,

DasSidG

EDIT: Changed the code above so that it was actually what I used to generate the output given above (had accidentally copied in an older version of the code previously)