aboutsummaryrefslogtreecommitdiff
path: root/embassy-lora/src
diff options
context:
space:
mode:
authorSamuel Tardieu <[email protected]>2023-01-27 15:36:26 +0100
committerSamuel Tardieu <[email protected]>2023-01-27 16:01:41 +0100
commite453334870575dd0d18f65dcd207bfbff6e88990 (patch)
tree12d80922d03f56c04d7a0bdf9943880de3b16fbd /embassy-lora/src
parentffa75e1e39949807317ee75459ae9d18b5376578 (diff)
LoRa/SX1276: adjust Rx window offset and duration
After a transmission, two receive windows Rx1 and Rx2 are opened for one second each, one right after the other, after a fixed delay (for example 5s). The Rx window offset is added to the starting date of each window and the Rx window duration represents the maximum delay we will wait for an incoming message before declaring that a timeout occurred. A value of -500ms for the offset and 800ms for the duration means that instead of having Rx1 = [5000, 6000[ and Rx2 = [6000, 7000[ we get Rx1 = [4500, 5300[ and Rx2 = [5500, 6300[. We only cover 30% of the expected windows. The maximum time a SX127x can take before the Rx side is ready is TS_HOP + TS_RE = 50µs + 2.33ms. Using 3ms for the offset and 1003ms for the duration will give much better time windows: Rx1 = [4997, 5997[ and Rx2 = [5997, 7000]. Note that the lorawan-device crate caps Rx1 end date to Rx2 start date. This change allows a previously failing Murata CMWX1ZZABZ-091 module (STM32L + SX1276) to connect to the TTN LoRa network.
Diffstat (limited to 'embassy-lora/src')
-rw-r--r--embassy-lora/src/sx127x/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/embassy-lora/src/sx127x/mod.rs b/embassy-lora/src/sx127x/mod.rs
index f47a9eb55..8904c9a13 100644
--- a/embassy-lora/src/sx127x/mod.rs
+++ b/embassy-lora/src/sx127x/mod.rs
@@ -70,10 +70,10 @@ where
70 RFS: RadioSwitch + 'static, 70 RFS: RadioSwitch + 'static,
71{ 71{
72 fn get_rx_window_offset_ms(&self) -> i32 { 72 fn get_rx_window_offset_ms(&self) -> i32 {
73 -500 73 -3
74 } 74 }
75 fn get_rx_window_duration_ms(&self) -> u32 { 75 fn get_rx_window_duration_ms(&self) -> u32 {
76 800 76 1003
77 } 77 }
78} 78}
79 79