From b60fccc51495a84a5c434c4e612170e4a75faf12 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 23 Mar 2012 12:14:51 -0700 Subject: usrp: fix for rx_frontend_core_200 dc offset Mask off upper bits when setting a constant offset (I and Q regs). The sign bits (if negative) can flow off into the flags field. --- host/lib/usrp/cores/rx_frontend_core_200.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/cores/rx_frontend_core_200.cpp b/host/lib/usrp/cores/rx_frontend_core_200.cpp index eb9f39fcf..1813758da 100644 --- a/host/lib/usrp/cores/rx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_200.cpp @@ -1,5 +1,5 @@ // -// Copyright 2011 Ettus Research LLC +// Copyright 2011-2012 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #define OFFSET_FIXED (1ul << 31) #define OFFSET_SET (1ul << 30) +#define FLAG_MASK (OFFSET_FIXED | OFFSET_SET) static boost::uint32_t fs_to_bits(const double num, const size_t bits){ return boost::int32_t(boost::math::round(num * (1 << (bits-1)))); @@ -59,8 +60,8 @@ public: } void set_dc_offset(const boost::uint32_t flags){ - _iface->poke32(REG_RX_FE_OFFSET_I, flags | _i_dc_off); - _iface->poke32(REG_RX_FE_OFFSET_Q, flags | _q_dc_off); + _iface->poke32(REG_RX_FE_OFFSET_I, flags | (_i_dc_off & ~FLAG_MASK)); + _iface->poke32(REG_RX_FE_OFFSET_Q, flags | (_q_dc_off & ~FLAG_MASK)); } void set_iq_balance(const std::complex &cor){ -- cgit v1.2.3