mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
implemented tracking pull-in tests for the FPGA
solved a bug in which the SW was using the doppler shift index reported by the HW acquisition accelerator plus one, instead of using the doppler shift index as such.
This commit is contained in:
parent
57c358d1b1
commit
5b9b63cc77
@ -472,6 +472,24 @@ void GalileoE1PcpsAmbiguousAcquisitionFpga::set_state(int state)
|
||||
// return threshold;
|
||||
//}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GalileoE1PcpsAmbiguousAcquisitionFpga::set_single_doppler_flag(unsigned int single_doppler_flag)
|
||||
{
|
||||
acquisition_fpga_->set_single_doppler_flag(single_doppler_flag);
|
||||
}
|
||||
// this function is only used for the unit tests
|
||||
void GalileoE1PcpsAmbiguousAcquisitionFpga::read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index)
|
||||
{
|
||||
acquisition_fpga_->read_acquisition_results(max_index, max_magnitude,
|
||||
initial_sample, power_sum, doppler_index);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GalileoE1PcpsAmbiguousAcquisitionFpga::reset_acquisition(void)
|
||||
{
|
||||
acquisition_fpga_->reset_acquisition();
|
||||
}
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisitionFpga::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
|
@ -136,6 +136,21 @@ public:
|
||||
*/
|
||||
void set_state(int state) override;
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void set_single_doppler_flag(unsigned int single_doppler_flag);
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index);
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
//pcps_acquisition_sptr acquisition_;
|
||||
|
@ -356,6 +356,24 @@ void GalileoE5aPcpsAcquisitionFpga::set_state(int state)
|
||||
acquisition_fpga_->set_state(state);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GalileoE5aPcpsAcquisitionFpga::set_single_doppler_flag(unsigned int single_doppler_flag)
|
||||
{
|
||||
acquisition_fpga_->set_single_doppler_flag(single_doppler_flag);
|
||||
}
|
||||
// this function is only used for the unit tests
|
||||
void GalileoE5aPcpsAcquisitionFpga::read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index)
|
||||
{
|
||||
acquisition_fpga_->read_acquisition_results(max_index, max_magnitude,
|
||||
initial_sample, power_sum, doppler_index);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GalileoE5aPcpsAcquisitionFpga::reset_acquisition(void)
|
||||
{
|
||||
acquisition_fpga_->reset_acquisition();
|
||||
}
|
||||
|
||||
void GalileoE5aPcpsAcquisitionFpga::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
|
@ -124,6 +124,21 @@ public:
|
||||
*/
|
||||
void set_state(int state) override;
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void set_single_doppler_flag(unsigned int single_doppler_flag);
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index);
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
private:
|
||||
//float calculate_threshold(float pfa);
|
||||
|
||||
|
@ -71,7 +71,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
|
||||
//printf("####### DEBUG Acq: fs_in = %d\n", fs_in);
|
||||
acq_parameters.fs_in = fs_in;
|
||||
acq_parameters.samples_per_code = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters.fs_in)));
|
||||
//acq_parameters.samples_per_code = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters.fs_in)));
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||
acq_parameters.doppler_max = doppler_max_;
|
||||
@ -258,6 +258,26 @@ void GpsL1CaPcpsAcquisitionFpga::set_state(int state)
|
||||
acquisition_fpga_->set_state(state);
|
||||
}
|
||||
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GpsL1CaPcpsAcquisitionFpga::set_single_doppler_flag(unsigned int single_doppler_flag)
|
||||
{
|
||||
acquisition_fpga_->set_single_doppler_flag(single_doppler_flag);
|
||||
}
|
||||
// this function is only used for the unit tests
|
||||
void GpsL1CaPcpsAcquisitionFpga::read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index)
|
||||
{
|
||||
acquisition_fpga_->read_acquisition_results(max_index, max_magnitude,
|
||||
initial_sample, power_sum, doppler_index);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GpsL1CaPcpsAcquisitionFpga::reset_acquisition(void)
|
||||
{
|
||||
acquisition_fpga_->reset_acquisition();
|
||||
}
|
||||
|
||||
void GpsL1CaPcpsAcquisitionFpga::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
// nothing to connect
|
||||
|
@ -134,6 +134,21 @@ public:
|
||||
*/
|
||||
void set_state(int state) override;
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void set_single_doppler_flag(unsigned int single_doppler_flag);
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index);
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_fpga_sptr acquisition_fpga_;
|
||||
|
@ -323,6 +323,26 @@ void GpsL5iPcpsAcquisitionFpga::set_state(int state)
|
||||
//}
|
||||
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GpsL5iPcpsAcquisitionFpga::set_single_doppler_flag(unsigned int single_doppler_flag)
|
||||
{
|
||||
acquisition_fpga_->set_single_doppler_flag(single_doppler_flag);
|
||||
}
|
||||
// this function is only used for the unit tests
|
||||
void GpsL5iPcpsAcquisitionFpga::read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index)
|
||||
{
|
||||
acquisition_fpga_->read_acquisition_results(max_index, max_magnitude,
|
||||
initial_sample, power_sum, doppler_index);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void GpsL5iPcpsAcquisitionFpga::reset_acquisition(void)
|
||||
{
|
||||
acquisition_fpga_->reset_acquisition();
|
||||
}
|
||||
|
||||
|
||||
void GpsL5iPcpsAcquisitionFpga::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
// if (item_type_.compare("gr_complex") == 0)
|
||||
|
@ -134,6 +134,21 @@ public:
|
||||
*/
|
||||
void set_state(int state) override;
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void set_single_doppler_flag(unsigned int single_doppler_flag);
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index);
|
||||
|
||||
/*!
|
||||
* \brief This function is only used in the unit tests
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
//pcps_acquisition_sptr acquisition_;
|
||||
|
@ -130,8 +130,10 @@ void pcps_acquisition_fpga::init()
|
||||
d_gnss_synchro->Acq_samplestamp_samples = 0;
|
||||
d_mag = 0.0;
|
||||
d_input_power = 0.0;
|
||||
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||
|
||||
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step))) + 1;
|
||||
//printf("acq gnuradioblock doppler_max = %lu\n", (unsigned long) static_cast<int32_t>(acq_parameters.doppler_max));
|
||||
//printf("acq gnuradioblock doppler_step = %lu\n", (unsigned long) d_doppler_step);
|
||||
//printf("acq gnuradioblock d_num_doppler_bins = %lu\n", (unsigned long) d_num_doppler_bins);
|
||||
acquisition_fpga->init();
|
||||
// printf("acq init end\n");
|
||||
}
|
||||
@ -290,15 +292,15 @@ void pcps_acquisition_fpga::set_active(bool active)
|
||||
|
||||
|
||||
// debug
|
||||
debug_d_max_absolute = magt;
|
||||
debug_d_input_power_absolute = d_input_power;
|
||||
debug_indext = indext;
|
||||
debug_doppler_index = d_doppler_index;
|
||||
//debug_d_max_absolute = magt;
|
||||
//debug_d_input_power_absolute = d_input_power;
|
||||
//debug_indext = indext;
|
||||
//debug_doppler_index = d_doppler_index;
|
||||
|
||||
// temp_d_input_power = d_input_power;
|
||||
|
||||
d_input_power = (d_input_power - d_mag) / (d_fft_size - 1);
|
||||
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * d_doppler_index;
|
||||
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * (d_doppler_index - 1);
|
||||
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext % (2*acq_parameters.samples_per_code)));
|
||||
|
||||
|
||||
@ -382,3 +384,26 @@ int pcps_acquisition_fpga::general_work(int noutput_items __attribute__((unused)
|
||||
// the general work is not used with the acquisition that uses the FPGA
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void pcps_acquisition_fpga::set_single_doppler_flag(unsigned int single_doppler_flag)
|
||||
{
|
||||
acquisition_fpga->set_single_doppler_flag(single_doppler_flag);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void pcps_acquisition_fpga::read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index)
|
||||
{
|
||||
acquisition_fpga->read_acquisition_results(max_index, max_magnitude,
|
||||
initial_sample, power_sum, doppler_index);
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void pcps_acquisition_fpga::reset_acquisition(void)
|
||||
{
|
||||
acquisition_fpga->reset_acquisition();
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,14 +119,16 @@ private:
|
||||
std::shared_ptr<fpga_acquisition> acquisition_fpga;
|
||||
|
||||
// debug
|
||||
float debug_d_max_absolute;
|
||||
float debug_d_input_power_absolute;
|
||||
int32_t debug_indext;
|
||||
int32_t debug_doppler_index;
|
||||
//float debug_d_max_absolute;
|
||||
//float debug_d_input_power_absolute;
|
||||
//int32_t debug_indext;
|
||||
//int32_t debug_doppler_index;
|
||||
|
||||
float d_downsampling_factor;
|
||||
uint32_t d_select_queue_Fpga;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
~pcps_acquisition_fpga();
|
||||
|
||||
@ -228,6 +230,22 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
/*!
|
||||
* \brief This function is only used for the unit tests
|
||||
*/
|
||||
void set_single_doppler_flag(unsigned int single_doppler_flag);
|
||||
|
||||
/*!
|
||||
* \brief This funciton is only used for the unit tests
|
||||
*/
|
||||
void read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index);
|
||||
|
||||
/*!
|
||||
* \brief This funciton is only used for the unit tests
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_ACQUISITION_FPGA_H_*/
|
||||
|
@ -156,7 +156,12 @@ fpga_acquisition::fpga_acquisition(std::string device_name,
|
||||
//std::cout << "Acquisition test register sanity check success!" << std::endl;
|
||||
}
|
||||
fpga_acquisition::reset_acquisition();
|
||||
|
||||
// flag used for testing purposes
|
||||
d_single_doppler_flag = 0;
|
||||
|
||||
DLOG(INFO) << "Acquisition FPGA class created";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -246,51 +251,102 @@ void fpga_acquisition::run_acquisition(void)
|
||||
|
||||
void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps)
|
||||
{
|
||||
//printf("acq lib set_doppler_sweep called\n");
|
||||
float phase_step_rad_real;
|
||||
float phase_step_rad_int_temp;
|
||||
int32_t phase_step_rad_int;
|
||||
//int32_t doppler = static_cast<int32_t>(-d_doppler_max) + d_doppler_step * doppler_index;
|
||||
int32_t doppler = static_cast<int32_t>(-d_doppler_max);
|
||||
//float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast<float>(d_fs_in);
|
||||
float phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
|
||||
// The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing
|
||||
// The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi)
|
||||
// The FPGA also expects the phase to be negative since it produces cos(x) -j*sin(x)
|
||||
// while the gnss-sdr software (volk_gnsssdr_s32f_sincos_32fc) generates cos(x) + j*sin(x)
|
||||
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
|
||||
// avoid saturation of the fixed point representation in the fpga
|
||||
// (only the positive value can saturate due to the 2's complement representation)
|
||||
if (d_single_doppler_flag == 0)
|
||||
{
|
||||
//printf("acq lib set_doppler_sweep called\n");
|
||||
float phase_step_rad_real;
|
||||
float phase_step_rad_int_temp;
|
||||
int32_t phase_step_rad_int;
|
||||
//int32_t doppler = static_cast<int32_t>(-d_doppler_max) + d_doppler_step * doppler_index;
|
||||
int32_t doppler = static_cast<int32_t>(-d_doppler_max);
|
||||
//float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast<float>(d_fs_in);
|
||||
float phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
|
||||
// The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing
|
||||
// The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi)
|
||||
// The FPGA also expects the phase to be negative since it produces cos(x) -j*sin(x)
|
||||
// while the gnss-sdr software (volk_gnsssdr_s32f_sincos_32fc) generates cos(x) + j*sin(x)
|
||||
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
|
||||
// avoid saturation of the fixed point representation in the fpga
|
||||
// (only the positive value can saturate due to the 2's complement representation)
|
||||
|
||||
//printf("AAA phase_step_rad_real for initial doppler = %f\n", phase_step_rad_real);
|
||||
if (phase_step_rad_real >= 1.0)
|
||||
{
|
||||
phase_step_rad_real = MAX_PHASE_STEP_RAD;
|
||||
}
|
||||
//printf("AAA phase_step_rad_real for initial doppler after checking = %f\n", phase_step_rad_real);
|
||||
phase_step_rad_int_temp = phase_step_rad_real * POW_2_2; // * 2^2
|
||||
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_int_temp * (POW_2_29)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
|
||||
//printf("AAA writing phase_step_rad_int for initial doppler = %d to d map base 3\n", phase_step_rad_int);
|
||||
d_map_base[3] = phase_step_rad_int;
|
||||
//printf("AAA phase_step_rad_real for initial doppler = %f\n", phase_step_rad_real);
|
||||
if (phase_step_rad_real >= 1.0)
|
||||
{
|
||||
phase_step_rad_real = MAX_PHASE_STEP_RAD;
|
||||
}
|
||||
//printf("AAA phase_step_rad_real for initial doppler after checking = %f\n", phase_step_rad_real);
|
||||
phase_step_rad_int_temp = phase_step_rad_real * POW_2_2; // * 2^2
|
||||
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_int_temp * (POW_2_29)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
|
||||
//printf("AAA writing phase_step_rad_int for initial doppler = %d to d map base 3\n", phase_step_rad_int);
|
||||
d_map_base[3] = phase_step_rad_int;
|
||||
|
||||
// repeat the calculation with the doppler step
|
||||
doppler = static_cast<int32_t>(d_doppler_step);
|
||||
phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
|
||||
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
|
||||
//printf("AAA phase_step_rad_real for doppler step = %f\n", phase_step_rad_real);
|
||||
if (phase_step_rad_real >= 1.0)
|
||||
{
|
||||
phase_step_rad_real = MAX_PHASE_STEP_RAD;
|
||||
}
|
||||
//printf("AAA phase_step_rad_real for doppler step after checking = %f\n", phase_step_rad_real);
|
||||
phase_step_rad_int_temp = phase_step_rad_real * POW_2_2; // * 2^2
|
||||
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_int_temp * (POW_2_29)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
|
||||
//printf("AAA writing phase_step_rad_int for doppler step = %d to d map base 4\n", phase_step_rad_int);
|
||||
d_map_base[4] = phase_step_rad_int;
|
||||
//printf("AAA writing num sweeps to d map base 5 = %d\n", num_sweeps);
|
||||
d_map_base[5] = num_sweeps;
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("acq lib set_doppler_sweep called\n");
|
||||
float phase_step_rad_real;
|
||||
float phase_step_rad_int_temp;
|
||||
int32_t phase_step_rad_int;
|
||||
//int32_t doppler = static_cast<int32_t>(-d_doppler_max) + d_doppler_step * doppler_index;
|
||||
int32_t doppler = static_cast<int32_t>(d_doppler_max);
|
||||
//float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast<float>(d_fs_in);
|
||||
float phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
|
||||
// The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing
|
||||
// The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi)
|
||||
// The FPGA also expects the phase to be negative since it produces cos(x) -j*sin(x)
|
||||
// while the gnss-sdr software (volk_gnsssdr_s32f_sincos_32fc) generates cos(x) + j*sin(x)
|
||||
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
|
||||
// avoid saturation of the fixed point representation in the fpga
|
||||
// (only the positive value can saturate due to the 2's complement representation)
|
||||
|
||||
//printf("AAA phase_step_rad_real for initial doppler = %f\n", phase_step_rad_real);
|
||||
if (phase_step_rad_real >= 1.0)
|
||||
{
|
||||
phase_step_rad_real = MAX_PHASE_STEP_RAD;
|
||||
}
|
||||
//printf("AAA phase_step_rad_real for initial doppler after checking = %f\n", phase_step_rad_real);
|
||||
phase_step_rad_int_temp = phase_step_rad_real * POW_2_2; // * 2^2
|
||||
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_int_temp * (POW_2_29)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
|
||||
//printf("AAA writing phase_step_rad_int for initial doppler = %d to d map base 3\n", phase_step_rad_int);
|
||||
d_map_base[3] = phase_step_rad_int;
|
||||
|
||||
// repeat the calculation with the doppler step
|
||||
doppler = 0;
|
||||
phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
|
||||
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
|
||||
//printf("AAA phase_step_rad_real for doppler step = %f\n", phase_step_rad_real);
|
||||
if (phase_step_rad_real >= 1.0)
|
||||
{
|
||||
phase_step_rad_real = MAX_PHASE_STEP_RAD;
|
||||
}
|
||||
//printf("AAA phase_step_rad_real for doppler step after checking = %f\n", phase_step_rad_real);
|
||||
phase_step_rad_int_temp = phase_step_rad_real * POW_2_2; // * 2^2
|
||||
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_int_temp * (POW_2_29)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
|
||||
//printf("AAA writing phase_step_rad_int for doppler step = %d to d map base 4\n", phase_step_rad_int);
|
||||
d_map_base[4] = phase_step_rad_int;
|
||||
//printf("AAA writing num sweeps to d map base 5 = %d\n", num_sweeps);
|
||||
d_map_base[5] = 1; // 1 sweep
|
||||
|
||||
}
|
||||
|
||||
// repeat the calculation with the doppler step
|
||||
doppler = static_cast<int32_t>(d_doppler_step);
|
||||
phase_step_rad = GPS_TWO_PI * (doppler) / static_cast<float>(d_fs_in);
|
||||
phase_step_rad_real = phase_step_rad / (GPS_TWO_PI / 2);
|
||||
//printf("AAA phase_step_rad_real for doppler step = %f\n", phase_step_rad_real);
|
||||
if (phase_step_rad_real >= 1.0)
|
||||
{
|
||||
phase_step_rad_real = MAX_PHASE_STEP_RAD;
|
||||
}
|
||||
//printf("AAA phase_step_rad_real for doppler step after checking = %f\n", phase_step_rad_real);
|
||||
phase_step_rad_int_temp = phase_step_rad_real * POW_2_2; // * 2^2
|
||||
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_int_temp * (POW_2_29)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
|
||||
//printf("AAA writing phase_step_rad_int for doppler step = %d to d map base 4\n", phase_step_rad_int);
|
||||
d_map_base[4] = phase_step_rad_int;
|
||||
//printf("AAA writing num sweeps to d map base 5 = %d\n", num_sweeps);
|
||||
d_map_base[5] = num_sweeps;
|
||||
}
|
||||
|
||||
/*
|
||||
void fpga_acquisition::set_doppler_sweep_debug(uint32_t num_sweeps, uint32_t doppler_index)
|
||||
{
|
||||
//printf("acq lib set_doppler_sweep_debug called\n");
|
||||
@ -337,7 +393,7 @@ void fpga_acquisition::set_doppler_sweep_debug(uint32_t num_sweeps, uint32_t dop
|
||||
//printf("AAAh writing num sweeps to d map base 5 = %d\n", num_sweeps);
|
||||
d_map_base[5] = num_sweeps;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void fpga_acquisition::configure_acquisition()
|
||||
{
|
||||
@ -402,10 +458,10 @@ void fpga_acquisition::read_acquisition_results(uint32_t *max_index,
|
||||
*initial_sample = initial_sample_tmp;
|
||||
readval = d_map_base[6];
|
||||
*max_magnitude = static_cast<float>(readval);
|
||||
//printf("read max_magnitude dmap 2 = %d\n", readval);
|
||||
//printf("acq lib read max_magnitude dmap 2 = %d = %f\n", readval, *max_magnitude);
|
||||
readval = d_map_base[4];
|
||||
*power_sum = static_cast<float>(readval);
|
||||
//printf("read power sum dmap 4 = %d\n", readval);
|
||||
//printf("acq lib read power sum dmap 4 = %d = %f\n", readval, *power_sum);
|
||||
readval = d_map_base[5]; // read doppler index
|
||||
*doppler_index = readval;
|
||||
//printf("read doppler_index dmap 5 = %d\n", readval);
|
||||
@ -446,3 +502,10 @@ void fpga_acquisition::reset_acquisition(void)
|
||||
//printf("acq lib reset acquisition called\n");
|
||||
d_map_base[8] = RESET_ACQUISITION; // writing a 2 to d_map_base[8] resets the multicorrelator
|
||||
}
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void fpga_acquisition::set_single_doppler_flag(unsigned int single_doppler_flag)
|
||||
{
|
||||
d_single_doppler_flag = single_doppler_flag;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
bool set_local_code(uint32_t PRN);
|
||||
bool free();
|
||||
void set_doppler_sweep(uint32_t num_sweeps);
|
||||
void set_doppler_sweep_debug(uint32_t num_sweeps, uint32_t doppler_index);
|
||||
//void set_doppler_sweep_debug(uint32_t num_sweeps, uint32_t doppler_index);
|
||||
void run_acquisition(void);
|
||||
void set_phase_step(uint32_t doppler_index);
|
||||
void read_acquisition_results(uint32_t *max_index, float *max_magnitude,
|
||||
@ -88,6 +88,16 @@ public:
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief this function is only used in the unit test
|
||||
*/
|
||||
void set_single_doppler_flag(unsigned int single_doppler_flag);
|
||||
|
||||
/*!
|
||||
* \brief this function is only used in the unit test
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
private:
|
||||
int64_t d_fs_in;
|
||||
// data related to the hardware module and the driver
|
||||
@ -105,8 +115,10 @@ private:
|
||||
uint32_t fpga_acquisition_test_register(uint32_t writeval);
|
||||
void fpga_configure_acquisition_local_code(lv_16sc_t fft_local_code[]);
|
||||
void configure_acquisition();
|
||||
void reset_acquisition(void);
|
||||
void close_device();
|
||||
|
||||
// test parameters
|
||||
unsigned int d_single_doppler_flag; // this flag is only used for testing purposes
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_FPGA_ACQUISITION_H_ */
|
||||
|
@ -123,7 +123,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 15);
|
||||
trk_param_fpga.device_base = device_base;
|
||||
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 1);
|
||||
trk_param_fpga.multicorr_type = 1; // 0 -> 3 correlators, 1 -> 5 correlators
|
||||
|
@ -123,7 +123,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 27);
|
||||
trk_param_fpga.device_base = device_base;
|
||||
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 1);
|
||||
trk_param_fpga.multicorr_type = 1; // 0 -> 3 correlators, 1 -> up to 5+1 correlators
|
||||
|
@ -127,7 +127,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 3);
|
||||
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
|
||||
|
@ -123,7 +123,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 27);
|
||||
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
|
||||
|
@ -1218,6 +1218,7 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
// Block input data and block output stream pointers
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
@ -1247,15 +1248,29 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
|
||||
multicorrelator_fpga->lock_channel();
|
||||
uint64_t counter_value = multicorrelator_fpga->read_sample_counter();
|
||||
//printf("333333 counter_value = %llu\n", counter_value);
|
||||
//printf("333333 current_synchro_data.Acq_samplestamp_samples = %d\n", current_synchro_data.Acq_samplestamp_samples);
|
||||
//printf("333333 current_synchro_data.Acq_samplestamp_samples = %llu\n", current_synchro_data.Acq_samplestamp_samples);
|
||||
//printf("333333 current_synchro_data.Acq_delay_samples = %f\n", current_synchro_data.Acq_delay_samples);
|
||||
//printf("333333 d_correlation_length_samples = %d\n", d_correlation_length_samples);
|
||||
uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples);
|
||||
//uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples*2 - current_synchro_data.Acq_delay_samples*2) / d_correlation_length_samples);
|
||||
//printf("333333 num_frames = %d\n", num_frames);
|
||||
uint64_t absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples);
|
||||
//uint64_t absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples*2 + current_synchro_data.Acq_samplestamp_samples*2 + num_frames * d_correlation_length_samples);
|
||||
//printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset);
|
||||
|
||||
uint64_t absolute_samples_offset;
|
||||
|
||||
if (counter_value > (current_synchro_data.Acq_samplestamp_samples + current_synchro_data.Acq_delay_samples))
|
||||
{
|
||||
// normal operation
|
||||
uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples);
|
||||
//uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples*2 - current_synchro_data.Acq_delay_samples*2) / d_correlation_length_samples);
|
||||
//printf("333333 num_frames = %d\n", num_frames);
|
||||
absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples);
|
||||
//uint64_t absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples*2 + current_synchro_data.Acq_samplestamp_samples*2 + num_frames * d_correlation_length_samples);
|
||||
//printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
// during the unit tests the counter value may be reset after the acquisition process. We have to take this into account
|
||||
absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples);
|
||||
//printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset);
|
||||
}
|
||||
|
||||
multicorrelator_fpga->set_initial_sample(absolute_samples_offset);
|
||||
d_absolute_samples_offset = absolute_samples_offset;
|
||||
d_sample_counter = absolute_samples_offset;
|
||||
@ -1268,6 +1283,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
|
||||
|
||||
case 2:
|
||||
{
|
||||
//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);
|
||||
|
||||
@ -1481,6 +1497,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
|
||||
|
||||
case 3:
|
||||
{
|
||||
//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);
|
||||
|
||||
@ -1541,6 +1558,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
|
||||
|
||||
case 4: // narrow tracking
|
||||
{
|
||||
//printf("trk state 4 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);
|
||||
|
||||
|
@ -320,7 +320,7 @@ bool fpga_multicorrelator_8sc::free()
|
||||
|
||||
void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
|
||||
{
|
||||
//printf("www trk set channel\n");
|
||||
//printf("www trk set channel channel=%lu\n", (unsigned long) channel);
|
||||
char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name
|
||||
d_channel = channel;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user