mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-28 05:57:39 +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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user