mirror of https://github.com/ARMmbed/mbed-os.git
Making recv timing error and preamble length configurable
We had a bug especially in the reception path. Our recv window opening delays were being calculated on the premise that the radio has to capture 5 preamble symbols out of 8 transmitted by the base station. However, in PHY layer while setting radio rc settings, we were setting preamble length to be 8. Preamble length register needs to be configured differently for Uplink and Downlink. For uplink, we wish to transmit 8 preamble symbols whereas in the reception path we need to receive 5 preamble symbols at least out of 8. Alongwith that the maximum range of timing error may vary from platform to platform as it is based upon the crystal in the chip. We have now made these parameters configurable and have loaded them with the most optimal defaults.pull/7601/head
parent
24c5c58d4f
commit
d76f6c07e9
|
@ -1080,13 +1080,13 @@ lorawan_status_t LoRaMac::schedule_tx()
|
|||
uint8_t dr_offset = _lora_phy->apply_DR_offset(_params.sys_params.channel_data_rate,
|
||||
_params.sys_params.rx1_dr_offset);
|
||||
|
||||
_lora_phy->compute_rx_win_params(dr_offset, _params.sys_params.min_rx_symb,
|
||||
_params.sys_params.max_sys_rx_error,
|
||||
_lora_phy->compute_rx_win_params(dr_offset, MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
|
||||
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
|
||||
&_params.rx_window1_config);
|
||||
|
||||
_lora_phy->compute_rx_win_params(_params.sys_params.rx2_channel.datarate,
|
||||
_params.sys_params.min_rx_symb,
|
||||
_params.sys_params.max_sys_rx_error,
|
||||
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
|
||||
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
|
||||
&_params.rx_window2_config);
|
||||
|
||||
if (!_is_nwk_joined) {
|
||||
|
@ -1355,8 +1355,8 @@ void LoRaMac::set_device_class(const device_class_t &device_class,
|
|||
_params.is_node_ack_requested = false;
|
||||
_lora_phy->put_radio_to_sleep();
|
||||
_lora_phy->compute_rx_win_params(_params.sys_params.rx2_channel.datarate,
|
||||
_params.sys_params.min_rx_symb,
|
||||
_params.sys_params.max_sys_rx_error,
|
||||
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
|
||||
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
|
||||
&_params.rx_window2_config);
|
||||
}
|
||||
|
||||
|
@ -1732,9 +1732,6 @@ lorawan_status_t LoRaMac::initialize(EventQueue *queue)
|
|||
_params.timers.aggregated_timeoff = 0;
|
||||
|
||||
_lora_phy->reset_to_default_values(&_params, true);
|
||||
|
||||
_params.sys_params.max_sys_rx_error = 10;
|
||||
_params.sys_params.min_rx_symb = 6;
|
||||
_params.sys_params.retry_num = 1;
|
||||
|
||||
reset_mac_parameters();
|
||||
|
|
|
@ -853,7 +853,8 @@ bool LoRaPHY::rx_config(rx_config_params_t *rx_conf)
|
|||
false, rx_conf->is_rx_continuous);
|
||||
} else {
|
||||
modem = MODEM_LORA;
|
||||
_radio->set_rx_config(modem, rx_conf->bandwidth, phy_dr, 1, 0, 8,
|
||||
_radio->set_rx_config(modem, rx_conf->bandwidth, phy_dr, 1, 0,
|
||||
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
|
||||
rx_conf->window_timeout, false, 0, false, 0, 0,
|
||||
true, rx_conf->is_rx_continuous);
|
||||
}
|
||||
|
@ -903,7 +904,8 @@ bool LoRaPHY::tx_config(tx_config_params_t *tx_conf, int8_t *tx_power,
|
|||
3000);
|
||||
} else {
|
||||
modem = MODEM_LORA;
|
||||
_radio->set_tx_config(modem, phy_tx_power, 0, bandwidth, phy_dr, 1, 8,
|
||||
_radio->set_tx_config(modem, phy_tx_power, 0, bandwidth, phy_dr, 1,
|
||||
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH,
|
||||
false, true, 0, 0, false, 3000);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,18 @@
|
|||
"automatic-uplink-message": {
|
||||
"help": "Stack will automatically send an uplink message when lora server requires immediate response",
|
||||
"value": true
|
||||
},
|
||||
"max-sys-rx-error": {
|
||||
"help": "Maximum timing error of the receiver in ms. The receiver will turn on in [-RxError : + RxError]",
|
||||
"value": 10
|
||||
},
|
||||
"downlink-preamble-length": {
|
||||
"help": "Number of preamble symbols need to be captured (out of 8) for successful demodulation",
|
||||
"value": 5
|
||||
},
|
||||
"uplink-preamble-length": {
|
||||
"help": "Number of preamble symbols to transmit. Must be <= 8",
|
||||
"value": 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,17 +166,6 @@ typedef struct {
|
|||
* The data rate in channels.
|
||||
*/
|
||||
int8_t channel_data_rate;
|
||||
/*!
|
||||
* The system overall timing error in milliseconds.
|
||||
* [-SystemMaxRxError : +SystemMaxRxError]
|
||||
* Default: +/-10 ms
|
||||
*/
|
||||
uint32_t max_sys_rx_error;
|
||||
/*!
|
||||
* The minimum number of symbols required to detect an RX frame.
|
||||
* Default: 6 symbols
|
||||
*/
|
||||
uint8_t min_rx_symb;
|
||||
/*!
|
||||
* LoRaMac maximum time a reception window stays open.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue