1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Galileo E5a is now debugged and working. Acquisition is using interrupts again. Each acquisition process opens and closes the acquisition device when an acquisition is done instead of having the device opened all the time. In this way the acquisition interrupt should only be received by the process that is using the interrupt at that time.

This commit is contained in:
Marc Majoral 2018-11-30 11:07:01 +01:00
parent f7050766bc
commit f48a91c413
13 changed files with 353 additions and 72 deletions

View File

@ -51,19 +51,19 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
//printf("creating the E5A acquisition");
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_item_type = "cshort";
//std::string default_item_type = "cshort";
std::string default_dump_filename = "../data/acquisition.dat";
DLOG(INFO) << "Role " << role;
//item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 12500000);
long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 1.0);
acq_parameters.downsampling_factor = downsampling_factor;
printf("downsampling_factor = %f\n", downsampling_factor);
fs_in = fs_in/downsampling_factor;
acq_parameters.fs_in = fs_in;
@ -103,9 +103,11 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
float nbits = ceilf(log2f((float)code_length*2));
unsigned int nsamples_total = pow(2, nbits);
unsigned int vector_length = nsamples_total;
printf("code_length = %d\n", code_length);
printf("vector_length = %d\n", vector_length);
unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
printf("select queue = %d\n", select_queue_Fpga);
//printf("select_queue_Fpga = %d\n", select_queue_Fpga);
//printf("acq adapter select_queue_Fpga = %d\n", select_queue_Fpga);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
@ -126,6 +128,8 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
//printf("creating the E5A acquisition CONT");
//printf("nsamples_total = %d\n", nsamples_total);
printf("number of codes = %d\n", Galileo_E5a_NUMBER_OF_CODES);
for (unsigned int PRN = 1; PRN <= Galileo_E5a_NUMBER_OF_CODES; PRN++)
{
// gr_complex* code = new gr_complex[code_length_];
@ -133,14 +137,17 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
if (acq_iq_)
{
//printf("aaaaaaaaaaaaa\n");
strcpy(signal_, "5X");
}
else if (acq_pilot_)
{
//printf("bbbbbbbbbbbbb\n");
strcpy(signal_, "5Q");
}
else
{
//printf("cccccccccccc\n");
strcpy(signal_, "5I");
}
@ -180,6 +187,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
{
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int>(floor(fft_codes_padded[i].real() * (pow(2, 9) - 1) / max)),
static_cast<int>(floor(fft_codes_padded[i].imag() * (pow(2, 9) - 1) / max)));
//d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t((2^3)*static_cast<int>(floor(fft_codes_padded[i].real() * (pow(2, 6) - 1) / max)),
// (2^3)*static_cast<int>(floor(fft_codes_padded[i].imag() * (pow(2, 6) - 1) / max)));
}
}
@ -217,7 +227,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
//acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
//DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")";
acq_parameters.total_block_exp = 9;
acq_parameters.total_block_exp = 10;
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")";

View File

