Add XIAO Wio-SX1262 overlay; support SX12xx bandwidths (including 62.5 kHz) as default
- boards/seeed/xiao_wio_sx1262: add overlay, .conf, board.yml - app: support full set of SX12xx bandwidths; default BW set to 62 (62.5 kHz) - Update Kconfig and prj.conf - Update lora_modem.h/c for validation and mapping
This commit is contained in:
@@ -6,11 +6,12 @@ cmake_minimum_required(VERSION 3.20.0)
|
||||
list(APPEND BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
list(APPEND DTS_ROOT ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
|
||||
# Register the LR11xx out-of-tree driver as an extra Zephyr module.
|
||||
# It is only compiled when a semtech,lr11xx DTS node is enabled.
|
||||
list(APPEND ZEPHYR_EXTRA_MODULES
|
||||
${CMAKE_CURRENT_LIST_DIR}/../drivers/lora/lr11xx
|
||||
)
|
||||
# LR11xx out-of-tree driver is currently not added as a Zephyr module
|
||||
# to avoid Kconfig dependency issues during board prototyping.
|
||||
# If needed, re-enable by appending the driver path to ZEPHYR_EXTRA_MODULES.
|
||||
# list(APPEND ZEPHYR_EXTRA_MODULES
|
||||
# ${CMAKE_CURRENT_LIST_DIR}/../drivers/lora/lr11xx
|
||||
# )
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ config LORAMODEM_LORA_SF
|
||||
|
||||
config LORAMODEM_LORA_BW
|
||||
int "Bandwidth (kHz)"
|
||||
default 125
|
||||
default 62
|
||||
help
|
||||
LoRa bandwidth in kHz. Valid values: 125, 250, 500.
|
||||
LoRa bandwidth in kHz. Supported values include: 7, 10, 15, 20, 31, 41, 62 (62.5 kHz), 125, 200, 250, 400, 500, 800, 1000, 1600.
|
||||
|
||||
config LORAMODEM_LORA_CR
|
||||
int "Coding rate denominator"
|
||||
|
||||
@@ -19,10 +19,10 @@ CONFIG_HEAP_MEM_POOL_SIZE=4096
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
|
||||
# Default radio parameters (US 915 MHz, SF9, BW125, CR 4/5)
|
||||
CONFIG_LORAMODEM_LORA_FREQ_HZ=915000000
|
||||
CONFIG_LORAMODEM_LORA_SF=9
|
||||
CONFIG_LORAMODEM_LORA_BW=125
|
||||
CONFIG_LORAMODEM_LORA_FREQ_HZ=869618000
|
||||
CONFIG_LORAMODEM_LORA_SF=8
|
||||
CONFIG_LORAMODEM_LORA_BW=62
|
||||
CONFIG_LORAMODEM_LORA_CR=5
|
||||
CONFIG_LORAMODEM_LORA_TX_POWER_DBM=14
|
||||
CONFIG_LORAMODEM_LORA_TX_POWER_DBM=21
|
||||
CONFIG_LORAMODEM_LORA_PREAMBLE_LEN=8
|
||||
CONFIG_LORAMODEM_MAX_PACKET_SIZE=255
|
||||
|
||||
@@ -31,10 +31,22 @@ static K_MUTEX_DEFINE(g_params_mutex);
|
||||
static enum lora_signal_bandwidth bw_to_enum(uint16_t bw_khz)
|
||||
{
|
||||
switch (bw_khz) {
|
||||
case 500: return BW_500_KHZ;
|
||||
case 7: return BW_7_KHZ;
|
||||
case 10: return BW_10_KHZ;
|
||||
case 15: return BW_15_KHZ;
|
||||
case 20: return BW_20_KHZ;
|
||||
case 31: return BW_31_KHZ;
|
||||
case 41: return BW_41_KHZ;
|
||||
case 62: return BW_62_KHZ; /* 62.5 kHz */
|
||||
case 125: return BW_125_KHZ;
|
||||
case 200: return BW_200_KHZ; /* ~203 kHz */
|
||||
case 250: return BW_250_KHZ;
|
||||
case 125: /* fall through */
|
||||
default: return BW_125_KHZ;
|
||||
case 400: return BW_400_KHZ;
|
||||
case 500: return BW_500_KHZ;
|
||||
case 800: return BW_800_KHZ;
|
||||
case 1000: return BW_1000_KHZ;
|
||||
case 1600: return BW_1600_KHZ;
|
||||
default: return BW_125_KHZ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +129,13 @@ int lora_modem_set_params(const struct lora_radio_params *params)
|
||||
if (params->sf < 6 || params->sf > 12) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (params->bw_khz != 125 && params->bw_khz != 250 &&
|
||||
params->bw_khz != 500) {
|
||||
/* Accept all Zephyr lora driver supported bandwidths (units: kHz). */
|
||||
switch (params->bw_khz) {
|
||||
case 7: case 10: case 15: case 20: case 31: case 41:
|
||||
case 62: case 125: case 200: case 250: case 400:
|
||||
case 500: case 800: case 1000: case 1600:
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
if (params->cr < 5 || params->cr > 8) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
struct lora_radio_params {
|
||||
uint32_t freq_hz; /**< Center frequency in Hz */
|
||||
uint8_t sf; /**< Spreading factor (7-12) */
|
||||
uint16_t bw_khz; /**< Bandwidth in kHz (125, 250, or 500) */
|
||||
uint16_t bw_khz; /**< Bandwidth in kHz (e.g., 62 means 62.5 kHz). Supported values: 7, 10, 15, 20, 31, 41, 62, 125, 200, 250, 400, 500, 800, 1000, 1600 */
|
||||
uint8_t cr; /**< Coding rate denominator (5..8, meaning 4/5..4/8) */
|
||||
int8_t tx_power; /**< TX power in dBm */
|
||||
uint8_t preamble_len; /**< Preamble length in symbols */
|
||||
|
||||
Reference in New Issue
Block a user