Fixed TA symbol time

master
ismagom 10 years ago
parent ee53e11a8b
commit a96bb209b1

@ -469,7 +469,7 @@ int main(int argc, char **argv) {
uint32_t ul_sf_idx = (ue_sync_get_sfidx(&ue_sync)+6)%10;
ue_ul_set_cfo(&ue_ul, sync_get_cfo(&ue_sync.strack));
//ue_ul_set_cfo(&ue_ul, sync_get_cfo(&ue_sync.strack));
bit_pack_vector((uint8_t*) conn_request_msg, data, ra_pusch.mcs.tbs);
n = ue_ul_pusch_encode_rnti(&ue_ul, &ra_pusch, data, ul_sf_idx, rar_msg.temp_c_rnti, ul_signal);
if (n < 0) {
@ -492,20 +492,21 @@ int main(int argc, char **argv) {
uint32_t n_ta = lte_N_ta_new_rar(rar_msg.timing_adv_cmd);
printf("ta: %d, n_ta: %d\n", rar_msg.timing_adv_cmd, n_ta);
float time_adv_sec = ((float) n_ta)*TS_PRB(cell.nof_prb);
float time_adv_sec = ((float) n_ta)*LTE_TS;
vec_sc_prod_cfc(ul_signal, 20, ul_signal, SF_LEN_PRB(cell.nof_prb));
vec_sc_prod_cfc(ul_signal, 2, ul_signal, SF_LEN_PRB(cell.nof_prb));
timestamp_copy(&next_tx_time, &uhd_time);
timestamp_copy(&next_tx_time, &uhd_time);
timestamp_add(&next_tx_time, 0, 0.006 - time_adv_sec); // send after 6 sub-frames (6 ms)
printf("Send %d samples PUSCH sfn: %d. Last frame time = %.6f"
"send PUSCH time = %.6f TA: %.1f us\n",
"send PUSCH time = %.6f TA: %.1f us\n",
SF_LEN_PRB(cell.nof_prb), sfn, timestamp_real(&uhd_time),
timestamp_real(&next_tx_time), time_adv_sec*1000000);
timestamp_real(&next_tx_time), time_adv_sec*1000000);
cuhd_send_timed(uhd, ul_signal, SF_LEN_PRB(cell.nof_prb),
next_tx_time.full_secs, next_tx_time.frac_secs);
vec_save_file("prach_example_signal", ul_signal, sizeof(cf_t)*7680);
go_exit = 1;
}
if (sfn >= rar_window_stop) {

@ -98,9 +98,7 @@ typedef enum {CPNORM, CPEXT} lte_cp_t;
#define SLOT_LEN_RE(nof_prb, cp) (nof_prb*RE_X_RB*CP_NSYMB(cp))
#define SF_LEN_RE(nof_prb, cp) (2*SLOT_LEN_RE(nof_prb, cp))
#define TS_SYMBOLSZ(symbol_sz) (1.0/(15000.0*symbol_sz))
#define TS_PRB(nof_prb) TS_SYMBOLSZ(lte_symbol_sz(nof_prb))
#define LTE_TS 1.0/(15000.0*2048)
#define SLOT_IDX_CPNORM(symbol_idx, symbol_sz) (symbol_idx==0?0:(symbol_sz + CP(symbol_sz, CPNORM_0_LEN) + \
(symbol_idx-1)*(symbol_sz+CP(symbol_sz, CPNORM_LEN))))

Loading…
Cancel
Save