Commit 5ea83b01 authored by Florian Kaltenberger's avatar Florian Kaltenberger Committed by Raymond Knopp

trial and error

parent 63d8931c
...@@ -640,11 +640,15 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -640,11 +640,15 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
LOG_D(PHY,"Reading %d samples for slot %d (%p)\n",samples_per_slot,*slot,rxp[0]); LOG_D(PHY,"Reading %d samples for slot %d (%p)\n",samples_per_slot,*slot,rxp[0]);
//when the USRP starts, it initializes the timestamp to 0. We wait 10 frames until we program the first rx. //when the USRP starts, it initializes the timestamp to 0. We wait 1 frames until we program the first rx.
if (proc->first_rx==1) { if (proc->first_rx==1) {
proc->timestamp_rx = fp->samples_per_frame*10; proc->timestamp_rx = fp->samples_per_frame;
proc->first_rx = 0; proc->first_rx = 0;
} }
else {
//we always advance the timestamp by samples_per_slot, even if we have not read the (full) slot. This is to keep the timestamp updated even when there is no RX.
proc->timestamp_rx += samples_per_slot;
}
int slot_type = nr_slot_select(cfg,*frame,*slot%fp->slots_per_frame); int slot_type = nr_slot_select(cfg,*frame,*slot%fp->slots_per_frame);
...@@ -683,8 +687,6 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -683,8 +687,6 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
//we always advance the timestamp by samples_per_slot, even if we have not read the (full) slot. This is to keep the timestamp updated even when there is no RX.
proc->timestamp_rx += samples_per_slot;
proc->frame_rx = *frame; proc->frame_rx = *frame;
proc->tti_rx = *slot; proc->tti_rx = *slot;
......
...@@ -294,12 +294,10 @@ static int trx_usrp_start(openair0_device *device) { ...@@ -294,12 +294,10 @@ static int trx_usrp_start(openair0_device *device) {
s->wait_for_first_pps = 0; s->wait_for_first_pps = 0;
} }
s->usrp->set_time_now(uhd::time_spec_t(0.0));
s->rx_count = 0; s->rx_count = 0;
s->tx_count = 0; s->tx_count = 0;
s->first_tx = 0; s->first_tx = 1;
s->first_rx = 0; s->first_rx = 1;
s->rx_timestamp = 0; s->rx_timestamp = 0;
return 0; return 0;
} }
...@@ -637,12 +635,20 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp, ...@@ -637,12 +635,20 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp,
int16x8_t buff_tmp[2][nsamps2]; int16x8_t buff_tmp[2][nsamps2];
#endif #endif
if (s->first_rx==1) {
s->usrp->set_time_now(uhd::time_spec_t(0.0));
s->first_rx=0;
}
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
stream_cmd.num_samps = nsamps; stream_cmd.num_samps = nsamps;
stream_cmd.stream_now = false; stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(ptimestamp,s->sample_rate); stream_cmd.time_spec = uhd::time_spec_t(ptimestamp,s->sample_rate);
s->rx_stream->issue_stream_cmd(stream_cmd); s->rx_stream->issue_stream_cmd(stream_cmd);
LOG_I(HW,"Time in ticks now: %llu \n", s->usrp->get_time_now().to_ticks(s->sample_rate));
LOG_I(HW,"rx_timestamp in ticks: %llu \n", ptimestamp);
if (cc>1) { if (cc>1) {
// receive multiple channels (e.g. RF A and RF B) // receive multiple channels (e.g. RF A and RF B)
...@@ -693,8 +699,9 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp, ...@@ -693,8 +699,9 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp ptimestamp,
} }
} }
if (samples_received < nsamps) if (samples_received < nsamps) {
LOG_E(HW,"[recv] received %d samples out of %d\n",samples_received,nsamps); LOG_E(HW,"[recv] received %d samples out of %d\n",samples_received,nsamps);
}
if ( s->rx_md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) if ( s->rx_md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE)
LOG_E(HW, "%s\n", s->rx_md.to_pp_string(true).c_str()); LOG_E(HW, "%s\n", s->rx_md.to_pp_string(true).c_str());
......
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