Commit 03ba5582 authored by ivan's avatar ivan

successful testing of RX path of DL and SL reception with 2 B210

parent 01913855
......@@ -96,7 +96,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
for (int aa=SLaoffset;aa<(ue->frame_parms.nb_antennas_rx<<SLaoffset);aa+=(1<<SLaoffset)) {
ru_tmp.common.rxdata[aa] = (int32_t*)&ue->common_vars.rxdata[aa][0];
ru_tmp.common.rxdata[aa>>1] = (int32_t*)&ue->common_vars.rxdata[aa][0];
}
ru_tmp.common.rxdata_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
......
......@@ -885,8 +885,9 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
memcpy((void*)&ru_tmp.frame_parms,(void*)&ue->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
ru_tmp.N_TA_offset=0;
// ru_tmp.common.rxdata = ue->common_vars.rxdata;
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
for (int aa=SLaoffset;aa<(ue->frame_parms.nb_antennas_rx<<SLaoffset);aa+=(1<<SLaoffset)) {
ru_tmp.common.rxdata[aa] = (int32_t*)&ue->common_vars.rxdata[aa][0];
ru_tmp.common.rxdata[aa>>1] = (int32_t*)&ue->common_vars.rxdata[aa][0];
}
ru_tmp.common.rxdata_7_5kHz = (int32_t**)rxdata_7_5kHz;
......
......@@ -314,32 +314,53 @@ static int trx_usrp_start(openair0_device *device) {
s->usrp->set_gpio_attr("FP0", "CTRL", 0x1f,0x1f);
//set ATR register
s->usrp->set_gpio_attr("FP0", "ATR_RX", 1<<4, 0x1f);
s->tx_md.has_time_spec = true;
s->tx_md.start_of_burst = true;
s->tx_md.end_of_burst = false;
s->rx_count = 0;
s->tx_count = 0;
s->rx_timestamp = 0;
// init recv and send streaming
if (s==(usrp_state_t *)device->priv2) break;
}
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
LOG_I(PHY,"USRP %p: Time in secs now: %llu \n", s,s->usrp->get_time_now().to_ticks(s->sample_rate));
LOG_I(PHY,"USRP %p: Time in secs last pps: %llu \n", s,s->usrp->get_time_last_pps().to_ticks(s->sample_rate));
cmd.stream_now = false; // start at constant delay
s= (usrp_state_t *)device->priv;
if (s->use_gps == 1 || s->external_time_source == 1) {
s->wait_for_first_pps = 1;
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
if (device->priv2!=NULL) {
usrp_state_t *s2 = (usrp_state_t*)device->priv2;
s2->wait_for_first_pps = 1;
s2->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
}
sleep(1);
cmd.time_spec = s->usrp->get_time_last_pps() + uhd::time_spec_t(1.0);
s->tx_md.time_spec = cmd.time_spec + uhd::time_spec_t(1-(double)s->tx_forward_nsamps/s->sample_rate);
s->rx_stream->issue_stream_cmd(cmd);
LOG_I(PHY,"USRP %p: Time to wakeups: %llu \n", s,cmd.time_spec.to_ticks(s->sample_rate));
if (device->priv2!=NULL) {
usrp_state_t *s2 = (usrp_state_t*)device->priv2;
uhd::stream_cmd_t cmd2(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
cmd2.stream_now = false; // start at constant delay
cmd2.time_spec = s2->usrp->get_time_last_pps() + uhd::time_spec_t(1.0);
s2->rx_stream->issue_stream_cmd(cmd2);
LOG_I(PHY,"USRP %p: Time to wakeups: %llu \n", s2,cmd.time_spec.to_ticks(s2->sample_rate));
}
} else {
s->wait_for_first_pps = 0;
cmd.time_spec = s->usrp->get_time_now() + uhd::time_spec_t(0.05);
s->tx_md.time_spec = cmd.time_spec + uhd::time_spec_t(1-(double)s->tx_forward_nsamps/s->sample_rate);
s->rx_stream->issue_stream_cmd(cmd);
}
LOG_I(PHY,"USRP %p: Time to wakeups: %llu \n", s,cmd.time_spec.to_ticks(s->sample_rate));
cmd.stream_now = false; // start at constant delay
s->rx_stream->issue_stream_cmd(cmd);
s->tx_md.time_spec = cmd.time_spec + uhd::time_spec_t(1-(double)s->tx_forward_nsamps/s->sample_rate);
s->tx_md.has_time_spec = true;
s->tx_md.start_of_burst = true;
s->tx_md.end_of_burst = false;
s->rx_count = 0;
s->tx_count = 0;
s->rx_timestamp = 0;
if (s==(usrp_state_t *)device->priv2) break;
}
#if defined(USRP_REC_PLAY)
}
#endif
......@@ -582,11 +603,9 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
samples_received=0;
while (samples_received != nsamps) {
LOG_I(HW,"USRP %p: Receiving %d samples\n",s,nsamps);
samples_received += s->rx_stream->recv(buff_tmp[board]+samples_received,
nsamps-samples_received, s->rx_md);
LOG_I(HW,"USRP %p: Got %d samples @ %llu\n",s,samples_received,s->rx_md.time_spec.to_ticks(s->sample_rate));
if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE))
break;
/*
......@@ -1116,13 +1135,13 @@ extern "C" {
return(-1);
}
LOG_I(HW,"Found %lu USRP of type %s\n", device_adds.size(),device_adds[0].get("type").c_str());
for (int i=0;i<device_adds.size();i++) LOG_I(HW,"USRP %d: %s\n",i,device_adds[i].get("serial").c_str());
if (device_adds[0].get("type") == "b200") {
device->type = USRP_B200_DEV;
usrp_master_clock = 30.72e6;
AssertFatal(device_adds.size()<3,"Number of B2x0 USRP must be 1 or 2\n");
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ;
args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680,serial=" ;
}
if (device_adds[0].get("type") == "n3xx") {
......@@ -1139,10 +1158,10 @@ extern "C" {
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
}
s->usrp = uhd::usrp::multi_usrp::make(args);
s->usrp = uhd::usrp::multi_usrp::make(args+device_adds[1].get("serial").c_str());
if (device_adds.size()==2 && device->type == USRP_B200_DEV) { //allow for second instance of UHD with B2x0
s2 = (usrp_state_t *)calloc(sizeof(usrp_state_t),1);
s2->usrp = uhd::usrp::multi_usrp::make(args);
s2->usrp = uhd::usrp::multi_usrp::make(args+device_adds[0].get("serial").c_str());
}
// lock mboard clocks
if (openair0_cfg[0].clock_source == internal && device_adds.size() == 1) {
......@@ -1151,7 +1170,7 @@ extern "C" {
}
else {// if we set to external or if we have more than 1 USRP
s->usrp->set_clock_source("external");
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->usrp->set_clock_source("internal");
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->usrp->set_clock_source("external");
LOG_I(HW,"Setting clock source to external\n");
}
// if we have more than 1 USRP require PPS source
......@@ -1244,7 +1263,7 @@ extern "C" {
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
s->usrp->set_master_clock_rate(30.72e6);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s->usrp->set_master_clock_rate(30.72e6);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->usrp->set_master_clock_rate(30.72e6);
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115;
openair0_cfg[0].tx_bw = 20e6;
......@@ -1305,8 +1324,8 @@ extern "C" {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
s2->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s2->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
}
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
......@@ -1364,14 +1383,14 @@ extern "C" {
stream_args_rx.channels.push_back(i);
s->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->rx_stream = s2->usrp->get_rx_stream(stream_args_rx);
uhd::stream_args_t stream_args_tx("sc16", "sc16");
for (int i = 0; i<openair0_cfg[0].tx_num_channels; i++)
stream_args_tx.channels.push_back(i);
s->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) s2->tx_stream = s2->usrp->get_tx_stream(stream_args_tx);
/* Setting TX/RX BW after streamers are created due to USRP calibration issue */
for(int i=0; i<s->usrp->get_tx_num_channels() && i<openair0_cfg[0].tx_num_channels; i++) {
s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment