Skip to content

Commit c6d09b4

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

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/lora/lora_basics_modem/lbm_common.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
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+
* Additionally, enable LDRO in additional situations described in Lora Basic Modem lr1mac
22+
* where t < 16 from ral_compute_lora_ldro: Bandwidth less than 41 Khz, and SF9 with BW 41 KHz
23+
*/
24+
#define LORA_LDRO(sf, bw) (((1 << sf) / bw >= 16 ? 1 : 0) \
25+
| (bw < BW_41_KHZ || (bw == BW_41_KHZ && sf == SF_9) ? 1 : 0))
26+
1927
/**
2028
* @brief Attempt to acquire the modem for operations
2129
*
@@ -73,7 +81,7 @@ int lbm_lora_config(const struct device *dev, struct lora_modem_config *lora_con
7381
.mod_params = {
7482
.sf = lora_config->datarate,
7583
.cr = lora_config->coding_rate,
76-
.ldro = 0,
84+
.ldro = LORA_LDRO(lora_config->datarate, lora_config->bandwidth),
7785
},
7886
.pkt_params = {
7987
.preamble_len_in_symb = lora_config->preamble_len,

0 commit comments

Comments
 (0)