From e1b686318fab1cb2b11542c28d82d810d1fc63a2 Mon Sep 17 00:00:00 2001 From: michael-west Date: Mon, 8 May 2017 11:48:45 -0700 Subject: X300: Fix DAC sync --- host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'host/lib/usrp/x300/x300_radio_ctrl_impl.cpp') diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 69eb51f55..a3bc2e691 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -608,8 +608,14 @@ void x300_radio_ctrl_impl::synchronize_dacs(const std::vectorset_command_tick_rate(radios[i]->_radio_clk_rate, IO_MASTER_RADIO); + radios[i]->_regs->misc_outs_reg.write(radio_regmap_t::misc_outs_reg_t::DAC_SYNC, 0); + } + + //Add 100% of headroom + uncertainty to the command time + uint64_t t_sync_us = (t_elapsed.total_microseconds() * 2) + 16000 /*Scheduler latency*/; //Pick radios[0] as the time reference. uhd::time_spec_t sync_time = @@ -617,15 +623,17 @@ void x300_radio_ctrl_impl::synchronize_dacs(const std::vectorset_command_tick_rate(radios[i]->_radio_clk_rate, IO_MASTER_RADIO); - radios[i]->_regs->misc_outs_reg.set(radio_regmap_t::misc_outs_reg_t::DAC_SYNC, 0); radios[i]->set_command_time(sync_time, IO_MASTER_RADIO); //Arm FRAMEP/N sync pulse by asserting a rising edge - radios[i]->_regs->misc_outs_reg.set(radio_regmap_t::misc_outs_reg_t::DAC_SYNC, 1); - radios[i]->_regs->misc_outs_reg.set(radio_regmap_t::misc_outs_reg_t::DAC_SYNC, 0); + radios[i]->_regs->misc_outs_reg.write(radio_regmap_t::misc_outs_reg_t::DAC_SYNC, 1); radios[i]->set_command_time(uhd::time_spec_t(0.0), IO_MASTER_RADIO); } + //Reset FRAMEP/N to 0 + for (size_t i = 0; i < radios.size(); i++) { + radios[i]->_regs->misc_outs_reg.write(radio_regmap_t::misc_outs_reg_t::DAC_SYNC, 0); + } + //Wait and check status boost::this_thread::sleep(boost::posix_time::microseconds(t_sync_us)); for (size_t i = 0; i < radios.size(); i++) { -- cgit v1.2.3