mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-30 14:53:03 +00:00 
			
		
		
		
	changed the downsampling factor of the L1 and E1 acquisition from /2 to /4
This commit is contained in:
		| @@ -59,7 +59,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( | |||||||
|     long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); |     long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); | ||||||
|     long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); |     long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); | ||||||
|  |  | ||||||
|     float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 2.0); |     float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 4.0); | ||||||
|     acq_parameters.downsampling_factor = downsampling_factor; |     acq_parameters.downsampling_factor = downsampling_factor; | ||||||
|  |  | ||||||
|     //fs_in = fs_in/2.0; // downampling filter |     //fs_in = fs_in/2.0; // downampling filter | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( | |||||||
|     long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); |     long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); | ||||||
|     long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); |     long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); | ||||||
|  |  | ||||||
|     float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 2.0); |     float downsampling_factor = configuration_->property("GNSS-SDR.downsampling_factor", 4.0); | ||||||
|     acq_parameters.downsampling_factor = downsampling_factor; |     acq_parameters.downsampling_factor = downsampling_factor; | ||||||
|     //fs_in = fs_in/2.0; // downampling filter |     //fs_in = fs_in/2.0; // downampling filter | ||||||
|     //printf("fs_in pre downsampling = %ld\n", fs_in); |     //printf("fs_in pre downsampling = %ld\n", fs_in); | ||||||
|   | |||||||
| @@ -326,7 +326,9 @@ void pcps_acquisition_fpga::set_active(bool active) | |||||||
|     	{ |     	{ | ||||||
|     		//printf("yes here\n"); |     		//printf("yes here\n"); | ||||||
|     		d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_downsampling_factor*(indext % acq_parameters.samples_per_code)); |     		d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_downsampling_factor*(indext % acq_parameters.samples_per_code)); | ||||||
|     		d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.25*d_downsampling_factor; // delay due to the downsampling filter in the acquisition |     		//d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.25*d_downsampling_factor; // delay due to the downsampling filter in the acquisition | ||||||
|  |     		d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.5; // delay due to the downsampling filter in the acquisition | ||||||
|  |     		//d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81/d_downsampling_factor; // delay due to the downsampling filter in the acquisition | ||||||
|     		//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext % acq_parameters.samples_per_code)); |     		//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext % acq_parameters.samples_per_code)); | ||||||
|     		//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext)); |     		//d_gnss_synchro->Acq_delay_samples = static_cast<double>(2*(indext)); | ||||||
|     		//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter*2 - 81; |     		//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter*2 - 81; | ||||||
| @@ -335,6 +337,7 @@ void pcps_acquisition_fpga::set_active(bool active) | |||||||
|     	} |     	} | ||||||
|     	else |     	else | ||||||
|     	{ |     	{ | ||||||
|  |     		//printf("xxxxxxxxxxxxxxxx no here\n"); | ||||||
|         	d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code); |         	d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code); | ||||||
|         	d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;  // delay due to the downsampling filter in the acquisition |         	d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;  // delay due to the downsampling filter in the acquisition | ||||||
|         	//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter - 40;  // delay due to the downsampling filter in the acquisition |         	//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter - 40;  // delay due to the downsampling filter in the acquisition | ||||||
|   | |||||||
| @@ -430,6 +430,10 @@ void dll_pll_veml_tracking_fpga::start_tracking() | |||||||
|     d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; |     d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; | ||||||
|     d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; |     d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; | ||||||
|  |  | ||||||
|  |     //printf("start tracking Acq_delay_samples = %d\n", (unsigned int) d_acq_code_phase_samples); | ||||||
|  |     //printf("start tracking Acq_samplestamp_samples = %d\n", (unsigned int) d_acq_sample_stamp); | ||||||
|  |     //printf("start tracking Acq_doppler_hz = %f\n", d_acq_carrier_doppler_hz); | ||||||
|  |     //printf("PRN = %d\n", (unsigned int) d_acquisition_gnss_synchro->PRN); | ||||||
|     double acq_trk_diff_seconds = 0;  // when using the FPGA we don't use the global sample counter |     double acq_trk_diff_seconds = 0;  // when using the FPGA we don't use the global sample counter | ||||||
|     // Doppler effect Fd = (C / (C + Vr)) * F |     // Doppler effect Fd = (C / (C + Vr)) * F | ||||||
|     double radial_velocity = (d_signal_carrier_freq + d_acq_carrier_doppler_hz) / d_signal_carrier_freq; |     double radial_velocity = (d_signal_carrier_freq + d_acq_carrier_doppler_hz) / d_signal_carrier_freq; | ||||||
| @@ -659,6 +663,8 @@ bool dll_pll_veml_tracking_fpga::acquire_secondary() | |||||||
| bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integration_time_s) | bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integration_time_s) | ||||||
| { | { | ||||||
|     //printf("kkkkkkkkkkkkk d_cn0_estimation_counter = %d\n", d_cn0_estimation_counter); |     //printf("kkkkkkkkkkkkk d_cn0_estimation_counter = %d\n", d_cn0_estimation_counter); | ||||||
|  |     //printf("trk_parameters.cn0_samples = %d\n", trk_parameters.cn0_samples); | ||||||
|  |  | ||||||
|     // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### |     // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### | ||||||
|     if (d_cn0_estimation_counter < trk_parameters.cn0_samples) |     if (d_cn0_estimation_counter < trk_parameters.cn0_samples) | ||||||
|         { |         { | ||||||
| @@ -676,6 +682,12 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra | |||||||
|             // Carrier lock indicator |             // Carrier lock indicator | ||||||
|             d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples); |             d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples); | ||||||
|             // Loss of lock detection |             // Loss of lock detection | ||||||
|  |             //printf("d_carrier_lock_test = %f\n", d_carrier_lock_test); | ||||||
|  |             //printf("d_carrier_lock_threshold = %f\n", d_carrier_lock_threshold); | ||||||
|  |             //printf("d_CN0_SNV_dB_Hz = %f\n", d_CN0_SNV_dB_Hz); | ||||||
|  |             //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); | ||||||
|             if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) |             if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) | ||||||
|                 { |                 { | ||||||
|                     d_carrier_lock_fail_counter++; |                     d_carrier_lock_fail_counter++; | ||||||
| @@ -1257,6 +1269,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un | |||||||
|                 if (counter_value > (current_synchro_data.Acq_samplestamp_samples + current_synchro_data.Acq_delay_samples)) |                 if (counter_value > (current_synchro_data.Acq_samplestamp_samples + current_synchro_data.Acq_delay_samples)) | ||||||
|                 { |                 { | ||||||
|                 	// normal operation |                 	// normal operation | ||||||
|  |                 	//printf("normal operation\n"); | ||||||
|                     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 - 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 + 40) / 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 + 40) / d_correlation_length_samples); | ||||||
|                     //printf("333333 num_frames = %d\n", num_frames); |                     //printf("333333 num_frames = %d\n", num_frames); | ||||||
| @@ -1266,6 +1279,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un | |||||||
|                 } |                 } | ||||||
|                 else |                 else | ||||||
|                 { |                 { | ||||||
|  |                 	printf("test operation\n"); | ||||||
|                 	// during the unit tests the counter value may be reset after the acquisition process. We have to take this into account |                 	// 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); |                 	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); |                 	//printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset); | ||||||
| @@ -1299,10 +1313,22 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un | |||||||
|                     { |                     { | ||||||
|                         d_VE_accu = *d_Very_Early; |                         d_VE_accu = *d_Very_Early; | ||||||
|                         d_VL_accu = *d_Very_Late; |                         d_VL_accu = *d_Very_Late; | ||||||
|  |                         //printf("very early real = %f\n", d_VE_accu.real()); | ||||||
|  |                         //printf("very early imag = %f\n", d_VE_accu.imag()); | ||||||
|  |                         //printf("very late real = %f\n", d_VL_accu.real()); | ||||||
|  |                         //printf("very late imag = %f\n", d_VL_accu.imag()); | ||||||
|                     } |                     } | ||||||
|                 d_E_accu = *d_Early; |                 d_E_accu = *d_Early; | ||||||
|                 d_P_accu = *d_Prompt; |                 d_P_accu = *d_Prompt; | ||||||
|                 d_L_accu = *d_Late; |                 d_L_accu = *d_Late; | ||||||
|  |                 //printf("early real = %f\n", d_E_accu.real()); | ||||||
|  |                 //printf("early imag = %f\n", d_E_accu.imag()); | ||||||
|  |                 //printf("prompt real = %f\n", d_P_accu.real()); | ||||||
|  |                 //printf("prompt imag = %f\n", d_P_accu.imag()); | ||||||
|  |                 //printf("late real = %f\n", d_L_accu.real()); | ||||||
|  |                 //printf("late imag = %f\n", d_L_accu.imag()); | ||||||
|  |  | ||||||
|  |                 //printf("d_code_period = %f\n", d_code_period); | ||||||
|  |  | ||||||
|                 if (!cn0_and_tracking_lock_status(d_code_period)) |                 if (!cn0_and_tracking_lock_status(d_code_period)) | ||||||
|                     { |                     { | ||||||
| @@ -1635,6 +1661,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un | |||||||
|         } |         } | ||||||
|     if (current_synchro_data.Flag_valid_symbol_output) |     if (current_synchro_data.Flag_valid_symbol_output) | ||||||
|         { |         { | ||||||
|  |     		//printf("tracking sending synchro data\n"); | ||||||
|             current_synchro_data.fs = static_cast<int64_t>(trk_parameters.fs_in); |             current_synchro_data.fs = static_cast<int64_t>(trk_parameters.fs_in); | ||||||
|             current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples); |             current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples); | ||||||
|             *out[0] = current_synchro_data; |             *out[0] = current_synchro_data; | ||||||
|   | |||||||
| @@ -70,16 +70,16 @@ | |||||||
| #define MAX_INPUT_COMPLEX_SAMPLES_TOTAL 8192 	// maximum DMA sample block size in complex samples | #define MAX_INPUT_COMPLEX_SAMPLES_TOTAL 8192 	// maximum DMA sample block size in complex samples | ||||||
| #define COMPLEX_SAMPLE_SIZE 2					// sample size in bytes | #define COMPLEX_SAMPLE_SIZE 2					// sample size in bytes | ||||||
| #define NUM_QUEUES 2							// number of queues (1 for GPS L1/Galileo E1, and 1 for GPS L5/Galileo E5) | #define NUM_QUEUES 2							// number of queues (1 for GPS L1/Galileo E1, and 1 for GPS L5/Galileo E5) | ||||||
| #define NSAMPLES_TRACKING 90000000				// number of samples during which we test the tracking module | #define NSAMPLES_TRACKING 200000000				// number of samples during which we test the tracking module | ||||||
| #define 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 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 NSAMPLES_ACQ_DOPPLER_SWEEP 50000000		// number of samples sent to the acquisition module when running acquisition when the HW controls the doppler loop | #define NSAMPLES_ACQ_DOPPLER_SWEEP 50000000		// number of samples sent to the acquisition module when running acquisition when the HW controls the doppler loop | ||||||
|  |  | ||||||
| // HW related options | // HW related options | ||||||
| bool doppler_control_in_sw = 1;		// 1 => doppler sweep controlled by the SW test code , 0 => doppler sweep controlled by the HW | bool doppler_control_in_sw = 1;		// 1 => doppler sweep controlled by the SW test code , 0 => doppler sweep controlled by the HW | ||||||
| bool show_results_table = 0;		// 1 => show matrix of (doppler, (max value, power sum)) results (only if doppler_control_in_sw = 1), 0=> do not show it | bool show_results_table = 0;		// 1 => show matrix of (doppler, (max value, power sum)) results (only if doppler_control_in_sw = 1), 0=> do not show it | ||||||
| bool skip_samples_already_used = 1;	// if doppler_control_in_sw = 1 and skip_samples_already_used = 1 => for each PRN loop skip the samples used in the previous PRN loops | bool skip_samples_already_used = 0;	// if doppler_control_in_sw = 1 and skip_samples_already_used = 1 => for each PRN loop skip the samples used in the previous PRN loops | ||||||
| 									// (exactly in the same way as the SW) | 									// (exactly in the same way as the SW) | ||||||
| 									// if doppler_control_in_sw = 1 and skip_samples_already_used = 0 => the sampe samples are used for each PRN loop | 									// if doppler_control_in_sw = 1 and skip_samples_already_used = 0 => the sampe samples are used for each doppler sweep | ||||||
| 									// if doppler_control_in_sw = 0 => skip_samples_already_used is not applicable | 									// if doppler_control_in_sw = 0 => skip_samples_already_used is not applicable | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -441,6 +441,7 @@ struct DMA_handler_args { | |||||||
|  |  | ||||||
| void *handler_DMA(void *arguments) | void *handler_DMA(void *arguments) | ||||||
| { | { | ||||||
|  | 	//printf("in handler DMA NO tracking\n"); | ||||||
| 	// DMA process that configures the DMA to send the samples to the acquisition engine | 	// DMA process that configures the DMA to send the samples to the acquisition engine | ||||||
| 	int tx_fd; 															// DMA descriptor | 	int tx_fd; 															// DMA descriptor | ||||||
| 	FILE *rx_signal_file_id;											// Input file descriptor | 	FILE *rx_signal_file_id;											// Input file descriptor | ||||||
| @@ -483,6 +484,13 @@ void *handler_DMA(void *arguments) | |||||||
|  |  | ||||||
| 	fseek( rx_signal_file_id, (skip_samples + skip_used_samples)*2, SEEK_SET ); | 	fseek( rx_signal_file_id, (skip_samples + skip_used_samples)*2, SEEK_SET ); | ||||||
|  |  | ||||||
|  | 	//printf("\n dma skip_samples = %d\n", skip_samples); | ||||||
|  | 	//printf("\n dma skip used samples = %d\n", skip_used_samples); | ||||||
|  | 	//printf("dma skip_samples = %d\n", skip_samples); | ||||||
|  | 	//printf("dma skip used samples = %d\n", skip_used_samples); | ||||||
|  | 	//printf("dma file_completed = %d\n", file_completed); | ||||||
|  | 	//printf("dma nsamples = %d\n", nsamples); | ||||||
|  | 	//printf("dma nsamples_tx = %d\n", nsamples_tx); | ||||||
| 	usleep(50000); // wait some time to give time to the main thread to start the acquisition module | 	usleep(50000); // wait some time to give time to the main thread to start the acquisition module | ||||||
|  |  | ||||||
| 	while (file_completed == false) | 	while (file_completed == false) | ||||||
| @@ -551,6 +559,134 @@ void *handler_DMA(void *arguments) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void *handler_DMA_tracking(void *arguments) | ||||||
|  | { | ||||||
|  | 	//printf("in handler DMA NO tracking\n"); | ||||||
|  | 	// DMA process that configures the DMA to send the samples to the acquisition engine | ||||||
|  | 	int tx_fd; 															// DMA descriptor | ||||||
|  | 	FILE *rx_signal_file_id;											// Input file descriptor | ||||||
|  | 	bool file_completed = false;										// flag to indicate if the file is completed | ||||||
|  | 	unsigned int nsamples_block;										// number of samples to send in the next DMA block of samples | ||||||
|  | 	unsigned int nread_elements;										// number of elements effectively read from the input file | ||||||
|  | 	unsigned int nsamples = 0;											// number of complex samples effectively transferred | ||||||
|  | 	unsigned int index0, dma_index = 0;									// counters used for putting the samples in the order expected by the DMA | ||||||
|  | 	unsigned int num_bytes_to_transfer;									// DMA transfer block size in bytes | ||||||
|  |  | ||||||
|  | 	unsigned int nsamples_transmitted; | ||||||
|  |  | ||||||
|  | 	struct DMA_handler_args *args = (struct DMA_handler_args *) arguments; | ||||||
|  |  | ||||||
|  | 	unsigned int nsamples_tx = args->nsamples_tx; | ||||||
|  | 	std::string file = args->file; // input filename | ||||||
|  | 	unsigned int skip_used_samples = args->skip_used_samples; | ||||||
|  |  | ||||||
|  | 	// open DMA device | ||||||
|  | 	tx_fd = open("/dev/loop_tx", O_WRONLY); | ||||||
|  | 	if ( tx_fd < 0 ) | ||||||
|  | 	{ | ||||||
|  | 		printf("DMA can't open loop device\n"); | ||||||
|  | 		exit(1); | ||||||
|  | 	} | ||||||
|  | 	else | ||||||
|  |  | ||||||
|  | 	// open input file | ||||||
|  | 	rx_signal_file_id = fopen(file.c_str(), "rb"); | ||||||
|  | 	if (rx_signal_file_id < 0) | ||||||
|  | 	{ | ||||||
|  | 		printf("DMA can't open input file\n"); | ||||||
|  | 		exit(1); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	while(send_samples_start == 0); // wait until acquisition starts | ||||||
|  |  | ||||||
|  | 	// skip initial samples | ||||||
|  | 	int skip_samples = (int) FLAGS_skip_samples; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	fseek( rx_signal_file_id, (skip_samples + skip_used_samples)*2, SEEK_SET ); | ||||||
|  | 	printf("\n dma skip_samples = %d\n", skip_samples); | ||||||
|  | 	printf("\n dma skip used samples = %d\n", skip_used_samples); | ||||||
|  | 	//printf("dma file_completed = %d\n", file_completed); | ||||||
|  | 	//printf("dma nsamples = %d\n", nsamples); | ||||||
|  | 	//printf("dma nsamples_tx = %d\n", nsamples_tx); | ||||||
|  | 	usleep(50000); // wait some time to give time to the main thread to start the acquisition module | ||||||
|  |  | ||||||
|  | 	while (file_completed == false) | ||||||
|  | 	{ | ||||||
|  |  | ||||||
|  | 		if (nsamples_tx - nsamples > MAX_INPUT_COMPLEX_SAMPLES_TOTAL) | ||||||
|  | 		{ | ||||||
|  | 			nsamples_block = MAX_INPUT_COMPLEX_SAMPLES_TOTAL; | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			nsamples_block = nsamples_tx - nsamples; // remaining samples to be sent | ||||||
|  | 			file_completed = true; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		nread_elements = fread(input_samples, 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"); | ||||||
|  | 			file_completed = true; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		nsamples+=(nread_elements/COMPLEX_SAMPLE_SIZE); | ||||||
|  |  | ||||||
|  | 		if (nread_elements > 0) | ||||||
|  | 		{ | ||||||
|  | 			// for the 32-BIT DMA | ||||||
|  | 			dma_index = 0; | ||||||
|  | 			for (index0 = 0;index0 < (nread_elements);index0+=COMPLEX_SAMPLE_SIZE) | ||||||
|  | 			{ | ||||||
|  | 				if (args->freq_band == 0) | ||||||
|  | 				{ | ||||||
|  | 					// channel 1 (queue 1) -> E5/L5 | ||||||
|  | 					input_samples_dma[dma_index] = 0; | ||||||
|  | 					input_samples_dma[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]; | ||||||
|  | 				} | ||||||
|  | 				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]; | ||||||
|  | 					// channel 0 (queue 0) -> E1/L1 | ||||||
|  | 					input_samples_dma[dma_index+2] = 0; | ||||||
|  | 					input_samples_dma[dma_index+3] = 0; | ||||||
|  | 				} | ||||||
|  | 				dma_index += 4; | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			nsamples_transmitted = write(tx_fd, &input_samples_dma[0], nread_elements*NUM_QUEUES); | ||||||
|  |  | ||||||
|  | 			if (nsamples_transmitted != nread_elements*NUM_QUEUES) | ||||||
|  | 			{ | ||||||
|  | 				std::cout << "Error : DMA could not send all the requested samples" << std::endl; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	close(tx_fd); | ||||||
|  | 	fclose(rx_signal_file_id); | ||||||
|  |  | ||||||
|  | 	return NULL; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| bool TrackingPullInTestFpga::acquire_signal(int SV_ID) | bool TrackingPullInTestFpga::acquire_signal(int SV_ID) | ||||||
| { | { | ||||||
| 	pthread_t thread_DMA; | 	pthread_t thread_DMA; | ||||||
| @@ -715,6 +851,9 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) | |||||||
|             MAX_PRN_IDX = 33; |             MAX_PRN_IDX = 33; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |     // debug | ||||||
|  |     //MAX_PRN_IDX = 10; | ||||||
|  |  | ||||||
|     setup_fpga_switch(); |     setup_fpga_switch(); | ||||||
|  |  | ||||||
|     if (doppler_control_in_sw == 0) |     if (doppler_control_in_sw == 0) | ||||||
| @@ -789,6 +928,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) | |||||||
| 			    } | 			    } | ||||||
|  |  | ||||||
| 				// create DMA child process | 				// create DMA child process | ||||||
|  | 			    //printf("|||||||| args freq_band = %d\n", args.freq_band); | ||||||
| 				if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) | 				if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) | ||||||
| 				{ | 				{ | ||||||
| 					printf("ERROR cannot create DMA Process\n"); | 					printf("ERROR cannot create DMA Process\n"); | ||||||
| @@ -989,6 +1129,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) | |||||||
| 			        } | 			        } | ||||||
|  |  | ||||||
| 					// create DMA child process | 					// create DMA child process | ||||||
|  | 			        //printf("||||||||1 args freq_band = %d\n", args.freq_band); | ||||||
| 					if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) | 					if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) | ||||||
| 					{ | 					{ | ||||||
| 						printf("ERROR cannot create DMA Process\n"); | 						printf("ERROR cannot create DMA Process\n"); | ||||||
| @@ -1306,38 +1447,51 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) | |||||||
|                 { |                 { | ||||||
|                     for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++) |                     for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++) | ||||||
|                         { |                         { | ||||||
|  |                     		// DEBUG TEST THE RESULTS OF THE SW | ||||||
|  |                     		//acq_samplestamp_samples = 108856983; | ||||||
|  |                     		//true_acq_doppler_hz = 3250; | ||||||
|  |                     		//true_acq_delay_samples = 836; | ||||||
|  |  | ||||||
|                             gnss_synchro.Acq_samplestamp_samples = acq_samplestamp_samples; |                             gnss_synchro.Acq_samplestamp_samples = acq_samplestamp_samples; | ||||||
|                             //simulate a Doppler error in acquisition |                             //simulate a Doppler error in acquisition | ||||||
|                             gnss_synchro.Acq_doppler_hz = true_acq_doppler_hz + acq_doppler_error_hz_values.at(current_acq_doppler_error_idx); |                             gnss_synchro.Acq_doppler_hz = true_acq_doppler_hz + acq_doppler_error_hz_values.at(current_acq_doppler_error_idx); | ||||||
|                             //simulate Code Delay error in acquisition |                             //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); |                             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); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|                             //create flowgraph |                             //create flowgraph | ||||||
|                             top_block = gr::make_top_block("Tracking test"); |                             top_block = gr::make_top_block("Tracking test"); | ||||||
|                             std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); |                             std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); | ||||||
|                             std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); |                             std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); | ||||||
|                             boost::shared_ptr<TrackingPullInTestFpga_msg_rx> msg_rx = TrackingPullInTestFpga_msg_rx_make(); |                             boost::shared_ptr<TrackingPullInTestFpga_msg_rx> msg_rx = TrackingPullInTestFpga_msg_rx_make(); | ||||||
|                             printf("loop part b2\n"); |                             //printf("loop part b2\n"); | ||||||
|  |  | ||||||
|                             if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0) |                             if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking_Fpga") == 0) | ||||||
|                             { |                             { | ||||||
|                             	std::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition_Fpga; |                             	std::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition_Fpga; | ||||||
|                             	acquisition_Fpga = std::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0); |                             	acquisition_Fpga = std::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0); | ||||||
|  |                             	args.freq_band = 0; | ||||||
|                             } |                             } | ||||||
|                             else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0) |                             else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") == 0) | ||||||
|                             { |                             { | ||||||
|                             	std::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionFpga> acquisition_Fpga; |                             	std::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionFpga> acquisition_Fpga; | ||||||
|                             	acquisition_Fpga = std::make_shared<GalileoE1PcpsAmbiguousAcquisitionFpga>(config.get(), "Acquisition", 0, 0); |                             	acquisition_Fpga = std::make_shared<GalileoE1PcpsAmbiguousAcquisitionFpga>(config.get(), "Acquisition", 0, 0); | ||||||
|  |                             	args.freq_band = 0; | ||||||
|                             } |                             } | ||||||
|                             else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_Fpga") == 0) |                             else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_Fpga") == 0) | ||||||
|                             { |                             { | ||||||
|                             	std::shared_ptr<GalileoE5aPcpsAcquisitionFpga> acquisition_Fpga; |                             	std::shared_ptr<GalileoE5aPcpsAcquisitionFpga> acquisition_Fpga; | ||||||
|                             	acquisition_Fpga = std::make_shared<GalileoE5aPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0); |                             	acquisition_Fpga = std::make_shared<GalileoE5aPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0); | ||||||
|  |                             	args.freq_band = 1; | ||||||
|                             } |                             } | ||||||
|                             else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0) |                             else if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0) | ||||||
|                             { |                             { | ||||||
|                             	std::shared_ptr<GpsL5iPcpsAcquisitionFpga> acquisition_Fpga; |                             	std::shared_ptr<GpsL5iPcpsAcquisitionFpga> acquisition_Fpga; | ||||||
|                             	acquisition_Fpga = std::make_shared<GpsL5iPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0); |                             	acquisition_Fpga = std::make_shared<GpsL5iPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0); | ||||||
|  |                             	args.freq_band = 1; | ||||||
|                             } |                             } | ||||||
|                             else |                             else | ||||||
|                             { |                             { | ||||||
| @@ -1382,8 +1536,10 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) | |||||||
|                             { |                             { | ||||||
|                             	args.skip_used_samples = 0; |                             	args.skip_used_samples = 0; | ||||||
|                             } |                             } | ||||||
|  |                             //args.skip_used_samples = 0; | ||||||
|  |  | ||||||
|                             if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) |                             //printf("||||||||1 args freq_band = %d\n", args.freq_band); | ||||||
|  |                             if (pthread_create(&thread_DMA, NULL, handler_DMA_tracking, (void *)&args) < 0) | ||||||
|                         	{ |                         	{ | ||||||
|                         		printf("ERROR cannot create DMA Process\n"); |                         		printf("ERROR cannot create DMA Process\n"); | ||||||
|                         	} |                         	} | ||||||
| @@ -1415,6 +1571,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) | |||||||
|                             	args.skip_used_samples = 0; |                             	args.skip_used_samples = 0; | ||||||
|                             } |                             } | ||||||
|                             args.nsamples_tx = NSAMPLES_FINAL; |                             args.nsamples_tx = NSAMPLES_FINAL; | ||||||
|  |                             //printf("||||||||1 args freq_band = %d\n", args.freq_band); | ||||||
|                             if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) |                             if (pthread_create(&thread_DMA, NULL, handler_DMA, (void *)&args) < 0) | ||||||
|                         	{ |                         	{ | ||||||
|                         		printf("ERROR cannot create DMA Process\n"); |                         		printf("ERROR cannot create DMA Process\n"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Marc Majoral
					Marc Majoral