Addition of PRACH TA correction

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 442926cf66
commit e8f9bfc6ba

@ -544,7 +544,7 @@ public:
/* Configure PRACH using parameters written by RRC */ /* Configure PRACH using parameters written by RRC */
virtual void configure_prach_params() = 0; virtual void configure_prach_params() = 0;
virtual void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) = 0; virtual void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec) = 0;
virtual prach_info_t prach_get_info() = 0; virtual prach_info_t prach_get_info() = 0;
/* Indicates the transmission of a SR signal in the next opportunity */ /* Indicates the transmission of a SR signal in the next opportunity */

@ -85,7 +85,7 @@ public:
void configure_prach_params() final; void configure_prach_params() final;
/* Transmits PRACH in the next opportunity */ /* Transmits PRACH in the next opportunity */
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) final; void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec) final;
prach_info_t prach_get_info() final; prach_info_t prach_get_info() final;
/* Indicates the transmission of a SR signal in the next opportunity */ /* Indicates the transmission of a SR signal in the next opportunity */
@ -158,6 +158,7 @@ private:
/* Current time advance */ /* Current time advance */
uint32_t n_ta = 0; uint32_t n_ta = 0;
uint32_t n_ta_base = 0;
static void set_default_args(phy_args_t& args); static void set_default_args(phy_args_t& args);
bool check_args(const phy_args_t& args); bool check_args(const phy_args_t& args);

@ -259,6 +259,7 @@ void phy::get_metrics(phy_metrics_t* m)
void phy::set_timeadv_rar(uint32_t ta_cmd) void phy::set_timeadv_rar(uint32_t ta_cmd)
{ {
n_ta = srslte_N_ta_new_rar(ta_cmd); n_ta = srslte_N_ta_new_rar(ta_cmd);
n_ta += n_ta_base;
sfsync.set_time_adv_sec(((float)n_ta) * SRSLTE_LTE_TS); sfsync.set_time_adv_sec(((float)n_ta) * SRSLTE_LTE_TS);
Info("PHY: Set TA RAR: ta_cmd: %d, n_ta: %d, ta_usec: %.1f\n", ta_cmd, n_ta, ((float)n_ta) * SRSLTE_LTE_TS * 1e6); Info("PHY: Set TA RAR: ta_cmd: %d, n_ta: %d, ta_usec: %.1f\n", ta_cmd, n_ta, ((float)n_ta) * SRSLTE_LTE_TS * 1e6);
} }
@ -339,10 +340,11 @@ float phy::get_pathloss_db()
return common.cur_pathloss; return common.cur_pathloss;
} }
void phy::prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) void phy::prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec)
{ {
n_ta = 0; n_ta = 0; /* Reset Time aligment */
sfsync.set_time_adv_sec(0.0f); n_ta_base = (uint32_t)roundf(ta_base_sec / SRSLTE_LTE_TS);
sfsync.set_time_adv_sec(ta_base_sec);
common.reset_radio(); common.reset_radio();
if (!prach_buffer.prepare_to_send(preamble_idx, allowed_subframe, target_power_dbm)) { if (!prach_buffer.prepare_to_send(preamble_idx, allowed_subframe, target_power_dbm)) {
Error("Preparing PRACH to send\n"); Error("Preparing PRACH to send\n");
@ -370,6 +372,7 @@ void phy::reset()
{ {
Info("Resetting PHY\n"); Info("Resetting PHY\n");
n_ta = 0; n_ta = 0;
n_ta_base = 0;
sfsync.set_time_adv_sec(0); sfsync.set_time_adv_sec(0);
for (uint32_t i = 0; i < nof_workers; i++) { for (uint32_t i = 0; i < nof_workers; i++) {
workers[i]->reset(); workers[i]->reset();

@ -343,7 +343,7 @@ void ra_proc::preamble_transmission()
received_target_power_dbm = rach_cfg.iniReceivedTargetPower + delta_preamble_db + received_target_power_dbm = rach_cfg.iniReceivedTargetPower + delta_preamble_db +
(preambleTransmissionCounter - 1) * rach_cfg.powerRampingStep; (preambleTransmissionCounter - 1) * rach_cfg.powerRampingStep;
phy_h->prach_send(sel_preamble, sel_maskIndex - 1, received_target_power_dbm); phy_h->prach_send(sel_preamble, sel_maskIndex - 1, received_target_power_dbm, 0.0f);
rntis->rar_rnti = 0; rntis->rar_rnti = 0;
ra_tti = 0; ra_tti = 0;
rar_received = false; rar_received = false;

@ -123,7 +123,7 @@ public:
// phy_interface_mac_lte // phy_interface_mac_lte
void configure_prach_params(){}; void configure_prach_params(){};
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec)
{ {
prach_delay_cnt = 0; prach_delay_cnt = 0;
last_preamble_idx = preamble_idx; last_preamble_idx = preamble_idx;

@ -501,7 +501,7 @@ int main(int argc, char** argv)
// 3. Transmit PRACH // 3. Transmit PRACH
phy_test->get_phy_interface_mac()->configure_prach_params(); phy_test->get_phy_interface_mac()->configure_prach_params();
phy_test->get_phy_interface_mac()->prach_send(0, -1, 0.0f); phy_test->get_phy_interface_mac()->prach_send(0, -1, 0.0f, 0.0f);
TESTASSERT(phy_test->get_radio()->wait_tx(default_timeout, false)); TESTASSERT(phy_test->get_radio()->wait_tx(default_timeout, false));
// 4. Configure RNTI with PUCCH and check transmission // 4. Configure RNTI with PUCCH and check transmission

@ -93,7 +93,7 @@ public:
// phy_interface_mac_lte // phy_interface_mac_lte
void configure_prach_params(); void configure_prach_params();
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm); void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec);
prach_info_t prach_get_info(); prach_info_t prach_get_info();
void sr_send(); void sr_send();
int sr_last_tx_tti(); int sr_last_tx_tti();

@ -194,7 +194,7 @@ void lte_ttcn3_phy::configure_prach_params()
log.debug("%s not implemented.\n", __FUNCTION__); log.debug("%s not implemented.\n", __FUNCTION__);
}; };
void lte_ttcn3_phy::prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) void lte_ttcn3_phy::prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec)
{ {
log.info("Sending PRACH with preamble %d on PCID=%d\n", preamble_idx, pcell.info.id); log.info("Sending PRACH with preamble %d on PCID=%d\n", preamble_idx, pcell.info.id);
prach_tti_tx = current_tti; prach_tti_tx = current_tti;

Loading…
Cancel
Save