summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-03-23 12:14:51 -0700
committerJosh Blum <josh@joshknows.com>2012-03-23 12:14:51 -0700
commitb60fccc51495a84a5c434c4e612170e4a75faf12 (patch)
treedb983533cdcc7f513ced239883b71a1f7e0f29f3 /host/lib/usrp
parentea19de0ba230b738a102d4ebb089614bd3ca2fa0 (diff)
downloaduhd-b60fccc51495a84a5c434c4e612170e4a75faf12.tar.gz
uhd-b60fccc51495a84a5c434c4e612170e4a75faf12.tar.bz2
uhd-b60fccc51495a84a5c434c4e612170e4a75faf12.zip
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.
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/cores/rx_frontend_core_200.cpp7
1 files changed, 4 insertions, 3 deletions
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<double> &cor){