1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Implement more configuration options for AD9361

This commit is contained in:
Carles Fernandez 2019-10-06 19:07:24 +02:00
parent 64e7a7995b
commit b5c253fd8f
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 128 additions and 5 deletions

View File

@ -342,6 +342,34 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
}
if (switch_position == 2) // Real-time via AD9361
{
// some basic checks
if ((rf_port_select_ != "A_BALANCED") and (rf_port_select_ != "B_BALANCED") and (rf_port_select_ != "A_N") and (rf_port_select_ != "B_N") and (rf_port_select_ != "B_P") and (rf_port_select_ != "C_N") and (rf_port_select_ != "C_P") and (rf_port_select_ != "TX_MONITOR1") and (rf_port_select_ != "TX_MONITOR2") and (rf_port_select_ != "TX_MONITOR1_2"))
{
std::cout << "Configuration parameter rf_port_select should take one of these values:" << std::endl;
std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2" << std::endl;
std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value rf_port_select=A_BALANCED" << std::endl;
rf_port_select_ = std::string("A_BALANCED");
}
if ((gain_mode_rx1_ != "manual") and (gain_mode_rx1_ != "slow_attack") and (gain_mode_rx1_ != "fast_attack") and (gain_mode_rx1_ != "hybrid"))
{
std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:" << std::endl;
std::cout << " manual, slow_attack, fast_attack, hybrid" << std::endl;
std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value gain_mode_rx1=manual" << std::endl;
gain_mode_rx1_ = std::string("manual");
}
if ((gain_mode_rx2_ != "manual") and (gain_mode_rx2_ != "slow_attack") and (gain_mode_rx2_ != "fast_attack") and (gain_mode_rx2_ != "hybrid"))
{
std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:" << std::endl;
std::cout << " manual, slow_attack, fast_attack, hybrid" << std::endl;
std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value gain_mode_rx2=manual" << std::endl;
gain_mode_rx2_ = std::string("manual");
}
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
config_ad9361_rx_local(bandwidth_,
sample_rate_,
@ -350,7 +378,10 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
gain_mode_rx1_,
gain_mode_rx2_,
rf_gain_rx1_,
rf_gain_rx2_);
rf_gain_rx2_,
quadrature_,
rf_dc_,
bb_dc_);
// LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION
if (enable_dds_lo_ == true)

View File

@ -84,6 +84,46 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
item_size_ = sizeof(gr_complex);
// some basic checks
if ((rf_port_select_ != "A_BALANCED") and (rf_port_select_ != "B_BALANCED") and (rf_port_select_ != "A_N") and (rf_port_select_ != "B_N") and (rf_port_select_ != "B_P") and (rf_port_select_ != "C_N") and (rf_port_select_ != "C_P") and (rf_port_select_ != "TX_MONITOR1") and (rf_port_select_ != "TX_MONITOR2") and (rf_port_select_ != "TX_MONITOR1_2"))
{
std::cout << "Configuration parameter rf_port_select should take one of these values:" << std::endl;
std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2" << std::endl;
std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value rf_port_select=A_BALANCED" << std::endl;
rf_port_select_ = std::string("A_BALANCED");
}
if ((gain_mode_rx1_ != "manual") and (gain_mode_rx1_ != "slow_attack") and (gain_mode_rx1_ != "fast_attack") and (gain_mode_rx1_ != "hybrid"))
{
std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:" << std::endl;
std::cout << " manual, slow_attack, fast_attack, hybrid" << std::endl;
std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value gain_mode_rx1=manual" << std::endl;
gain_mode_rx1_ = std::string("manual");
}
if ((gain_mode_rx2_ != "manual") and (gain_mode_rx2_ != "slow_attack") and (gain_mode_rx2_ != "fast_attack") and (gain_mode_rx2_ != "hybrid"))
{
std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:" << std::endl;
std::cout << " manual, slow_attack, fast_attack, hybrid" << std::endl;
std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value gain_mode_rx2=manual" << std::endl;
gain_mode_rx2_ = std::string("manual");
}
if ((filter_source_ != "Off") and (filter_source_ != "Auto") and (filter_source_ != "File") and (filter_source_ != "Design"))
{
std::cout << "Configuration parameter filter_source should take one of these values:" << std::endl;
std::cout << " Off: Disable filter" << std::endl;
std::cout << " Auto: Use auto-generated filters" << std::endl;
std::cout << " File: User-provided filter in filter_filename parameter" << std::endl;
std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters" << std::endl;
std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value filter_source=Off" << std::endl;
filter_source_ = std::string("Off");
}
std::cout << "device address: " << uri_ << std::endl;
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl;

