MITHaystack / digital_rf

Read, write, and interact with data in the Digital RF and Digital Metadata formats
Other
102 stars 31 forks source link

Lo -Sharing in thor #47

Open jswoboda opened 1 year ago

jswoboda commented 1 year ago

LO sharing doesn't seem to be working as expected with thor.py. A work around was found in some old GNURadio code to do the sharing and phase alignment properly. I wanted to get this documented before it's forgotten so we can get it into thor if need be. Basically when setting the SDR center frequency the following function should be used instead.

def set_center_freq(self, center_freq, sources):
    # Tune all channels to the desired frequency
        tune_resp = self.uhd_usrp_source_0.set_center_freq(center_freq, 0)
        tune_req = uhd.tune_request(rf_freq=center_freq, rf_freq_policy=uhd.tune_request.POLICY_MANUAL, 
               dsp_freq=tune_resp.actual_dsp_freq, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)

        self.uhd_usrp_source_0.set_center_freq(tune_req, 1)
        if sources==4:
            self.uhd_usrp_source_0.set_center_freq(tune_req, 2)
            self.uhd_usrp_source_0.set_center_freq(tune_req, 3)

    # Synchronize the tuned channels
        now = self.uhd_usrp_source_0.get_time_now()
        self.uhd_usrp_source_0.set_command_time(now + uhd.time_spec(0.01))

        self.uhd_usrp_source_0.set_center_freq(tune_req, 0)
        self.uhd_usrp_source_0.set_center_freq(tune_req, 1)
        if sources==4:
            self.uhd_usrp_source_0.set_center_freq(tune_req, 2)
            self.uhd_usrp_source_0.set_center_freq(tune_req, 3)

        self.uhd_usrp_source_0.clear_command_time()
jswoboda commented 1 year ago

Another issue associated with this is that thor will cause the radio to hang and require a restart.