mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	but solved: double acquisition was using uint32_t for the initial doppler estimation. Therefore when the first estimated doppler was negative it was reset to zero.
This commit is contained in:
		| @@ -174,7 +174,7 @@ void pcps_acquisition_fpga::send_negative_acquisition() | ||||
|     this->message_port_pub(pmt::mp("events"), pmt::from_long(2)); | ||||
| } | ||||
|  | ||||
| void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, uint32_t doppler_min) | ||||
| void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min) | ||||
| { | ||||
|     uint32_t indext = 0U; | ||||
|     float firstpeak = 0.0; | ||||
|   | ||||
| @@ -97,7 +97,7 @@ private: | ||||
|  | ||||
|     float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step); | ||||
|  | ||||
|     void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, uint32_t doppler_max); | ||||
|     void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_max); | ||||
|  | ||||
|     pcpsconf_fpga_t acq_parameters; | ||||
|     bool d_active; | ||||
|   | ||||
| @@ -44,23 +44,23 @@ | ||||
|  | ||||
|  | ||||
| // FPGA register parameters | ||||
| #define PAGE_SIZE 0x10000                     // default page size for the multicorrelator memory map | ||||
| #define MAX_PHASE_STEP_RAD 0.999999999534339  // 1 - pow(2,-31); | ||||
| #define RESET_ACQUISITION 2                   // command to reset the multicorrelator | ||||
| #define LAUNCH_ACQUISITION 1                  // command to launch the multicorrelator | ||||
| #define TEST_REG_SANITY_CHECK 0x55AA          // value to check the presence of the test register (to detect the hw) | ||||
| #define LOCAL_CODE_CLEAR_MEM 0x10000000       // command to clear the internal memory of the multicorrelator | ||||
| #define MEM_LOCAL_CODE_WR_ENABLE 0x0C000000   // command to enable the ENA and WR pins of the internal memory of the multicorrelator | ||||
| #define POW_2_2 4                             // 2^2 (used for the conversion of floating point numbers to integers) | ||||
| #define POW_2_29 536870912                    // 2^29 (used for the conversion of floating point numbers to integers) | ||||
| #define SELECT_LSB 0x00FF                     // value to select the least significant byte | ||||
| #define SELECT_MSB 0XFF00                     // value to select the most significant byte | ||||
| #define SELECT_16_BITS 0xFFFF                 // value to select 16 bits | ||||
| #define SHL_8_BITS 256                        // value used to shift a value 8 bits to the left | ||||
| #define SELECT_LSBits 0x000003FF              // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0x000FFC00             // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0x000FFFFF       // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 1024                    // shift left by 10 bits | ||||
| #define PAGE_SIZE 0x10000  // default page size for the multicorrelator memory map | ||||
| //#define MAX_PHASE_STEP_RAD 0.999999999534339  // 1 - pow(2,-31); | ||||
| #define RESET_ACQUISITION 2                  // command to reset the multicorrelator | ||||
| #define LAUNCH_ACQUISITION 1                 // command to launch the multicorrelator | ||||
| #define TEST_REG_SANITY_CHECK 0x55AA         // value to check the presence of the test register (to detect the hw) | ||||
| #define LOCAL_CODE_CLEAR_MEM 0x10000000      // command to clear the internal memory of the multicorrelator | ||||
| #define MEM_LOCAL_CODE_WR_ENABLE 0x0C000000  // command to enable the ENA and WR pins of the internal memory of the multicorrelator | ||||
| #define POW_2_2 4                            // 2^2 (used for the conversion of floating point numbers to integers) | ||||
| #define POW_2_29 536870912                   // 2^29 (used for the conversion of floating point numbers to integers) | ||||
| #define SELECT_LSB 0x00FF                    // value to select the least significant byte | ||||
| #define SELECT_MSB 0XFF00                    // value to select the most significant byte | ||||
| #define SELECT_16_BITS 0xFFFF                // value to select 16 bits | ||||
| #define SHL_8_BITS 256                       // value used to shift a value 8 bits to the left | ||||
| #define SELECT_LSBits 0x000003FF             // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0x000FFC00            // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0x000FFFFF      // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 1024                   // shift left by 10 bits | ||||
|  | ||||
|  | ||||
| bool fpga_acquisition::init() | ||||
| @@ -114,6 +114,7 @@ fpga_acquisition::fpga_acquisition(std::string device_name, | ||||
|  | ||||
|     d_PRN = 0; | ||||
|     DLOG(INFO) << "Acquisition FPGA class created"; | ||||
|     //printf("d_excludelimit = %d\n", d_excludelimit); | ||||
| } | ||||
|  | ||||
| void fpga_acquisition::open_device() | ||||
| @@ -216,7 +217,7 @@ void fpga_acquisition::set_block_exp(uint32_t total_block_exp) | ||||
|     d_map_base[11] = total_block_exp; | ||||
| } | ||||
|  | ||||
| void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, uint32_t doppler_min) | ||||
| void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, int32_t doppler_min) | ||||
| { | ||||
|     float phase_step_rad_real; | ||||
|     float phase_step_rad_int_temp; | ||||
| @@ -229,12 +230,12 @@ void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s | ||||
|     // The FPGA also expects the phase to be negative since it produces 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 (phase_step_rad_real >= 1.0) | ||||
|         { | ||||
|             phase_step_rad_real = MAX_PHASE_STEP_RAD; | ||||
|         } | ||||
|     //    // avoid saturation of the fixed point representation in the fpga | ||||
|     //    // (only the positive value can saturate due to the 2's complement representation) | ||||
|     //    if (phase_step_rad_real >= 1.0) | ||||
|     //        { | ||||
|     //            phase_step_rad_real = MAX_PHASE_STEP_RAD; | ||||
|     //        } | ||||
|     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 | ||||
|     d_map_base[3] = phase_step_rad_int; | ||||
| @@ -244,10 +245,10 @@ void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s | ||||
|     doppler = static_cast<int32_t>(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); | ||||
|     if (phase_step_rad_real >= 1.0) | ||||
|         { | ||||
|             phase_step_rad_real = MAX_PHASE_STEP_RAD; | ||||
|         } | ||||
|     //    if (phase_step_rad_real >= 1.0) | ||||
|     //        { | ||||
|     //            phase_step_rad_real = MAX_PHASE_STEP_RAD; | ||||
|     //        } | ||||
|     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 | ||||
|     d_map_base[4] = phase_step_rad_int; | ||||
|   | ||||
| @@ -60,7 +60,7 @@ public: | ||||
|     bool init(); | ||||
|     bool set_local_code(uint32_t PRN); | ||||
|     bool free(); | ||||
|     void set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, uint32_t doppler_max); | ||||
|     void set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, int32_t doppler_min); | ||||
|     void run_acquisition(void); | ||||
|  | ||||
|     void 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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Marc Majoral
					Marc Majoral