From 4f43935dd3815767c8223a1d9d38b175ae091e6a Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 3 Feb 2021 11:06:01 +0100 Subject: [PATCH] NR-SCH: CRC is KO if data is all zeros --- lib/src/phy/phch/sch_nr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/phy/phch/sch_nr.c b/lib/src/phy/phch/sch_nr.c index 045df37c1..ae31e13f9 100644 --- a/lib/src/phy/phch/sch_nr.c +++ b/lib/src/phy/phch/sch_nr.c @@ -639,9 +639,15 @@ int sch_nr_decode(srslte_sch_nr_t* q, } } + // Check if TB is all zeros + bool all_zeros = true; + for (uint32_t i = 0; i < tb->tbs && all_zeros; i++) { + all_zeros = (data[i] == 0); + } + // Calculate TB CRC from packed data uint32_t checksum1 = srslte_crc_checksum_byte(cfg.crc_tb, data, tb->tbs); - *crc_ok = (checksum1 == checksum2); + *crc_ok = (checksum1 == checksum2 && !all_zeros); SCH_INFO_RX("TB: TBS=%d; CRC={%06x, %06x}\n", tb->tbs, checksum1, checksum2); if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_DEBUG && !handler_registered) {