mirror of https://github.com/PentHertz/srsLTE.git
Fixed issue with PSS correlation
This commit is contained in:
parent
856a899ff0
commit
e98f718806
|
@ -47,7 +47,8 @@
|
|||
float gain_offset = B210_DEFAULT_GAIN_CORREC;
|
||||
|
||||
cell_search_cfg_t cell_detect_config = {
|
||||
50, // nof_frames_total
|
||||
500, // maximum number of frames to receive for MIB decoding
|
||||
50, // maximum number of frames to receive for PSS correlation
|
||||
9.0 // early-stops cell detection if mean PSR is above this value
|
||||
};
|
||||
|
||||
|
|
|
@ -106,7 +106,8 @@ int cell_scanner_cell(cell_scanner_t *q, float frequency, int N_id_2, cell_scann
|
|||
printf("Tunning receiver to %.3f MHz\n", (double ) frequency/1000000);
|
||||
|
||||
cell_search_cfg_t cfg;
|
||||
cfg.nof_frames_total = q->config.cell_detect_max_frames;
|
||||
cfg.max_frames_pss = q->config.pss_max_frames;
|
||||
cfg.max_frames_pbch = q->config.pbch_max_frames;
|
||||
cfg.threshold = q->config.cell_detect_early_stop_threshold;
|
||||
|
||||
ret = cuhd_search_and_decode_mib(q->uhd, &cfg, N_id_2, &cell);
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
#include "liblte/phy/phy.h"
|
||||
|
||||
typedef struct {
|
||||
int cell_detect_max_frames;
|
||||
int pss_max_frames;
|
||||
int pbch_max_frames;
|
||||
float cell_detect_early_stop_threshold;
|
||||
int measure_avg_nof_frames;
|
||||
char *uhd_args;
|
||||
|
|
|
@ -111,7 +111,11 @@ int main(int argc, char **argv) {
|
|||
cfg.cell_detect_early_stop_threshold = 20.0; // This is a normal value.
|
||||
// maximum 5 ms frames that will be scanned maximum in the case the threshold is not exceed
|
||||
// ie for bad cells
|
||||
cfg.cell_detect_max_frames = 50; // this is 250 ms
|
||||
cfg.pss_max_frames = 50; // this is 250 ms
|
||||
|
||||
// maximum 5 ms frames that will be received to decode the PBCH
|
||||
// ie for bad cells
|
||||
cfg.pbch_max_frames = 500; // this is 2500 ms
|
||||
|
||||
// Number of 1 ms subframes that will be used to compute rsrp, rsrq, snr, etc average
|
||||
cfg.measure_avg_nof_frames = 1000; // 1 sec
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
int band = -1;
|
||||
int earfcn_start=-1, earfcn_end = -1;
|
||||
|
||||
cell_search_cfg_t config = {50, 1.1};
|
||||
cell_search_cfg_t config = {500, 50, 1.1};
|
||||
|
||||
|
||||
float uhd_gain = 60.0;
|
||||
|
@ -89,7 +89,7 @@ void parse_args(int argc, char **argv) {
|
|||
earfcn_end = atoi(argv[optind]);
|
||||
break;
|
||||
case 'n':
|
||||
config.nof_frames_total = atoi(argv[optind]);
|
||||
config.max_frames_pss = atoi(argv[optind]);
|
||||
break;
|
||||
case 't':
|
||||
config.threshold = atof(argv[optind]);
|
||||
|
@ -162,8 +162,8 @@ int main(int argc, char **argv) {
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
if (config.nof_frames_total) {
|
||||
ue_cell_search_set_nof_frames_to_scan(&cs, config.nof_frames_total);
|
||||
if (config.max_frames_pss) {
|
||||
ue_cell_search_set_nof_frames_to_scan(&cs, config.max_frames_pss);
|
||||
}
|
||||
if (config.threshold) {
|
||||
ue_cell_search_set_threshold(&cs, config.threshold);
|
||||
|
|
|
@ -103,8 +103,8 @@ int cuhd_cell_search(void *uhd, cell_search_cfg_t *config,
|
|||
return LIBLTE_ERROR;
|
||||
}
|
||||
|
||||
if (config->nof_frames_total) {
|
||||
ue_cell_search_set_nof_frames_to_scan(&cs, config->nof_frames_total);
|
||||
if (config->max_frames_pss) {
|
||||
ue_cell_search_set_nof_frames_to_scan(&cs, config->max_frames_pss);
|
||||
}
|
||||
if (config->threshold) {
|
||||
ue_cell_search_set_threshold(&cs, config->threshold);
|
||||
|
@ -158,7 +158,7 @@ int cuhd_search_and_decode_mib(void *uhd, cell_search_cfg_t *config, int force_N
|
|||
ret = cuhd_cell_search(uhd, config, force_N_id_2, cell);
|
||||
if (ret > 0) {
|
||||
printf("Decoding PBCH for cell %d (N_id_2=%d)\n", cell->id, cell->id%3);
|
||||
ret = cuhd_mib_decoder(uhd, config->nof_frames_total, cell);
|
||||
ret = cuhd_mib_decoder(uhd, config->max_frames_pbch, cell);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Could not decode PBCH from CELL ID %d\n", cell->id);
|
||||
return LIBLTE_ERROR;
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "liblte/phy/phy.h"
|
||||
|
||||
typedef struct LIBLTE_API {
|
||||
uint32_t nof_frames_total; // maximum number of 5ms frames to capture
|
||||
uint32_t max_frames_pbch; // maximum number of 5ms frames to capture for MIB decoding
|
||||
uint32_t max_frames_pss; // maximum number of 5ms frames to capture for PSS correlation
|
||||
float threshold; // early-stops cell detection if mean PSR is above this value
|
||||
}cell_search_cfg_t;
|
||||
|
||||
|
|
|
@ -302,10 +302,10 @@ int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value)
|
|||
conv_output_len = conv_cc(input, q->pss_signal_freq[q->N_id_2], q->conv_output, q->frame_size, q->fft_size);
|
||||
#endif
|
||||
} else {
|
||||
for (int i=q->fft_size;i<q->fft_size+q->frame_size-1;i++) {
|
||||
q->conv_output[i] = vec_dot_prod_ccc(q->pss_signal_freq[q->N_id_2], &input[i-q->fft_size], q->fft_size);
|
||||
for (int i=0;i<q->frame_size-1;i++) {
|
||||
q->conv_output[i] = vec_dot_prod_ccc(q->pss_signal_freq[q->N_id_2], &input[i], q->fft_size);
|
||||
}
|
||||
conv_output_len = q->fft_size+q->frame_size-1;
|
||||
conv_output_len = q->frame_size-1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -364,6 +364,13 @@ int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value)
|
|||
1000000*q->conv_output_avg[corr_peak_pos], 1000000*side_lobe_value,*corr_peak_value
|
||||
);
|
||||
}
|
||||
|
||||
if (isnan(*corr_peak_value) || isinf(*corr_peak_value)) {
|
||||
int i=0;
|
||||
vec_save_file("corrout", q->conv_output_avg, conv_output_len*sizeof(float));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
if (corr_peak_value) {
|
||||
|
@ -371,7 +378,11 @@ int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value)
|
|||
}
|
||||
#endif
|
||||
|
||||
ret = (int) corr_peak_pos;
|
||||
if (q->frame_size >= q->fft_size) {
|
||||
ret = (int) corr_peak_pos;
|
||||
} else {
|
||||
ret = (int) corr_peak_pos + q->fft_size;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -316,7 +316,6 @@ int sync_find(sync_t *q, cf_t *input, uint32_t find_offset, uint32_t *peak_posit
|
|||
|
||||
/* compute cumulative moving average CFO */
|
||||
q->mean_cfo = VEC_EMA(cfo, q->mean_cfo, CFO_EMA_ALPHA);
|
||||
|
||||
} else {
|
||||
INFO("No space for CFO computation. Frame starts at \n",peak_pos);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ int ue_mib_decode(ue_mib_t * q, cf_t *input,
|
|||
return LIBLTE_ERROR;
|
||||
}
|
||||
/* Reset decoder if we missed a frame */
|
||||
if (q->frame_cnt > 16) {
|
||||
if (q->frame_cnt > 8) {
|
||||
INFO("Resetting PBCH decoder after %d frames\n", q->frame_cnt);
|
||||
ue_mib_reset(q);
|
||||
}
|
||||
|
|
|
@ -217,6 +217,9 @@ static int find_peak_ok(ue_sync_t *q) {
|
|||
q->frame_no_cnt = 0;
|
||||
q->frame_total_cnt = 0;
|
||||
q->frame_find_cnt = 0;
|
||||
|
||||
/* Set tracking CFO average to find CFO */
|
||||
q->strack.mean_cfo = q->sfind.mean_cfo;
|
||||
|
||||
/* Goto Tracking state */
|
||||
q->state = SF_TRACK;
|
||||
|
@ -269,7 +272,7 @@ int track_peak_no(ue_sync_t *q) {
|
|||
/* if we missed too many PSS go back to FIND */
|
||||
q->frame_no_cnt++;
|
||||
if (q->frame_no_cnt >= TRACK_MAX_LOST) {
|
||||
INFO("\n%d frames lost. Going back to FIND\n", (int) q->frame_no_cnt);
|
||||
printf("\n%d frames lost. Going back to FIND\n", (int) q->frame_no_cnt);
|
||||
q->state = SF_FIND;
|
||||
} else {
|
||||
INFO("Tracking peak not found. Peak %.3f, %d lost\n",
|
||||
|
@ -375,7 +378,10 @@ int ue_sync_get_buffer(ue_sync_t *q, cf_t **sf_symbols) {
|
|||
|
||||
/* Do CFO Correction if not done in track and deliver the frame */
|
||||
if (!q->strack.correct_cfo) {
|
||||
cfo_correct(&q->sfind.cfocorr, q->input_buffer, q->input_buffer, -sync_get_cfo(&q->strack) / q->fft_size);
|
||||
cfo_correct(&q->sfind.cfocorr,
|
||||
q->input_buffer,
|
||||
q->input_buffer,
|
||||
-sync_get_cfo(&q->strack) / q->fft_size);
|
||||
}
|
||||
*sf_symbols = q->input_buffer;
|
||||
|
||||
|
|
Loading…
Reference in New Issue