mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
Implement phase_dds_deg parameter, fix guard for tx_bandwidth
This commit is contained in:
parent
48a62594eb
commit
bdabbf7f85
@ -37,13 +37,14 @@
|
||||
#include "configuration_interface.h"
|
||||
#include <glog/logging.h>
|
||||
#include <iio.h>
|
||||
#include <cmath> // for abs
|
||||
#include <exception>
|
||||
#include <fcntl.h> // for open, O_WRONLY
|
||||
#include <fstream> // for std::ifstream
|
||||
#include <iostream> // for cout, endl
|
||||
#include <string> // for string manipulation
|
||||
#include <unistd.h> // for write
|
||||
#include <algorithm> // for max
|
||||
#include <cmath> // for abs
|
||||
#include <exception> // for exceptions
|
||||
#include <fcntl.h> // for open, O_WRONLY
|
||||
#include <fstream> // for std::ifstream
|
||||
#include <iostream> // for cout, endl
|
||||
#include <string> // for string manipulation
|
||||
#include <unistd.h> // for write
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -299,14 +300,13 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
|
||||
rf_port_select_ = configuration->property(role + ".rf_port_select", default_rf_port_select);
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - 1000);
|
||||
freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000);
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - freq_dds_tx_hz_);
|
||||
scale_dds_dbfs_ = configuration->property(role + ".scale_dds_dbfs", -3.0);
|
||||
phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
|
||||
tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db);
|
||||
tx_bandwidth_ = configuration->property(role + ".tx_bandwidth", 500000);
|
||||
phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
|
||||
|
||||
// turn switch to A/D position
|
||||
std::string default_device_name = "/dev/uio1";
|
||||
@ -433,10 +433,10 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
|
||||
// LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION
|
||||
if (enable_dds_lo_ == true)
|
||||
{
|
||||
if (tx_bandwidth_ < static_cast<uint64_t>(std::floor(static_cast<float>(freq_rf_tx_hz_) * 1.1)))
|
||||
if (tx_bandwidth_ < static_cast<uint64_t>(std::floor(static_cast<float>(freq_dds_tx_hz_) * 1.1)) or (tx_bandwidth_ < 200000) or (tx_bandwidth_ > 1000000))
|
||||
{
|
||||
std::cout << "Configuration parameter tx_bandwidth should be higher than " << static_cast<double>(freq_rf_tx_hz_) * 1.1 << " Hz" << std::endl;
|
||||
std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is lower than the minimum allowed value" << std::endl;
|
||||
std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast<float>(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz" << std::endl;
|
||||
std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values" << std::endl;
|
||||
std::cout << " This parameter has been set to its default value tx_bandwidth=500000" << std::endl;
|
||||
tx_bandwidth_ = 500000;
|
||||
LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000";
|
||||
@ -449,12 +449,20 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
|
||||
tx_attenuation_db_ = default_tx_attenuation_db;
|
||||
LOG(WARNING) << "Invalid configuration value for tx_attenuation_db parameter. Set to tx_attenuation_db=" << default_tx_attenuation_db;
|
||||
}
|
||||
config_ad9361_lo_local(tx_bandwidth_,
|
||||
sample_rate_,
|
||||
freq_rf_tx_hz_,
|
||||
tx_attenuation_db_,
|
||||
freq_dds_tx_hz_,
|
||||
scale_dds_dbfs_);
|
||||
try
|
||||
{
|
||||
config_ad9361_lo_local(tx_bandwidth_,
|
||||
sample_rate_,
|
||||
freq_rf_tx_hz_,
|
||||
tx_attenuation_db_,
|
||||
freq_dds_tx_hz_,
|
||||
scale_dds_dbfs_,
|
||||
phase_dds_deg_);
|
||||
}
|
||||
catch (const std::runtime_error &e)
|
||||
{
|
||||
std::cout << "Exception cached when configuring the TX carrier: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,6 @@ private:
|
||||
uint32_t out_stream_;
|
||||
|
||||
size_t item_size_;
|
||||
int64_t samples_;
|
||||
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm> // for max
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
@ -78,8 +79,8 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
|
||||
// AD9361 Local Oscillator generation for dual band operation
|
||||
enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - 1000);
|
||||
freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000);
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - freq_dds_tx_hz_);
|
||||
scale_dds_dbfs_ = configuration->property(role + ".scale_dds_dbfs", 0.0);
|
||||
phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
|
||||
tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db);
|
||||
@ -197,10 +198,10 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
// configure LO
|
||||
if (enable_dds_lo_ == true)
|
||||
{
|
||||
if (tx_bandwidth_ < static_cast<double>(freq_rf_tx_hz_) * 1.1)
|
||||
if (tx_bandwidth_ < static_cast<uint64_t>(std::floor(static_cast<float>(freq_dds_tx_hz_) * 1.1)) or (tx_bandwidth_ < 200000) or (tx_bandwidth_ > 1000000))
|
||||
{
|
||||
std::cout << "Configuration parameter tx_bandwidth should be higher than " << static_cast<double>(freq_rf_tx_hz_) * 1.1 << " Hz" << std::endl;
|
||||
std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is lower than the minimum allowed value" << std::endl;
|
||||
std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast<float>(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz" << std::endl;
|
||||
std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values" << std::endl;
|
||||
std::cout << " This parameter has been set to its default value tx_bandwidth=500000" << std::endl;
|
||||
tx_bandwidth_ = 500000;
|
||||
LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000";
|
||||
@ -222,7 +223,8 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
freq_rf_tx_hz_,
|
||||
tx_attenuation_db_,
|
||||
freq_dds_tx_hz_,
|
||||
scale_dds_dbfs_);
|
||||
scale_dds_dbfs_,
|
||||
phase_dds_deg_);
|
||||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
@ -263,10 +265,10 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
// configure LO
|
||||
if (enable_dds_lo_ == true)
|
||||
{
|
||||
if (tx_bandwidth_ < static_cast<uint64_t>(std::floor(static_cast<float>(freq_rf_tx_hz_) * 1.1)))
|
||||
if (tx_bandwidth_ < static_cast<uint64_t>(std::floor(static_cast<float>(freq_dds_tx_hz_) * 1.1)) or (tx_bandwidth_ < 200000) or (tx_bandwidth_ > 1000000))
|
||||
{
|
||||
std::cout << "Configuration parameter tx_bandwidth should be higher than " << static_cast<double>(freq_rf_tx_hz_) * 1.1 << " Hz" << std::endl;
|
||||
std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is lower than the minimum allowed value" << std::endl;
|
||||
std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast<float>(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz" << std::endl;
|
||||
std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values" << std::endl;
|
||||
std::cout << " This parameter has been set to its default value tx_bandwidth=500000" << std::endl;
|
||||
tx_bandwidth_ = 500000;
|
||||
LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000";
|
||||
@ -288,7 +290,8 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
freq_rf_tx_hz_,
|
||||
tx_attenuation_db_,
|
||||
freq_dds_tx_hz_,
|
||||
scale_dds_dbfs_);
|
||||
scale_dds_dbfs_,
|
||||
phase_dds_deg_);
|
||||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
|
@ -448,7 +448,8 @@ bool config_ad9361_lo_local(uint64_t bandwidth_,
|
||||
uint64_t freq_rf_tx_hz_,
|
||||
double tx_attenuation_db_,
|
||||
int64_t freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_)
|
||||
double scale_dds_dbfs_,
|
||||
double phase_dds_deg_)
|
||||
{
|
||||
// TX stream config
|
||||
std::cout << "Start of AD9361 TX Local Oscillator DDS configuration\n";
|
||||
@ -529,13 +530,13 @@ bool config_ad9361_lo_local(uint64_t bandwidth_,
|
||||
std::cout << "Failed to set TX DDS frequency Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "phase", 0.0);
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "phase", phase_dds_deg_ * 1000.0);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "phase", 270000.0);
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "phase", phase_dds_deg_ * 1000.0 + 270000.0);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase Q: " << ret << std::endl;
|
||||
@ -589,7 +590,8 @@ bool config_ad9361_lo_remote(const std::string &remote_host,
|
||||
uint64_t freq_rf_tx_hz_,
|
||||
double tx_attenuation_db_,
|
||||
int64_t freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_)
|
||||
double scale_dds_dbfs_,
|
||||
double phase_dds_deg_)
|
||||
{
|
||||
// TX stream config
|
||||
std::cout << "Start of AD9361 TX Local Oscillator DDS configuration\n";
|
||||
@ -670,13 +672,13 @@ bool config_ad9361_lo_remote(const std::string &remote_host,
|
||||
std::cout << "Failed to set TX DDS frequency Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "phase", 0.0);
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "phase", phase_dds_deg_ * 1000.0);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "phase", 270000.0);
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "phase", phase_dds_deg_ * 1000.0 + 270000.0);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase Q: " << ret << std::endl;
|
||||
|
@ -115,7 +115,8 @@ bool config_ad9361_lo_local(uint64_t bandwidth_,
|
||||
uint64_t freq_rf_tx_hz_,
|
||||
double tx_attenuation_db_,
|
||||
int64_t freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_);
|
||||
double scale_dds_dbfs_,
|
||||
double phase_dds_deg_);
|
||||
|
||||
bool config_ad9361_lo_remote(const std::string &remote_host,
|
||||
uint64_t bandwidth_,
|
||||
@ -123,7 +124,8 @@ bool config_ad9361_lo_remote(const std::string &remote_host,
|
||||
uint64_t freq_rf_tx_hz_,
|
||||
double tx_attenuation_db_,
|
||||
int64_t freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_);
|
||||
double scale_dds_dbfs_,
|
||||
double phase_dds_deg_);
|
||||
|
||||
|
||||
bool ad9361_disable_lo_remote(const std::string &remote_host);
|
||||
|
Loading…
Reference in New Issue
Block a user