aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common/ad9361_driver
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2015-01-26 12:24:58 -0800
committerAshish Chaudhari <ashish@ettus.com>2015-01-26 12:24:58 -0800
commit6e2ef6999862f8479ae30923dc5f044c742301b8 (patch)
tree284d0d96e892947e7643c0810272de01ad3795b6 /host/lib/usrp/common/ad9361_driver
parent101f6ee0332485a6fa59e2a69b1de253304dcee6 (diff)
parent036b9499886002e89929bb44601872c60316ffa8 (diff)
downloaduhd-6e2ef6999862f8479ae30923dc5f044c742301b8.tar.gz
uhd-6e2ef6999862f8479ae30923dc5f044c742301b8.tar.bz2
uhd-6e2ef6999862f8479ae30923dc5f044c742301b8.zip
Merge branch 'maint' into e300/clk_pps_updates
Diffstat (limited to 'host/lib/usrp/common/ad9361_driver')
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.cpp29
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.h2
2 files changed, 23 insertions, 8 deletions
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
index 7e574920a..97b214d7d 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
@@ -135,30 +135,39 @@ void ad9361_device_t::_program_fir_filter(direction_t direction, int num_taps, b
_io_iface->poke8(base + 5, reg_numtaps | 0x1A);
if (direction == RX) {
_io_iface->poke8(base + 5, reg_numtaps | 0x18);
+ /* Rx Gain, set to prevent digital overflow/saturation in filters
+ 0:+6dB, 1:0dB, 2:-6dB, 3:-12dB
+ page 35 of UG-671 */
_io_iface->poke8(base + 6, 0x02); /* Also turn on -6dB Rx gain here, to stop filter overfow.*/
} else {
- _io_iface->poke8(base + 5, reg_numtaps | 0x19); /* Also turn on -6dB Tx gain here, to stop filter overfow.*/
+ /* Tx Gain. bit[0]. set to prevent digital overflow/saturation in filters
+ 0: 0dB, 1:-6dB
+ page 25 of UG-671 */
+ _io_iface->poke8(base + 5, reg_numtaps | 0x18);
}
}
/* Program the RX FIR Filter. */
-void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t interpolation)
+void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t decimation)
{
+ if (not (decimation == 1 or decimation == 2 or decimation == 4)) {
+ throw uhd::runtime_error("[ad9361_device_t] Invalid Rx FIR decimation.");
+ }
boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps]);
for (size_t i = 0; i < num_taps; i++) {
switch (num_taps) {
case 128:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
break;
case 96:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
break;
case 64:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
break;
case 48:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
break;
default:
throw uhd::runtime_error("[ad9361_device_t] Unsupported number of Rx FIR taps.");
@@ -171,11 +180,17 @@ void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t interpolatio
/* Program the TX FIR Filter. */
void ad9361_device_t::_setup_tx_fir(size_t num_taps, boost::int32_t interpolation)
{
+ if (not (interpolation == 1 or interpolation == 2 or interpolation == 4)) {
+ throw uhd::runtime_error("[ad9361_device_t] Invalid Tx FIR interpolation.");
+ }
+ if (interpolation == 1 and num_taps > 64) {
+ throw uhd::runtime_error("[ad9361_device_t] Too many Tx FIR taps for interpolation value.");
+ }
boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps]);
for (size_t i = 0; i < num_taps; i++) {
switch (num_taps) {
case 128:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
+ coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
break;
case 96:
coeffs[i] = boost::uint16_t((interpolation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.h b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
index fead90424..ca83f3037 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
@@ -74,7 +74,7 @@ public:
private: //Methods
void _program_fir_filter(direction_t direction, int num_taps, boost::uint16_t *coeffs);
void _setup_tx_fir(size_t num_taps, boost::int32_t interpolation);
- void _setup_rx_fir(size_t num_taps, boost::int32_t interpolation);
+ void _setup_rx_fir(size_t num_taps, boost::int32_t decimation);
void _calibrate_lock_bbpll();
void _calibrate_synth_charge_pumps();
double _calibrate_baseband_rx_analog_filter();