Skip to content

Commit 0d74e86

Browse files
committed
drivers: lorawan: Add ability to force enable LDRO
Allows Enabling LDRO all the time via DTS Signed-off-by: Camille BAUD <mail@massdriver.space>
1 parent df7159f commit 0d74e86

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

drivers/lora/lora_basics_modem/lbm_common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ int lbm_lora_config(const struct device *dev, struct lora_modem_config *lora_con
7878
.mod_params = {
7979
.sf = lora_config->datarate,
8080
.cr = lora_config->coding_rate,
81-
.ldro = LORA_LDRO(lora_config->datarate, lora_config->bandwidth),
81+
.ldro = LORA_LDRO(lora_config->datarate, lora_config->bandwidth)
82+
| config->force_ldro,
8283
},
8384
.pkt_params = {
8485
.preamble_len_in_symb = lora_config->preamble_len,

drivers/lora/lora_basics_modem/lbm_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ enum lbm_modem_mode {
3434
struct lbm_lora_config_common {
3535
/* LBM radio abstration layer structure */
3636
ralf_t ralf;
37+
bool force_ldro;
3738
};
3839

3940
/* Common LBM modem data, must be first element of device data */

drivers/lora/lora_basics_modem/lbm_sx126x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ static int sx126x_init(const struct device *dev)
501501
#define SX126X_DEFINE(node_id, sx_variant) \
502502
static const struct lbm_sx126x_config config_##node_id = { \
503503
.lbm_common.ralf = RALF_SX126X_INSTANTIATE(DEVICE_DT_GET(node_id)), \
504+
.lbm_common.force_ldro = DT_PROP(node_id, force_ldro), \
504505
.spi = SPI_DT_SPEC_GET( \
505506
node_id, SPI_WORD_SET(8) | SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB), \
506507
.reset = GPIO_DT_SPEC_GET(node_id, reset_gpios), \

drivers/lora/lora_basics_modem/lbm_sx127x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ static int sx127x_driver_init(const struct device *dev)
441441
static struct lbm_sx127x_data data_##node_id; \
442442
static const struct lbm_sx127x_config config_##node_id = { \
443443
.lbm_common.ralf = RALF_SX127X_INSTANTIATE(&data_##node_id.radio), \
444+
.lbm_common.force_ldro = DT_PROP(node_id, force_ldro), \
444445
.spi = SPI_DT_SPEC_GET( \
445446
node_id, SPI_WORD_SET(8) | SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB), \
446447
.reset = GPIO_DT_SPEC_GET(node_id, reset_gpios), \

dts/bindings/lora/semtech,sx126x-base.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,9 @@ properties:
7070
type: boolean
7171
description: |
7272
Use the internal LDO instead of the internal DCDC. Increases power consumption.
73+
74+
force-ldro:
75+
type: boolean
76+
description: |
77+
Force usage of Low Data Rate Optimization even in cases where the symbol time is shorter than
78+
16.38ms. Useful for designs using no TCXO or with bad heat dissipation.

dts/bindings/lora/semtech,sx127x-base.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ properties:
6161
type: int
6262
description: |
6363
Delay which has to be applied after enabling TCXO power.
64+
65+
force-ldro:
66+
type: boolean
67+
description: |
68+
Force usage of Low Data Rate Optimization even in cases where the symbol time is shorter than
69+
16.38ms. Useful for designs using no TCXO or with bad heat dissipation.

0 commit comments

Comments
 (0)