uhd: support for applying cal corrections B100

This commit is contained in:
Josh Blum
2011-11-15 16:22:18 -08:00
parent f68a9271f4
commit 18abd4dbbf
7 changed files with 34 additions and 10 deletions

View File

@@ -28,11 +28,12 @@ The following RF frontends are supported by the self-calibration utilities:
* more to come... * more to come...
******************************************** ********************************************
Basic tool usage Calibration utilities
******************************************** ********************************************
UHD installs the calibration utilities into <install-path>/bin. UHD installs the calibration utilities into <install-path>/bin.
Run the following from the command line: **Disconnect** any extrernal hardware from the RF antenna ports,
and run the following from the command line.
Each utility will take several minutes to complete.
:: ::
uhd_cal_rx_iq_balance --verbose --args=<optional device args> uhd_cal_rx_iq_balance --verbose --args=<optional device args>
@@ -43,13 +44,13 @@ See the output given by --help for more advanced options, such as:
manually choosing the frequency range and step size for the sweeps. manually choosing the frequency range and step size for the sweeps.
******************************************** ********************************************
Calibration files Calibration data
******************************************** ********************************************
Calibration files are stored in the user's home/application directory. Calibration files are stored in the user's home/application directory.
They can easily be moved from machine to another by copying the "cal" directory. They can easily be moved from machine to another by copying the "cal" directory.
Re-running a calibration utility will replace the existing calibration file. Re-running a calibration utility will replace the existing calibration file.
The old calibration file will be renamed so it may be recovered by the user. The old calibration file will be renamed so it may be recovered by the user.
* **Unix:** ${HOME}/.uhd/cal * **Unix:** ${HOME}/.uhd/cal/
* **Windows:** %APPDATA%\.uhd\cal * **Windows:** %APPDATA%\\.uhd\\cal\\

View File

@@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
#include "apply_corrections.hpp"
#include "b100_impl.hpp" #include "b100_impl.hpp"
#include "b100_ctrl.hpp" #include "b100_ctrl.hpp"
#include "fpga_regs_standard.h" #include "fpga_regs_standard.h"
@@ -408,6 +409,18 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
_dboard_iface, _tree->subtree(mb_path / "dboards/A") _dboard_iface, _tree->subtree(mb_path / "dboards/A")
); );
//bind frontend corrections to the dboard freq props
const fs_path db_tx_fe_path = mb_path / "dboards" / "A" / "tx_frontends";
BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)){
_tree->access<double>(db_tx_fe_path / name / "freq" / "value")
.subscribe(boost::bind(&b100_impl::set_tx_fe_corrections, this, _1));
}
const fs_path db_rx_fe_path = mb_path / "dboards" / "A" / "rx_frontends";
BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)){
_tree->access<double>(db_rx_fe_path / name / "freq" / "value")
.subscribe(boost::bind(&b100_impl::set_rx_fe_corrections, this, _1));
}
//initialize io handling //initialize io handling
this->io_init(); this->io_init();
@@ -501,3 +514,11 @@ sensor_value_t b100_impl::get_ref_locked(void){
const bool lock = _clock_ctrl->get_locked(); const bool lock = _clock_ctrl->get_locked();
return sensor_value_t("Ref", lock, "locked", "unlocked"); return sensor_value_t("Ref", lock, "locked", "unlocked");
} }
void b100_impl::set_rx_fe_corrections(const double lo_freq){
apply_rx_fe_corrections(this->get_tree()->subtree("/mboards/0"), "A", lo_freq);
}
void b100_impl::set_tx_fe_corrections(const double lo_freq){
apply_tx_fe_corrections(this->get_tree()->subtree("/mboards/0"), "A", lo_freq);
}

View File

@@ -125,6 +125,8 @@ private:
void clear_fpga_fifo(void); void clear_fpga_fifo(void);
void handle_async_message(uhd::transport::managed_recv_buffer::sptr); void handle_async_message(uhd::transport::managed_recv_buffer::sptr);
uhd::sensor_value_t get_ref_locked(void); uhd::sensor_value_t get_ref_locked(void);
void set_rx_fe_corrections(const double);
void set_tx_fe_corrections(const double);
}; };
#endif /* INCLUDED_b100_IMPL_HPP */ #endif /* INCLUDED_b100_IMPL_HPP */

View File

@@ -249,7 +249,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
result.delta = best_suppression - initial_suppression; result.delta = best_suppression - initial_suppression;
results.push_back(result); results.push_back(result);
if (vm.count("verbose")){ if (vm.count("verbose")){
std::cout << boost::format("%f MHz: best suppression %fdB, corrected %fdB") % (rx_lo/1e6) % result.best % result.delta << std::endl; std::cout << boost::format("%f MHz: best suppression %f dB, corrected %f dB") % (rx_lo/1e6) % result.best % result.delta << std::endl;
} }
else std::cout << "." << std::flush; else std::cout << "." << std::flush;
} }

View File

@@ -246,7 +246,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
result.delta = initial_dc_dbrms - lowest_offset; result.delta = initial_dc_dbrms - lowest_offset;
results.push_back(result); results.push_back(result);
if (vm.count("verbose")){ if (vm.count("verbose")){
std::cout << boost::format("%f MHz: lowest offset %fdB, corrected %fdB") % (tx_lo/1e6) % result.best % result.delta << std::endl; std::cout << boost::format("%f MHz: lowest offset %f dB, corrected %f dB") % (tx_lo/1e6) % result.best % result.delta << std::endl;
} }
else std::cout << "." << std::flush; else std::cout << "." << std::flush;
} }

View File

@@ -251,7 +251,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
result.delta = best_suppression - initial_suppression; result.delta = best_suppression - initial_suppression;
results.push_back(result); results.push_back(result);
if (vm.count("verbose")){ if (vm.count("verbose")){
std::cout << boost::format("%f MHz: best suppression %fdB, corrected %fdB") % (tx_lo/1e6) % result.best % result.delta << std::endl; std::cout << boost::format("%f MHz: best suppression %f dB, corrected %f dB") % (tx_lo/1e6) % result.best % result.delta << std::endl;
} }
else std::cout << "." << std::flush; else std::cout << "." << std::flush;
} }

View File

@@ -73,7 +73,7 @@ static inline void set_optimum_gain(uhd::usrp::multi_usrp::sptr usrp){
static inline std::vector<std::complex<float> > gen_table(void){ static inline std::vector<std::complex<float> > gen_table(void){
std::vector<std::complex<float> > wave_table(wave_table_len); std::vector<std::complex<float> > wave_table(wave_table_len);
for (size_t i = 0; i < wave_table_len; i++){ for (size_t i = 0; i < wave_table_len; i++){
wave_table[i] = std::polar<float>(1.0, (tau*i)/wave_table_len); wave_table[i] = std::complex<float>(std::polar(1.0, (tau*i)/wave_table_len));
} }
return wave_table; return wave_table;
} }