From 552c925036fede107fd0e85f858f0072f7ba0386 Mon Sep 17 00:00:00 2001 From: ismagom Date: Tue, 18 Nov 2014 21:22:42 +0100 Subject: [PATCH] Fixed BCCH encoding bug --- lte/examples/pdsch_enodeb.c | 6 ++++-- lte/rrc/lib/messages/src/bcch.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lte/examples/pdsch_enodeb.c b/lte/examples/pdsch_enodeb.c index 8dd4f7f60..ac9c4e154 100644 --- a/lte/examples/pdsch_enodeb.c +++ b/lte/examples/pdsch_enodeb.c @@ -55,7 +55,7 @@ uint32_t mcs_idx = 12; int nof_frames = -1; char *uhd_args = ""; -float uhd_amp = 0.01, uhd_gain = 10.0, uhd_freq = 2400000000; +float uhd_amp = 0.1, uhd_gain = 40.0, uhd_freq = 2400000000; filesink_t fsink; lte_fft_t ifft; @@ -324,6 +324,9 @@ int main(int argc, char **argv) { fprintf(stderr, "Error configuring HARQ process\n"); exit(-1); } + + bcch_bch_pack(&cell, 0, bch_payload_packed, BCH_PAYLOAD_LEN/8); + bit_pack_vector(bch_payload_packed, bch_payload, BCH_PAYLOAD_LEN); while (nf < nof_frames || nof_frames == -1) { for (sf_idx = 0; sf_idx < NSUBFRAMES_X_FRAME && (nf < nof_frames || nof_frames == -1); sf_idx++) { @@ -336,7 +339,6 @@ int main(int argc, char **argv) { } bcch_bch_pack(&cell, sfn, bch_payload_packed, BCH_PAYLOAD_LEN/8); - bit_pack_vector(bch_payload_packed, bch_payload, BCH_PAYLOAD_LEN); if (sf_idx == 0) { pbch_encode(&pbch, bch_payload, sf_symbols); } diff --git a/lte/rrc/lib/messages/src/bcch.c b/lte/rrc/lib/messages/src/bcch.c index 0ad68d572..423148ae5 100644 --- a/lte/rrc/lib/messages/src/bcch.c +++ b/lte/rrc/lib/messages/src/bcch.c @@ -85,6 +85,7 @@ int bcch_bch_pack(lte_cell_t *cell, uint32_t sfn, uint8_t *buffer, uint32_t buff sfn=(sfn>>2); req.systemFrameNumber.buf = (uint8_t*) &sfn; req.systemFrameNumber.size = 1; + req.systemFrameNumber.bits_unused= 0; int spare = 0; req.spare.buf = (uint8_t*) &spare; req.spare.size = 2; @@ -96,7 +97,7 @@ int bcch_bch_pack(lte_cell_t *cell, uint32_t sfn, uint8_t *buffer, uint32_t buff printf("Failed to encode element %s\n", n.failed_type ? n.failed_type->name : ""); return LIBLTE_ERROR; } - asn_fprint(stdout, &asn_DEF_MasterInformationBlock, &req); + return LIBLTE_SUCCESS; }