Skip to content

Commit df7159f

Browse files
committed
drivers: lorawan: Enable LDRO when symbol time > 16.38ms
Enable LDRO when it should be enabled Signed-off-by: Camille BAUD <mail@massdriver.space>
1 parent 02453fa commit df7159f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/lora/lora_basics_modem/lbm_common.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
LOG_MODULE_REGISTER(lbm_driver, CONFIG_LORA_LOG_LEVEL);
1818

19+
/* When Symbol Time exceeds 16.38 ms (6.1.1.4 SX1261/2 datasheet), enable LDRO
20+
* Symbol Rate is bw / (2 ^ sf) so Symbol time is (2 ^ sf) / bw (6.1.1.1 SX1261/2 datasheet)
21+
*/
22+
#define LORA_LDRO(sf, bw) (1 << sf) / bw >= 16 ? 1 : 0
23+
1924
/**
2025
* @brief Attempt to acquire the modem for operations
2126
*
@@ -73,7 +78,7 @@ int lbm_lora_config(const struct device *dev, struct lora_modem_config *lora_con
7378
.mod_params = {
7479
.sf = lora_config->datarate,
7580
.cr = lora_config->coding_rate,
76-
.ldro = 0,
81+
.ldro = LORA_LDRO(lora_config->datarate, lora_config->bandwidth),
7782
},
7883
.pkt_params = {
7984
.preamble_len_in_symb = lora_config->preamble_len,

0 commit comments

Comments
 (0)