@ -80,7 +80,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
acq_parameters.doppler_max = doppler_max_;
unsigned int sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1);
unsigned int sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 4);
acq_parameters.sampled_ms = sampled_ms;
unsigned int code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
@ -113,7 +113,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
{
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code
for (int s = code_length; s < 2*code_length; s++)
{
code[s] = code[s - code_length];

View File

@ -54,7 +54,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
//printf("L5 ACQ CLASS CREATED\n");
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_item_type = "cshort";
//std::string default_item_type = "cshort";
std::string default_dump_filename = "./data/acquisition.dat";
LOG(INFO) << "role " << role;
@ -101,7 +101,10 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
unsigned int nsamples_total = pow(2, nbits);
unsigned int vector_length = nsamples_total;
unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
printf("code_length = %d\n", (int) code_length);
printf("vector length = %d\n", (int) vector_length);
printf("select queue = %d\n", select_queue_Fpga);
printf("sampled_ms = %d\n", sampled_ms);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);

View File

@ -79,7 +79,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block(
d_single_doppler_flag = false;
d_downsampling_factor = acq_parameters.downsampling_factor;
//printf("AAAAAAAAAA downsampling_factor = %f\n", d_downsampling_factor);
//printf("CONSTRUCTOR downsampling_factor = %d\n", (int) d_downsampling_factor);
d_select_queue_Fpga = acq_parameters.select_queue_Fpga;
//printf("zzzz acq_parameters.code_length = %d\n", acq_parameters.code_length);
//printf("zzzz acq_parameters.samples_per_ms = %d\n", acq_parameters.samples_per_ms);
@ -238,6 +238,8 @@ void pcps_acquisition_fpga::set_active(bool active)
d_input_power = 0.0;
d_mag = 0.0;
int32_t doppler;
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN
<< " ,sample stamp: " << d_sample_counter << ", threshold: "
@ -265,22 +267,56 @@ void pcps_acquisition_fpga::set_active(bool active)
//printf("LAUNCH ACQ\n");
//printf("acq lib d_num_doppler_bins = %d\n", d_num_doppler_bins);
//printf("writing config for channel %d -----------------------------------------\n", (int) d_channel);
//printf("d_downsampling_factor = %f\n", d_downsampling_factor);
//printf("acq_parameters.code_length = %d\n", (int) acq_parameters.code_length);
// debug
// if (acq_parameters.code_length == 12500)
// {
// acquisition_fpga->configure_acquisition_debug();
// acquisition_fpga->set_doppler_sweep(d_num_doppler_bins);
// acquisition_fpga->write_local_code();
// acquisition_fpga->set_block_exp(d_total_block_exp);
//
// acquisition_fpga->run_acquisition();
// acquisition_fpga->read_acquisition_results(&indext, &firstpeak, &secondpeak, &initial_sample, &d_input_power, &d_doppler_index, &total_block_exp);
//
// doppler = 0;
// d_test_statistics = 0;
// }
// else
// {
acquisition_fpga->configure_acquisition();
acquisition_fpga->set_doppler_sweep(d_num_doppler_bins);
//printf("d_num_doppler_bins = %d\n", (int) d_num_doppler_bins);
acquisition_fpga->write_local_code();
//acquisition_fpga->set_doppler_sweep(2);
//printf("acq lib going to launch acquisition\n");
acquisition_fpga->set_block_exp(d_total_block_exp);
//printf("running acq for channel %d\n", (int) d_channel);
acquisition_fpga->run_acquisition();
//printf("acq lib going to read the acquisition results\n");
//read_acquisition_results(&indext, &firstpeak, &secondpeak, &initial_sample, &d_input_power, &d_doppler_index);
//printf("reading results for channel %d\n", (int) d_channel);
acquisition_fpga->read_acquisition_results(&indext, &firstpeak, &secondpeak, &initial_sample, &d_input_power, &d_doppler_index, &total_block_exp);
@ -288,13 +324,27 @@ void pcps_acquisition_fpga::set_active(bool active)
//printf("gnuradio block : d_total_block_exp = %d total_block_exp = %d\n", (int) d_total_block_exp, (int) total_block_exp);
if (total_block_exp > d_total_block_exp)
{
printf("changing blk exp..... d_total_block_exp = %d total_block_exp = %d chan = %d\n", d_total_block_exp, total_block_exp, d_channel);
//getchar();
d_total_block_exp = total_block_exp;
}
// // debug
// if (acq_parameters.code_length == 12500)
// {
// doppler = 0;
// d_test_statistics = 0;
// }
// else
// {
//printf("end channel %d -----------------------------------------------------\n", (int) d_channel);
//printf("READ ACQ RESULTS\n");
@ -305,7 +355,7 @@ void pcps_acquisition_fpga::set_active(bool active)
//usleep(5000000);
//} // end while test
int32_t doppler;
//int32_t doppler;
// NEW SATELLITE DETECTION ALGORITHM STARTS HERE ----------------------------------------------------
@ -328,6 +378,9 @@ void pcps_acquisition_fpga::set_active(bool active)
d_test_statistics = 0.0;
}
// } // debug condition
// // OLD SATELLITE DETECTION ALGORITHM STARTS HERE ----------------------------------------------------
//
// d_mag = magt;

View File

@ -101,6 +101,7 @@ void fpga_acquisition::write_local_code()
{
//printf("#### ACQ: WRITING LOCAL CODE for PRN %d\n", (int) d_PRN);
fpga_acquisition::fpga_configure_acquisition_local_code(
&d_all_fft_codes[d_nsamples_total * (d_PRN - 1)]);
@ -134,7 +135,7 @@ fpga_acquisition::fpga_acquisition(std::string device_name,
d_fd = 0; // driver descriptor
d_map_base = nullptr; // driver memory map
d_all_fft_codes = all_fft_codes;
/*
//printf("acq internal device name = %s\n", d_device_name.c_str());
// open communication with HW accelerator
if ((d_fd = open(d_device_name.c_str(), O_RDWR | O_SYNC)) == -1)
@ -173,7 +174,11 @@ fpga_acquisition::fpga_acquisition(std::string device_name,
//printf("acq lib REG SANITY CHECK SUCCESS\n");
//std::cout << "Acquisition test register sanity check success!" << std::endl;
}
*/
fpga_acquisition::open_device();
fpga_acquisition::reset_acquisition();
fpga_acquisition::fpga_acquisition_test_register();
fpga_acquisition::close_device();
// flag used for testing purposes
d_single_doppler_flag = 0;
@ -183,11 +188,56 @@ fpga_acquisition::fpga_acquisition(std::string device_name,
}
void fpga_acquisition::open_device()
{
//printf("acq internal device name = %s\n", d_device_name.c_str());
// open communication with HW accelerator
if ((d_fd = open(d_device_name.c_str(), O_RDWR | O_SYNC)) == -1)
{
LOG(WARNING) << "Cannot open deviceio" << d_device_name;
std::cout << "Acq: cannot open deviceio" << d_device_name << std::endl;
}
else
{
//printf("acq lib DEVICE OPENED CORRECTLY\n");
}
d_map_base = reinterpret_cast<volatile uint32_t *>(mmap(NULL, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0));
if (d_map_base == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA acquisition module into user memory";
std::cout << "Acq: cannot map deviceio" << d_device_name << std::endl;
}
else
{
//printf("acq lib MAP BASE MAPPED CORRECTLY\n");
}
/*
// sanity check : check test register
uint32_t writeval = TEST_REG_SANITY_CHECK;
uint32_t readval;
readval = fpga_acquisition::fpga_acquisition_test_register(writeval);
if (writeval != readval)
{
LOG(WARNING) << "Acquisition test register sanity check failed";
}
else
{
LOG(INFO) << "Acquisition test register sanity check success!";
//printf("acq lib REG SANITY CHECK SUCCESS\n");
//std::cout << "Acquisition test register sanity check success!" << std::endl;
}
*/
}
fpga_acquisition::~fpga_acquisition()
{
//printf("acq lib destructor called\n");
close_device();
//fpga_acquisition::close_device();
}
@ -198,8 +248,34 @@ bool fpga_acquisition::free()
}
uint32_t fpga_acquisition::fpga_acquisition_test_register(uint32_t writeval)
void fpga_acquisition::fpga_acquisition_test_register()
{
// sanity check : check test register
uint32_t writeval = TEST_REG_SANITY_CHECK;
uint32_t readval;
//printf("acq lib test register called\n");
//uint32_t readval;
// write value to test register
d_map_base[15] = writeval;
// read value from test register
readval = d_map_base[15];
//readval = fpga_acquisition::fpga_acquisition_test_register(writeval);
if (writeval != readval)
{
LOG(WARNING) << "Acquisition test register sanity check failed";
}
else
{
LOG(INFO) << "Acquisition test register sanity check success!";
//printf("acq lib REG SANITY CHECK SUCCESS\n");
//std::cout << "Acquisition test register sanity check success!" << std::endl;
}
/*
//printf("acq lib test register called\n");
uint32_t readval;
// write value to test register
@ -208,6 +284,7 @@ uint32_t fpga_acquisition::fpga_acquisition_test_register(uint32_t writeval)
readval = d_map_base[15];
// return read value
return readval;
*/
}
@ -219,6 +296,10 @@ void fpga_acquisition::fpga_configure_acquisition_local_code(lv_16sc_t fft_local
//printf("acq lib fpga_configure_acquisition_local_code_called\n");
// clear memory address counter
//d_map_base[6] = LOCAL_CODE_CLEAR_MEM;
//printf("writing local code for d_PRN = %d\n", (int) d_PRN);
//printf("writing local code d_nsamples_total = %d\n", (int) d_nsamples_total);
//printf("writing local code d_vector_length = %d\n", (int) d_vector_length);
d_map_base[9] = LOCAL_CODE_CLEAR_MEM;
// write local code
for (k = 0; k < d_vector_length; k++)
@ -250,9 +331,9 @@ void fpga_acquisition::run_acquisition(void)
//printf("acq lib run_acqisition called\n");
// enable interrupts
//int32_t reenable = 1;
int32_t reenable = 1;
//reenable = 1;
//write(d_fd, reinterpret_cast<void *>(&reenable), sizeof(int32_t));
write(d_fd, reinterpret_cast<void *>(&reenable), sizeof(int32_t));
// launch the acquisition process
//printf("acq lib launchin acquisition ...\n");
@ -262,24 +343,24 @@ void fpga_acquisition::run_acquisition(void)
int32_t irq_count;
ssize_t nb;
uint32_t result_valid = 0;
//uint32_t result_valid = 0;
usleep(50);
//usleep(500000);
//printf("acq lib waiting for result valid\n");
while(result_valid == 0)
{
read_result_valid(&result_valid); // polling
}
//while(result_valid == 0)
//{
// read_result_valid(&result_valid); // polling
//}
//printf("result valid\n");
// wait for interrupt
//nb = read(d_fd, &irq_count, sizeof(irq_count));
nb = read(d_fd, &irq_count, sizeof(irq_count));
//usleep(500000); // debug
//printf("interrupt received\n");
//if (nb != sizeof(irq_count))
// {
// printf("acquisition module Read failed to retrieve 4 bytes!\n");
// printf("acquisition module Interrupt number %d\n", irq_count);
// }
if (nb != sizeof(irq_count))
{
printf("acquisition module Read failed to retrieve 4 bytes!\n");
printf("acquisition module Interrupt number %d\n", irq_count);
}
@ -293,6 +374,10 @@ void fpga_acquisition::set_block_exp(uint32_t total_block_exp)
void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps)
{
//printf("writing doppler_max = %d\n", (int) d_doppler_max);
//printf("writing doppler_step = %d\n", (int) d_doppler_step);
//printf("num_sweeps = %d\n", num_sweeps);
if (d_single_doppler_flag == 0)
{
//printf("acq lib set_doppler_sweep called\n");
@ -441,9 +526,12 @@ void fpga_acquisition::set_doppler_sweep_debug(uint32_t num_sweeps, uint32_t dop
void fpga_acquisition::configure_acquisition()
{
fpga_acquisition::open_device();
//printf("acq lib configure acquisition called\n");
//printf("AAA d_select_queue = %d\n", d_select_queue);
d_map_base[0] = d_select_queue;
//d_map_base[0] = 1;
//printf("acq internal writing d_vector_length = %d to d map base 1\n ", d_vector_length);
d_map_base[1] = d_vector_length;
//printf("acq interal writing d_nsamples = %d to d map base 2\n ", d_nsamples);
@ -458,9 +546,30 @@ void fpga_acquisition::configure_acquisition()
}
//void fpga_acquisition::configure_acquisition_debug()
//{
// //printf("acq lib configure acquisition called\n");
// //printf("AAA d_select_queue = %d\n", d_select_queue);
// d_map_base[0] = d_select_queue;
// //printf("acq internal writing d_vector_length = %d to d map base 1\n ", d_vector_length);
// d_map_base[1] = d_vector_length;
// //printf("acq interal writing d_nsamples = %d to d map base 2\n ", d_nsamples);
// d_map_base[2] = d_nsamples;
// //printf("AAA writing LOG2 d_vector_length = %d to d map base 7\n ", (int)log2((float)d_vector_length));
// d_map_base[7] = static_cast<int32_t>(log2(static_cast<float>(d_vector_length))); // log2 FFTlength
// //printf("AAA writing excludelimit = %d to d map base 12\n", (int) d_excludelimit);
// d_map_base[12] = d_excludelimit;
//
// //printf("acquisition debug vector length = %d\n", d_vector_length);
// //printf("acquisition debug vector length = %d\n", (int)log2((float)d_vector_length));
//}
void fpga_acquisition::set_phase_step(uint32_t doppler_index)
{
//printf("acq lib set phase step called\n");
//printf("acq lib set phase step SHOULD NOT BE called\n");
float phase_step_rad_real;
float phase_step_rad_int_temp;
int32_t phase_step_rad_int;
@ -491,7 +600,8 @@ void fpga_acquisition::read_acquisition_results(uint32_t *max_index,
float *firstpeak, float *secondpeak, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index, uint32_t *total_blk_exp)
{
//usleep(500000);
//printf("reading results\n");
//printf("acq lib read_acquisition_results_called\n");
uint64_t initial_sample_tmp = 0;
@ -541,6 +651,10 @@ void fpga_acquisition::read_acquisition_results(uint32_t *max_index,
readval = d_map_base[15]; // read dummy
fpga_acquisition::close_device();
}
@ -585,12 +699,15 @@ void fpga_acquisition::set_single_doppler_flag(unsigned int single_doppler_flag)
// this function is only used for the unit tests
void fpga_acquisition::read_fpga_total_scale_factor(uint32_t *total_scale_factor, uint32_t *fw_scale_factor)
{
uint32_t readval = 0;
readval = d_map_base[8];
*total_scale_factor = readval;
//readval = d_map_base[8];
*fw_scale_factor = 0;
//printf("reading scale factor of %d\n", (int) readval);
}
void fpga_acquisition::read_result_valid(uint32_t *result_valid)

View File

@ -115,7 +115,7 @@ public:
void configure_acquisition(void);
//void configure_acquisition_debug(void);
private:
int64_t d_fs_in;
@ -133,11 +133,11 @@ private:
uint32_t d_doppler_step; // doppler step
uint32_t d_PRN; // PRN
// FPGA private functions
uint32_t fpga_acquisition_test_register(uint32_t writeval);
void fpga_acquisition_test_register(void);
void fpga_configure_acquisition_local_code(lv_16sc_t fft_local_code[]);
//void configure_acquisition();
void close_device();
void open_device();
void read_result_valid(uint32_t *result_valid);
// test parameters

View File

@ -140,6 +140,8 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
float* ca_codes_f;
float* data_codes_f;
printf("trk_param_fpga.track_pilot = %d\n", trk_param_fpga.track_pilot);
if (trk_param_fpga.track_pilot)
{
d_data_codes = static_cast<int*>(volk_gnsssdr_malloc((static_cast<unsigned int>(Galileo_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * Galileo_E1_NUMBER_OF_CODES * sizeof(int), volk_gnsssdr_get_alignment()));
@ -155,6 +157,8 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
//int kk;
for (unsigned int PRN = 1; PRN <= Galileo_E1_NUMBER_OF_CODES; PRN++)
{
char data_signal[3] = "1B";
@ -170,6 +174,9 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
d_ca_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int>(ca_codes_f[s]);
d_data_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int>(data_codes_f[s]);
//printf("%f %d | ", data_codes_f[s], d_data_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
//printf("data_codes_f[%d] = %f\n", s, data_codes_f[s]);
//printf("d_ca_codes[%d] = %d\n", static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s, d_data_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s]);
}
//printf("\n next \n");
//scanf ("%d",&kk);
@ -183,6 +190,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
{
d_ca_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int>(ca_codes_f[s]);
//printf("%f %d | ", ca_codes_f[s], d_ca_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
}
//printf("\n next \n");
//scanf ("%d",&kk);

View File

@ -142,6 +142,11 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
{
gps_l1_ca_code_gen_int(&d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0);
// debug
// for (int kk=0;kk<int(GPS_L1_CA_CODE_LENGTH_CHIPS);kk++)
// {
// printf("d_ca_codes[%d] = %d\n", (int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + kk , d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + kk]);
// }
}
trk_param_fpga.ca_codes = d_ca_codes;
trk_param_fpga.code_length_chips = GPS_L1_CA_CODE_LENGTH_CHIPS;

View File

@ -62,7 +62,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
//################# CONFIGURATION PARAMETERS ########################
//std::string default_item_type = "gr_complex";
//std::string item_type = configuration->property(role + ".item_type", default_item_type);
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000);
int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
trk_param_fpga.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
@ -86,6 +86,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
trk_param_fpga.early_late_space_chips = early_late_space_chips;
int vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L5i_CODE_RATE_HZ) / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS)));
trk_param_fpga.vector_length = vector_length;
printf("trk vector length = %d\n", vector_length);
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.15);
trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips;
@ -121,11 +122,12 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
trk_param_fpga.max_lock_fail = max_lock_fail;
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.75);
if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th;
trk_param_fpga.carrier_lock_th = carrier_lock_th;
// FPGA configuration parameters
std::string default_device_name = "/dev/uio";
std::string device_name = configuration->property(role + ".devicename", default_device_name);
trk_param_fpga.device_name = device_name;
@ -133,7 +135,6 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
trk_param_fpga.device_base = device_base;
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 0);
trk_param_fpga.multicorr_type = 0; //multicorr_type : 0 -> 3 correlators, 1 -> 5 correlators
//################# PRE-COMPUTE ALL THE CODES #################
unsigned int code_samples_per_chip = 1;
unsigned int code_length_chips = static_cast<unsigned int>(GPS_L5i_CODE_LENGTH_CHIPS);
@ -178,14 +179,31 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
gps_l5i_code_gen_float(tracking_code, PRN);
for (unsigned int s = 0; s < code_length_chips; s++)
{
d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(data_code[s]);
d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(tracking_code[s]);
// if (d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] == -1)
// {
// d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = 1;
// }
// else
// {
// d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = 0;
// }
// printf("tracking_code[%d] = %f\n", s, tracking_code[s]);
// printf("d_ca_codes[%d] = %d\n", static_cast<int>(code_length_chips) * (PRN - 1) + s, d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s]);
//printf("%f %d | ", ca_codes_f[s], d_ca_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
//printf("d_ca_codes[%d] = %d\n", static_cast<int>(code_length_chips) * (PRN - 1) + s, d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s]);
}
}
}
//printf("end \n");
delete[] tracking_code;
if (trk_param_fpga.track_pilot)
{

View File

@ -498,9 +498,13 @@ void dll_pll_veml_tracking_fpga::start_tracking()
d_acq_code_phase_samples = corrected_acq_phase_samples;
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / trk_parameters.fs_in;
//printf("d_carrier_doppler_hz = %f\n", d_carrier_doppler_hz);
//printf("d_carrier_phase_step_rad = %f\n", d_carrier_phase_step_rad);
// DLL/PLL filter initialization
d_carrier_loop_filter.initialize(); // initialize the carrier filter
d_code_loop_filter.initialize(); // initialize the code filter
@ -693,8 +697,10 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra
{
//printf("kkkkkkkkkkkkk d_cn0_estimation_counter = %d\n", d_cn0_estimation_counter);
//printf("trk_parameters.cn0_samples = %d\n", trk_parameters.cn0_samples);
// printf("trk_parameters.cn0_samples = %d\n", trk_parameters.cn0_samples);
// printf("d_cn0_estimation_counter = %d\n", d_cn0_estimation_counter);
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
if (d_cn0_estimation_counter < trk_parameters.cn0_samples)
{
// fill buffer with prompt correlator output values
@ -708,6 +714,9 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra
d_cn0_estimation_counter = 0;
// Code lock indicator
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, trk_parameters.cn0_samples, coh_integration_time_s);
// Carrier lock indicator
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples);
// Loss of lock detection
@ -717,6 +726,14 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra
//printf("trk_parameters.cn0_min = %f\n", trk_parameters.cn0_min);
//printf("d_carrier_lock_fail_counter = %d\n", d_carrier_lock_fail_counter);
//printf("trk_parameters.max_lock_fail = %d\n", trk_parameters.max_lock_fail);
// printf("d_CN0_SNV_dB_Hz = %f\n", d_CN0_SNV_dB_Hz);
// printf("d_carrier_lock_threshold = %f\n", d_carrier_lock_threshold);
// printf("trk_parameters.cn0_min = %d\n", trk_parameters.cn0_min);
// printf("trk_parameters.cn0_samples = %d\n", trk_parameters.cn0_samples);
// printf("d_carrier_lock_test = %f\n", d_carrier_lock_test);
// printf("d_carrier_lock_threshold = %f\n", d_carrier_lock_threshold);
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < trk_parameters.cn0_min)
{
d_carrier_lock_fail_counter++;
@ -1299,6 +1316,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
}
case 1: // Standby - Consume samples at full throttle, do nothing
{
//printf("d_state = 1\n");
d_pull_in = 0;
multicorrelator_fpga->lock_channel();
uint64_t counter_value = multicorrelator_fpga->read_sample_counter();
@ -1340,6 +1358,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
case 2:
{
//printf("d_state = 2\n");
//printf("trk state 2 counter value = %" PRIu64 "\n", multicorrelator_fpga->read_sample_counter());
d_sample_counter = d_sample_counter_next;
d_sample_counter_next = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
@ -1393,6 +1412,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
d_Prompt_buffer_deque.push_back(*d_Prompt);
if (d_Prompt_buffer_deque.size() == d_secondary_code_length)
{
//printf("Secondary code lock\n");
next_state = acquire_secondary();
if (next_state)
{
@ -1556,6 +1576,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
}
else
{
//printf(" do not enable extended integration\n");
d_state = 4;
}
}
@ -1566,6 +1587,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
case 3:
{
//printf("d_state = 3\n");
//printf("trk state 3 counter value = %" PRIu64 "\n", multicorrelator_fpga->read_sample_counter());
d_sample_counter = d_sample_counter_next;
d_sample_counter_next = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
@ -1638,6 +1660,8 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
d_rem_code_phase_chips * static_cast<float>(d_code_samples_per_chip), d_code_phase_step_chips * static_cast<float>(d_code_samples_per_chip),
d_current_prn_length_samples);
//printf("d_cloop = %d\n", d_cloop);
//printf("trk_parameters.extend_correlation_symbols = %d\n", trk_parameters.extend_correlation_symbols);
save_correlation_results();
// check lock status
@ -1652,6 +1676,8 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
update_tracking_vars();
// ########### Output the tracking results to Telemetry block ##########
//printf("state 4 interchange_iq = %d\n", interchange_iq);
//printf("state 4 trk_parameters.track_pilot = %d\n", trk_parameters.track_pilot);
if (interchange_iq)
{
if (trk_parameters.track_pilot)

View File

@ -423,6 +423,7 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PR
//printf("kkk select_fpga_correlator = %x\n", select_fpga_correlator);
d_map_base[d_PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_CLEAR_ADDRESS_COUNTER;
//printf("trk lib d_code_length_chips = %d, d_code_samples_per_chip = %d\n", d_code_length_chips, d_code_samples_per_chip);
for (k = 0; k < d_code_length_chips * d_code_samples_per_chip; k++)
{
//if (d_local_code_in[k] == 1)
@ -708,6 +709,7 @@ void fpga_multicorrelator_8sc::unlock_channel(void)
// unlock the channel to let the next samples go through
//printf("www writing 1 to d map base %d = drop samples\n", d_DROP_SAMPLES_REG_ADDR);
d_map_base[d_DROP_SAMPLES_REG_ADDR] = 1; // unlock the channel
d_map_base[23] = 1; // set the tracking module back to idle
}
void fpga_multicorrelator_8sc::close_device()

View File

@ -79,7 +79,7 @@
#define TEST_OBS_MAX_INPUT_COMPLEX_SAMPLES_TOTAL 8192 // maximum DMA sample block size in complex samples
#define TEST_OBS_COMPLEX_SAMPLE_SIZE 2 // sample size in bytes
#define TEST_OBS_NUM_QUEUES 2 // number of queues (1 for GPS L1/Galileo E1, and 1 for GPS L5/Galileo E5)
#define TEST_OBS_NSAMPLES_TRACKING 850000000 // number of samples during which we test the tracking module
#define TEST_OBS_NSAMPLES_TRACKING 1000000000 // number of samples during which we test the tracking module
#define TEST_OBS_NSAMPLES_FINAL 50000 // number of samples sent after running tracking to unblock the SW if it is waiting for an interrupt of the tracking module
#define TEST_OBS_NSAMPLES_ACQ_DOPPLER_SWEEP 50000000 // number of samples sent to the acquisition module when running acquisition when the HW controls the doppler loop
#define DOWNAMPLING_FILTER_INIT_SAMPLES 100 // some samples to initialize the state of the downsampling filter
@ -442,6 +442,7 @@ void *handler_DMA_obs_test(void *arguments)
//printf("enter kk");
//scanf("%d", &kk);
//printf("args->freq_band = %d\n", (int) args->freq_band);
while (file_completed == false)
{
//printf("samples sent = %d\n", nsamples);
@ -455,11 +456,11 @@ void *handler_DMA_obs_test(void *arguments)
file_completed = true;
}
nread_elements = fread(input_samples, sizeof(int8_t), nsamples_block*COMPLEX_SAMPLE_SIZE, rx_signal_file_id);
nread_elements = fread(input_samples_obs_test, sizeof(int8_t), nsamples_block*COMPLEX_SAMPLE_SIZE, rx_signal_file_id);
if (nread_elements != nsamples_block * COMPLEX_SAMPLE_SIZE)
{
printf("could not read the desired number of samples from the input file\n");
printf("file completed\n");
file_completed = true;
}
@ -474,25 +475,25 @@ void *handler_DMA_obs_test(void *arguments)
if (args->freq_band == 0)
{
// channel 1 (queue 1) -> E5/L5
input_samples_dma[dma_index] = 0;
input_samples_dma[dma_index+1] = 0;
input_samples_dma_obs_test[dma_index] = 0;
input_samples_dma_obs_test[dma_index+1] = 0;
// channel 0 (queue 0) -> E1/L1
input_samples_dma[dma_index+2] = input_samples[index0];
input_samples_dma[dma_index+3] = input_samples[index0+1];
input_samples_dma_obs_test[dma_index+2] = input_samples_obs_test[index0];
input_samples_dma_obs_test[dma_index+3] = input_samples_obs_test[index0+1];
}
else
{
// channel 1 (queue 1) -> E5/L5
input_samples_dma[dma_index] = input_samples[index0];
input_samples_dma[dma_index+1] = input_samples[index0+1];
input_samples_dma_obs_test[dma_index] = input_samples_obs_test[index0];
input_samples_dma_obs_test[dma_index+1] = input_samples_obs_test[index0+1];
// channel 0 (queue 0) -> E1/L1
input_samples_dma[dma_index+2] = 0;
input_samples_dma[dma_index+3] = 0;
input_samples_dma_obs_test[dma_index+2] = 0;
input_samples_dma_obs_test[dma_index+3] = 0;
}
dma_index += 4;
}
//printf("writing samples to send\n");
nsamples_transmitted = write(tx_fd, &input_samples_dma[0], nread_elements*NUM_QUEUES);
nsamples_transmitted = write(tx_fd, &input_samples_dma_obs_test[0], nread_elements*NUM_QUEUES);
//printf("exited writing samples to send\n");
if (nsamples_transmitted != nread_elements*NUM_QUEUES)
{
@ -527,6 +528,10 @@ bool HybridObservablesTestFpga::acquire_signal()
baseband_sampling_freq_acquisition = baseband_sampling_freq/4; // downsampling filter in L1/E1
//printf(" aaaaaa baseband_sampling_freq_acquisition = %d\n", baseband_sampling_freq_acquisition);
}
else
{
baseband_sampling_freq_acquisition = baseband_sampling_freq;
}
// 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m)
gr::top_block_sptr top_block;
@ -546,8 +551,8 @@ bool HybridObservablesTestFpga::acquire_signal()
config->set_property("Acquisition.item_type", "cshort");
config->set_property("Acquisition.if", "0");
config->set_property("Acquisition.sampled_ms", "4");
config->set_property("Acquisition.select_queue_Fpga", "0");
//config->set_property("Acquisition.sampled_ms", "4");
//config->set_property("Acquisition.select_queue_Fpga", "0");
config->set_property("Acquisition.devicename", "/dev/uio0");
if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
@ -567,6 +572,8 @@ bool HybridObservablesTestFpga::acquire_signal()
//printf("AAAAAAAAAAAAAAAAAAAAA\n");
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.select_queue_Fpga", "0");
config->set_property("Acquisition.sampled_ms", "1");
//printf("AAAAAAAAAAAAAAAAAAAAA2222\n");
tmp_gnss_synchro.System = 'G';
std::string signal = "1C";
@ -585,6 +592,8 @@ bool HybridObservablesTestFpga::acquire_signal()
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.select_queue_Fpga", "0");
config->set_property("Acquisition.sampled_ms", "4");
tmp_gnss_synchro.System = 'E';
std::string signal = "1B";
signal.copy(tmp_gnss_synchro.Signal, 2, 0);
@ -628,6 +637,8 @@ bool HybridObservablesTestFpga::acquire_signal()
else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.select_queue_Fpga", "1");
config->set_property("Acquisition.sampled_ms", "1");
tmp_gnss_synchro.System = 'E';
std::string signal = "5X";
signal.copy(tmp_gnss_synchro.Signal, 2, 0);
@ -644,6 +655,8 @@ bool HybridObservablesTestFpga::acquire_signal()
}
else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.select_queue_Fpga", "1");
config->set_property("Acquisition.sampled_ms", "1");
tmp_gnss_synchro.System = 'G';
std::string signal = "L5";
signal.copy(tmp_gnss_synchro.Signal, 2, 0);
@ -755,13 +768,13 @@ bool HybridObservablesTestFpga::acquire_signal()
}
else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_Fpga") == 0)
{
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS)));
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq_acquisition) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS)));
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS)));
}
else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)
{
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5i_CODE_RATE_HZ / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS))));
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq_acquisition) / (GPS_L5i_CODE_RATE_HZ / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS))));
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5i_CODE_RATE_HZ / GPS_L5i_CODE_LENGTH_CHIPS)));
}
@ -1199,12 +1212,14 @@ bool HybridObservablesTestFpga::acquire_signal()
args.file = file;
send_samples_start_obs_test = 0;
if ((implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0) or (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0))
{
//printf("gggggggg \n");
//----------------------------------------------------------------------------------
// send the previous samples to set the downsampling filter in a good condition
send_samples_start = 0;
//send_samples_start = 0;
args.skip_used_samples = - DOWNAMPLING_FILTER_INIT_SAMPLES; // set the counter 2000 samples before
@ -1212,15 +1227,15 @@ bool HybridObservablesTestFpga::acquire_signal()
//printf("sending pre init %d\n", args.nsamples_tx);
if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0)
if (pthread_create(&thread_DMA, NULL, handler_DMA_obs_test, (void *)&args) < 0)
{
printf("ERROR cannot create DMA Process\n");
}
pthread_mutex_lock(&mutex);
send_samples_start = 1;
send_samples_start_obs_test = 1;
pthread_mutex_unlock(&mutex);
pthread_join(thread_DMA, NULL);
send_samples_start = 0;
send_samples_start_obs_test = 0;
//printf("finished sending samples init filter status\n");
//-----------------------------------------------------------------------------------
@ -1241,10 +1256,11 @@ bool HybridObservablesTestFpga::acquire_signal()
// create DMA child process
//printf("||||||||1 args freq_band = %d\n", args.freq_band);
//printf("sending samples main DMA %d\n", args.nsamples_tx);
if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0)
if (pthread_create(&thread_DMA, NULL, handler_DMA_obs_test, (void *)&args) < 0)
{
printf("ERROR cannot create DMA Process\n");
}
@ -1253,7 +1269,7 @@ bool HybridObservablesTestFpga::acquire_signal()
top_block->start();
pthread_mutex_lock(&mutex);
send_samples_start = 1;
send_samples_start_obs_test = 1;
pthread_mutex_unlock(&mutex);
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
@ -1290,7 +1306,7 @@ bool HybridObservablesTestFpga::acquire_signal()
pthread_join(thread_DMA, NULL);
pthread_mutex_lock(&mutex);
send_samples_start = 0;
send_samples_start_obs_test = 0;
pthread_mutex_unlock(&mutex);
while (msg_rx->rx_message == 0)
@ -2193,7 +2209,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
gnss_synchro_vec.push_back(tmp_gnss_synchro);
}
}
printf("KKKKKKKKK FIRST PART FINISHED\n");
//printf("KKKKKKKKK FIRST PART FINISHED\n");
//printf("@@@@@@@@@@@@@@@@@@@@@@@@@@ Signal Acquired\n");
configure_receiver(FLAGS_PLL_bw_hz_start,
@ -2486,7 +2502,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
//if (test_observables_skip_samples_already_used == 1 && test_observables_doppler_control_in_sw == 1)
//{
// skip the samples that have already been used
args.skip_used_samples = args.nsamples_tx;
args.skip_used_samples = 0; //args.nsamples_tx;
//}
//else
//{

View File

@ -589,12 +589,16 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
baseband_sampling_freq_acquisition = baseband_sampling_freq/4; // downsampling filter in L1/E1
printf(" aaaaaa baseband_sampling_freq_acquisition = %d\n", baseband_sampling_freq_acquisition);
//printf(" aaaaaa baseband_sampling_freq_acquisition = %d\n", baseband_sampling_freq_acquisition);
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
{
baseband_sampling_freq_acquisition = baseband_sampling_freq/4; // downsampling filter in L1/E1
printf(" aaaaaa baseband_sampling_freq_acquisition = %d\n", baseband_sampling_freq_acquisition);
//printf(" aaaaaa baseband_sampling_freq_acquisition = %d\n", baseband_sampling_freq_acquisition);
}
else
{
baseband_sampling_freq_acquisition = baseband_sampling_freq;
}
// 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m)
@ -614,8 +618,8 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
config->set_property("Acquisition.item_type", "cshort");
config->set_property("Acquisition.if", "0");
config->set_property("Acquisition.sampled_ms", "4");
config->set_property("Acquisition.select_queue_Fpga", "0");
//config->set_property("Acquisition.sampled_ms", "4");
//config->set_property("Acquisition.select_queue_Fpga", "0");
config->set_property("Acquisition.devicename", "/dev/uio0");
if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
@ -632,7 +636,10 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0)
{
tmp_gnss_synchro.System = 'G';
config->set_property("Acquisition.sampled_ms", "1");
config->set_property("Acquisition.select_queue_Fpga", "0");
tmp_gnss_synchro.System = 'G';
std::string signal = "1C";
const char* str = signal.c_str(); // get a C style null terminated string
std::memcpy(static_cast<void*>(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null
@ -649,6 +656,9 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.sampled_ms", "4");
config->set_property("Acquisition.select_queue_Fpga", "0");
tmp_gnss_synchro.System = 'E';
std::string signal = "1B";
const char* str = signal.c_str(); // get a C style null terminated string
@ -667,6 +677,8 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
}
else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.sampled_ms", "1");
config->set_property("Acquisition.select_queue_Fpga", "1");
tmp_gnss_synchro.System = 'E';
std::string signal = "5X";
const char* str = signal.c_str(); // get a C style null terminated string
@ -684,6 +696,9 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
}
else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)
{
config->set_property("Acquisition.sampled_ms", "1");
config->set_property("Acquisition.select_queue_Fpga", "1");
printf("CORRECT L5 A!!!\n");
tmp_gnss_synchro.System = 'G';
std::string signal = "L5";
const char* str = signal.c_str(); // get a C style null terminated string
@ -739,6 +754,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
}
else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)
{
printf("CORRECT L5 B!!!\n");
top_block->msg_connect(acquisition_GpsL5_Fpga->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
}
@ -794,6 +810,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
}
else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)
{
printf("CORRECT L5 C !!!!");
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5i_CODE_RATE_HZ / static_cast<double>(GPS_L5i_CODE_LENGTH_CHIPS))));
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
}
@ -830,6 +847,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
}
else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)
{
acquisition_GpsL5_Fpga->set_single_doppler_flag(1);
}
@ -1326,6 +1344,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
start_msg = false;
}
//printf("wait for DMA to finish\n");
// wait for the child DMA process to finish
pthread_join(thread_DMA, NULL);
@ -1620,7 +1639,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
unsigned int fft_size = pow(2, nbits);
printf("####################################\n");
//printf("####################################\n");
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
{
std::vector<double> pull_in_results_v;
@ -1641,8 +1660,12 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
//simulate Code Delay error in acquisition
gnss_synchro.Acq_delay_samples = true_acq_delay_samples + (acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx) / GPS_L1_CA_CODE_RATE_HZ) * static_cast<double>(baseband_sampling_freq);
// debug
//printf("forcing data\n");
//gnss_synchro.Acq_samplestamp_samples = 37500;
//gnss_synchro.Acq_delay_samples = 2933;
//printf("acq_samplestamp_samples = %d\n", (int)gnss_synchro.Acq_samplestamp_samples);
//printf("true_acq_delay_samples = %d\n", (int)gnss_synchro.Acq_delay_samples);
//create flowgraph