Hello everyone,I want to add timing synchronization to the system, so I need sib9, but the value of the sched_info_list is always 1 and cannot be changed. I added this in generate_sibs() under srsRAN/srsgnb/src/stack/rrc/rrc_nr.cc
int32_t rrc_nr::generate_sibs()
{
if (not cfg.is_standalone) {
return SRSRAN_SUCCESS;
}
// SIB1 packing
const si_sched_info_s::sched_info_list_l_& sched_info = du_cfg->cell(0).sib1.si_sched_info.sched_info_list;
// SI messages packing
cell_ctxt->sibs.resize(8);//cell_ctxt->sibs.resize(1);
sib2_s& sib2 = cell_ctxt->sibs[0].set_sib2();
sib2.cell_resel_info_common.q_hyst.value = sib2_s::cell_resel_info_common_s_::q_hyst_opts::db5;
sib9_s& sib9 = cell_ctxt->sibs[7].set_sib9();
struct timeval tv;
struct timezone tz;
gettimeofday(&tv,NULL);
uint64 mileseconds = tv.tv_sec*1000 + tv.tv_usec/1000 + 2208988800000;
sib9.time_info.time_info_utc = mileseconds/10;
printf("utc:%lu\n",sib9.time_info.time_info_utc);
// msg is array of SI messages, each SI message msg[i] may contain multiple SIBs
// all SIBs in a SI message msg[i] share the same periodicity
const uint32_t nof_messages =
du_cfg->cell(0).sib1.si_sched_info_present ? du_cfg->cell(0).sib1.si_sched_info.sched_info_list.size() : 0;
cell_ctxt->sib_buffer.reserve(nof_messages + 1);
asn1::dyn_array<bcch_dl_sch_msg_s> msg(nof_messages + 1);
// Copy SIB1 to first SI message
msg[0].msg.set_c1().set_sib_type1() = du_cfg->cell(0).sib1;
// Copy rest of SIBs
printf("nof_messages:%u\n",nof_messages);
for (uint32_t sched_info_elem = 0; sched_info_elem < nof_messages; sched_info_elem++) {
printf("Copy rest of SIBs");
uint32_t msg_index = sched_info_elem + 1; // first msg is SIB1, therefore start with second
msg[msg_index].msg.set_c1().set_sys_info().crit_exts.set_sys_info();
auto& sib_list = msg[msg_index].msg.c1().sys_info().crit_exts.sys_info().sib_type_and_info;
for (uint32_t mapping = 0; mapping < sched_info[sched_info_elem].sib_map_info.size(); ++mapping) {
uint32_t sibidx = sched_info[sched_info_elem].sib_map_info[mapping].type; // SIB2 == 0
sib_list.push_back(cell_ctxt->sibs[sibidx]);
}
}
// Pack payload for all messages
for (uint32_t msg_index = 0; msg_index < nof_messages + 1; msg_index++) {
srsran::unique_byte_buffer_t sib_pdu = pack_into_pdu(msg[msg_index]);
if (sib_pdu == nullptr) {
printf("Failed to pack SIB");
logger.error("Failed to pack SIB");
return SRSRAN_ERROR;
}
cell_ctxt->sib_buffer.push_back(std::move(sib_pdu));
// Log SIBs in JSON format
fmt::memory_buffer strbuf;
if (msg_index == 0) {
fmt::format_to(strbuf, "SIB1 payload");
} else {
fmt::format_to(strbuf, "SI message={} payload", msg_index + 1);
}
log_rrc_message("BCCH", Tx, *cell_ctxt->sib_buffer.back(), msg[msg_index], srsran::to_c_str(strbuf));
}
return SRSRAN_SUCCESS;
}
The UE section is as follows
Added in srsRAN/srsue/src/stack/rrc_nr/rrc_nr.cc decode_pdu_bcch_dlsch
void rrc_nr::decode_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu)
{
// Stop BCCH search after successful reception of 1 BCCH block
bcch_dl_sch_msg_s dlsch_msg;
asn1::cbit_ref dlsch_bref(pdu->msg, pdu->N_bytes);
asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
if (err != asn1::SRSASN_SUCCESS or dlsch_msg.msg.type().value != bcch_dl_sch_msg_type_c::types_opts::c1) {
logger.error(pdu->msg, pdu->N_bytes, "Could not unpack BCCH DL-SCH message (%d B).", pdu->N_bytes);
return;
}
log_rrc_message("BCCH-DLSCH", Rx, pdu.get(), dlsch_msg, dlsch_msg.msg.c1().type().to_string());
if (dlsch_msg.msg.c1().type() == bcch_dl_sch_msg_type_c::c1_c_::types::sib_type1) {
std::cout << "dlsch_msg.msg.c1().type() = " << dlsch_msg.msg.c1().type() << std::endl;
logger.info("Processing SIB1 (1/1)");
handle_sib1(dlsch_msg.msg.c1().sib_type1());
} else {
sys_info_ies_s::sib_type_and_info_l_& sib_list =
dlsch_msg.msg.c1().sys_info().crit_exts.sys_info().sib_type_and_info;
for (uint32_t i = 0; i < sib_list.size(); ++i) {
logger.info("Processing SIB%d (%d/%d)", sib_list[i].type().to_number(), i, sib_list.size());
switch (sib_list[i].type().value) {
case sib_type_info_s::type_e_::sib_type9:
if (not meas_cells.serving_cell().has_sib9()) {
meas_cells.serving_cell().set_sib9(sib_list[i].sib9());
}
handle_sib9(dlsch_msg.msg.c1().sib_type9());
si_acquirer.trigger(si_acquire_proc::sib_received_ev{});
break;
default:
logger.warning("SIB%d is not supported", sib_list[i].type().to_number());
}
}
}
}
At present, there is a problem with sib9, and it is not possible to send SIB9 successfully,therefore, I intend to add the content of SIB9 directly to SIB1, and I add the content of SIB9 in the structure of SIB1, and the following problems occur after running
I want to ask how to solve these two problems, especially the first question, how to add and implement SIB9 function normally, which step did I miss? And the second question, I will crash if I add sib9 directly to sib1, how to solve this problem if the first normal solution cannot be implemented
Hello everyone,I want to add timing synchronization to the system, so I need sib9, but the value of the sched_info_list is always 1 and cannot be changed. I added this in generate_sibs() under srsRAN/srsgnb/src/stack/rrc/rrc_nr.cc
The UE section is as follows Added in srsRAN/srsue/src/stack/rrc_nr/rrc_nr.cc decode_pdu_bcch_dlsch
At present, there is a problem with sib9, and it is not possible to send SIB9 successfully,therefore, I intend to add the content of SIB9 directly to SIB1, and I add the content of SIB9 in the structure of SIB1, and the following problems occur after running I want to ask how to solve these two problems, especially the first question, how to add and implement SIB9 function normally, which step did I miss? And the second question, I will crash if I add sib9 directly to sib1, how to solve this problem if the first normal solution cannot be implemented