View File

@ -70,6 +70,16 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
LOG(FATAL) << "Configuration error: item_type must be gr_complex!";
}
// basic check
if ((gain_mode_ != "manual") and (gain_mode_ != "slow_attack") and (gain_mode_ != "fast_attack") and (gain_mode_ != "hybrid"))
{
std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:" << std::endl;
std::cout << " manual, slow_attack, fast_attack, hybrid" << std::endl;
std::cout << "Error: provided value gain_mode=" << gain_mode_ << " is not among valid values" << std::endl;
std::cout << " This parameter has been set to its default value gain_mode=manual" << std::endl;
gain_mode_ = std::string("manual");
}
item_size_ = sizeof(gr_complex);
std::cout << "device address: " << uri_ << std::endl;

View File

@ -183,7 +183,10 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
const std::string &gain_mode_rx1_,
const std::string &gain_mode_rx2_,
double rf_gain_rx1_,
double rf_gain_rx2_)
double rf_gain_rx2_,
bool quadrature_,
bool rfdc_,
bool bbdc_)
{
// RX stream config
@ -264,6 +267,21 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
{
std::cout << "Failed to set calib_mode: " << ret << std::endl;
}
ret = iio_device_attr_write_bool(ad9361_phy, "in_voltage_quadrature_tracking_en", quadrature_);
if (ret < 0)
{
std::cout << "Failed to set in_voltage_quadrature_tracking_en: " << ret << std::endl;
}
ret = iio_device_attr_write_bool(ad9361_phy, "in_voltage_rf_dc_offset_tracking_en", rfdc_);
if (ret < 0)
{
std::cout << "Failed to set in_voltage_rf_dc_offset_tracking_en: " << ret << std::endl;
}
ret = iio_device_attr_write_bool(ad9361_phy, "in_voltage_bb_dc_offset_tracking_en", bbdc_);
if (ret < 0)
{
std::cout << "Failed to set in_voltage_bb_dc_offset_tracking_en: " << ret << std::endl;
}
ret = iio_device_attr_write(ad9361_phy, "in_voltage0_gain_control_mode", gain_mode_rx1_.c_str());
if (ret < 0)
{
@ -299,7 +317,10 @@ bool config_ad9361_rx_remote(const std::string &remote_host,
const std::string &gain_mode_rx1_,
const std::string &gain_mode_rx2_,
double rf_gain_rx1_,
double rf_gain_rx2_)
double rf_gain_rx2_,
bool quadrature_,
bool rfdc_,
bool bbdc_)
{
// RX stream config
// Stream configurations
@ -379,6 +400,21 @@ bool config_ad9361_rx_remote(const std::string &remote_host,
{
std::cout << "Failed to set calib_mode: " << ret << std::endl;
}
ret = iio_device_attr_write_bool(ad9361_phy, "in_voltage_quadrature_tracking_en", quadrature_);
if (ret < 0)
{
std::cout << "Failed to set in_voltage_quadrature_tracking_en: " << ret << std::endl;
}
ret = iio_device_attr_write_bool(ad9361_phy, "in_voltage_rf_dc_offset_tracking_en", rfdc_);
if (ret < 0)
{
std::cout << "Failed to set in_voltage_rf_dc_offset_tracking_en: " << ret << std::endl;
}
ret = iio_device_attr_write_bool(ad9361_phy, "in_voltage_bb_dc_offset_tracking_en", bbdc_);
if (ret < 0)
{
std::cout << "Failed to set in_voltage_bb_dc_offset_tracking_en: " << ret << std::endl;
}
ret = iio_device_attr_write(ad9361_phy, "in_voltage0_gain_control_mode", gain_mode_rx1_.c_str());
if (ret < 0)
{

View File

@ -92,7 +92,10 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
const std::string &gain_mode_rx1_,
const std::string &gain_mode_rx2_,
double rf_gain_rx1_,
double rf_gain_rx2_);
double rf_gain_rx2_,
bool quadrature_,
bool rfdc_,
bool bbdc_);
bool config_ad9361_rx_remote(const std::string &remote_host,
uint64_t bandwidth_,
@ -102,7 +105,10 @@ bool config_ad9361_rx_remote(const std::string &remote_host,
const std::string &gain_mode_rx1_,
const std::string &gain_mode_rx2_,
double rf_gain_rx1_,
double rf_gain_rx2_);
double rf_gain_rx2_,
bool quadrature_,
bool rfdc_,
bool bbdc_);
bool config_ad9361_lo_local(uint64_t bandwidth_,
uint64_t sample_rate_,