From 8505523928932309cf2ce5056e859b9ae1c74a7c Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 14 Apr 2022 16:00:34 +0200 Subject: [PATCH] ue,ue_sync: fix CP setting for find and track objects move setting of CP for find and track objects further down after the respective objects have been resized and updated there frame_len, fft_size, etc. members. Doing this too early cause a segfault with div by zero because the values were all zero --- lib/src/phy/ue/ue_sync.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/phy/ue/ue_sync.c b/lib/src/phy/ue/ue_sync.c index cd5e38fe2..71a3d2b34 100644 --- a/lib/src/phy/ue/ue_sync.c +++ b/lib/src/phy/ue/ue_sync.c @@ -330,8 +330,7 @@ int srsran_ue_sync_set_cell(srsran_ue_sync_t* q, srsran_cell_t cell) q->cell = cell; q->fft_size = srsran_symbol_sz(q->cell.nof_prb); q->sf_len = SRSRAN_SF_LEN(q->fft_size); - srsran_sync_set_cp(&q->sfind, q->cell.cp); - srsran_sync_set_cp(&q->strack, q->cell.cp); + if (cell.id == 1000) { /* If the cell is unkown, we search PSS/SSS in 5 ms */ q->nof_recv_sf = 5; @@ -367,6 +366,10 @@ int srsran_ue_sync_set_cell(srsran_ue_sync_t* q, srsran_cell_t cell) } } + // Set CP for find and track objects + srsran_sync_set_cp(&q->sfind, cell.cp); + srsran_sync_set_cp(&q->strack, cell.cp); + // When Cell ID is 1000, ue_sync receives nof_avg_find_frames frames in find state and does not go to tracking // state and is used to search a cell if (cell.id == 1000) { @@ -384,9 +387,6 @@ int srsran_ue_sync_set_cell(srsran_ue_sync_t* q, srsran_cell_t cell) srsran_sync_set_cfo_ema_alpha(&q->strack, 0.1); } else { - q->sfind.cp = cell.cp; - q->strack.cp = cell.cp; - srsran_sync_set_frame_type(&q->sfind, cell.frame_type); srsran_sync_set_frame_type(&q->strack, cell.frame_type);