From 65ebfc0f2dbc59bfd23dc34bfb46517437df1332 Mon Sep 17 00:00:00 2001 From: ismagom Date: Wed, 26 Nov 2014 17:29:33 +0000 Subject: [PATCH] Fixed memory bug in CP detection --- lte/examples/cell_measurement.c | 2 +- lte/phy/lib/sync/src/sync.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lte/examples/cell_measurement.c b/lte/examples/cell_measurement.c index c59020a1a..c054bee05 100644 --- a/lte/examples/cell_measurement.c +++ b/lte/examples/cell_measurement.c @@ -49,7 +49,7 @@ float gain_offset = B210_DEFAULT_GAIN_CORREC; cell_detect_cfg_t cell_detect_config = { 500, // nof_frames_total 50, // nof_frames_detected - CS_FIND_THRESHOLD // threshold + 0.4 // threshold }; /********************************************************************** diff --git a/lte/phy/lib/sync/src/sync.c b/lte/phy/lib/sync/src/sync.c index 710adc7d9..2275880b8 100644 --- a/lte/phy/lib/sync/src/sync.c +++ b/lte/phy/lib/sync/src/sync.c @@ -199,7 +199,7 @@ int sync_sss(sync_t *q, cf_t *input, uint32_t peak_pos) { sss_synch_set_N_id_2(&q->sss, q->N_id_2); if (q->detect_cp) { - if (peak_pos - q->fft_size - CP_EXT(q->fft_size)) { + if (peak_pos - q->fft_size - CP_EXT(q->fft_size) > 0) { q->cp = detect_cp(q, input, peak_pos); } else { INFO("Not enough room to detect CP length. Peak position: %d\n", peak_pos);