Fixed BCCH encoding bug

master
ismagom 10 years ago
parent b96e33ffd6
commit 552c925036

@ -55,7 +55,7 @@ uint32_t mcs_idx = 12;
int nof_frames = -1; int nof_frames = -1;
char *uhd_args = ""; 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; filesink_t fsink;
lte_fft_t ifft; lte_fft_t ifft;
@ -324,6 +324,9 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error configuring HARQ process\n"); fprintf(stderr, "Error configuring HARQ process\n");
exit(-1); 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) { while (nf < nof_frames || nof_frames == -1) {
for (sf_idx = 0; sf_idx < NSUBFRAMES_X_FRAME && (nf < nof_frames || nof_frames == -1); sf_idx++) { 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); 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) { if (sf_idx == 0) {
pbch_encode(&pbch, bch_payload, sf_symbols); pbch_encode(&pbch, bch_payload, sf_symbols);
} }

@ -85,6 +85,7 @@ int bcch_bch_pack(lte_cell_t *cell, uint32_t sfn, uint8_t *buffer, uint32_t buff
sfn=(sfn>>2); sfn=(sfn>>2);
req.systemFrameNumber.buf = (uint8_t*) &sfn; req.systemFrameNumber.buf = (uint8_t*) &sfn;
req.systemFrameNumber.size = 1; req.systemFrameNumber.size = 1;
req.systemFrameNumber.bits_unused= 0;
int spare = 0; int spare = 0;
req.spare.buf = (uint8_t*) &spare; req.spare.buf = (uint8_t*) &spare;
req.spare.size = 2; 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 : ""); printf("Failed to encode element %s\n", n.failed_type ? n.failed_type->name : "");
return LIBLTE_ERROR; return LIBLTE_ERROR;
} }
asn_fprint(stdout, &asn_DEF_MasterInformationBlock, &req);
return LIBLTE_SUCCESS; return LIBLTE_SUCCESS;
} }

Loading…
Cancel
Save