Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 72 additions & 3 deletions MyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@
* The following chips are supported by this driver:
* - Semtech sx1261
* - Semtech sx1262
* - STM32WL series
* @{
*/

Expand Down Expand Up @@ -1248,11 +1249,12 @@

/**
* @def MY_SX126x_VARIANT
* @brief details if it's a sx1261 or sx1262
* @brief details if it's a sx1261, sx1262, or STM32WL
*
* - 1: sx1261
* - 2: sx1262
* If not set, sx1262 is selected
* - 3: STM32WL
* If not set, sx1261 is selected
*/
#if !defined(MY_SX126x_VARIANT)
#define MY_SX126x_VARIANT (1)
Expand Down Expand Up @@ -1308,6 +1310,70 @@
#define MY_SX126x_MIN_POWER_LEVEL_DBM (-3)
#endif

/**
* @def MY_SX126x_ENABLE_ENCRYPTION
* @brief Define this to enable software based %AES encryption.
*
* All nodes and gateway must have this enabled, and all must be personalized with the same %AES
* key.
* @see @ref personalization
*
* @warning This driver always sets the initialization vector to 0 so encryption is weak.
*/
//#define MY_SX126x_ENABLE_ENCRYPTION

/* Additional Configuration for STM32WL Processors */

/**
* @def MY_SX126x_RF_ENABLE_PIN
* @brief Additional Pin to enable antenna circuit
*
* Some modules have an additional RF enable pin (E.G. NUCLEO-WL55JC FE_CTRL3) .
* Use this to define the enable pin.
*/
//#define MY_SX126x_RF_ENABLE_PIN (PC3)

/**
* @def MY_SX126x_RF_SWITCH_PIN
* @brief Additional Pin to switch antenna circuit between RX and TX, and Idle mode
*
* Some modules have additional RF switch pins. Use this to define and additional pin.
* Define behavior in different modes using MY_SX126x_RF_SWITCH_IDLE, TX, and RX
*/
//#define MY_SX126x_RF_SWITCH_PIN (PC4)

/**
* @def MY_SX126x_RF_SWITCH_IDLE
* @brief Idle State of additional RF switch pin
*
* @ref MY_SX126x_RF_SWITCH_PIN
*/
//#define MY_SX126x_RF_SWITCH_IDLE LOW

/**
* @def MY_SX126x_RF_SWITCH_LPTX
* @brief TX State of additional RF switch pin
*
* @ref MY_SX126x_RF_SWITCH_PIN
*/
//#define MY_SX126x_RF_SWITCH_LPTX LOW

/**
* @def MY_SX126x_RF_SWITCH_HPTX
* @brief TX State of additional RF switch pin
*
* @ref MY_SX126x_RF_SWITCH_PIN
*/
//#define MY_SX126x_RF_SWITCH_HPTX HIGH

/**
* @def MY_SX126x_RF_SWITCH_RX
* @brief RX State of additional RF switch pin
*
* @ref MY_SX126x_RF_SWITCH_PIN
*/
//#define MY_SX126x_RF_SWITCH_RX LOW

/** @}*/ // End of SX126xSettingGrpPub group

/**
Expand Down Expand Up @@ -2536,6 +2602,9 @@
#ifndef MY_RFM95_ENABLE_ENCRYPTION
#define MY_RFM95_ENABLE_ENCRYPTION
#endif
#ifndef MY_SX126x_ENABLE_ENCRYPTION
#define MY_SX126x_ENABLE_ENCRYPTION
#endif
#endif

/**
Expand All @@ -2544,7 +2613,7 @@
* @brief Helper flag to indicate that some encryption feature is enabled, set automatically
* @see MY_RF24_ENABLE_ENCRYPTION, MY_RFM69_ENABLE_ENCRYPTION, MY_NRF5_ESB_ENABLE_ENCRYPTION, MY_RFM95_ENABLE_ENCRYPTION
*/
#if defined(MY_RF24_ENABLE_ENCRYPTION) || defined(MY_RFM69_ENABLE_ENCRYPTION) || defined(MY_NRF5_ESB_ENABLE_ENCRYPTION) || defined(MY_RFM95_ENABLE_ENCRYPTION)
#if defined(MY_RF24_ENABLE_ENCRYPTION) || defined(MY_RFM69_ENABLE_ENCRYPTION) || defined(MY_NRF5_ESB_ENABLE_ENCRYPTION) || defined(MY_RFM95_ENABLE_ENCRYPTION) || defined(MY_SX126x_ENABLE_ENCRYPTION)
#define MY_ENCRYPTION_FEATURE
#endif
/** @}*/ // End of EncryptionSettingGrpPub group
Expand Down
76 changes: 76 additions & 0 deletions examples/STM32WLConfiguration/STM32WLConfiguration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
**DESCRIPTION**

This Document provides examples of defines needed to configure common STM32WL modules.
STM32WL series processors use SX126x radios internally, but are more complicated to
configure because they can use either or both of the High Power Amplifier and the Low Power Amplifier. In addition, they need additional pins to configure the RF output of the module.

For the modules below, update the module specific defines in MyConfig.h to match the defines listed in the code block for the module. You can also paste the code block into your sketch before including MySensors.h.
Min and Max power levels are the listed as the capability of the radio. Adjust to your desired settings.
Network related defines ( frequency, bandwidth, etc) are not included, but still need to be addressed either in MyConfig.h or in the sketch.


---

SEEED WIO-E5

- This module has only the High Power Amplifier
- It uses the additional RF switch pin, but does not use the enable pin
- It supports 868 or 915 MHz

```
#define MY_SX126x_TCXO_VOLTAGE (SX126x_TCXO_1V7)
#define MY_SX126x_ANT_SWITCH_PIN (PA5)
#define MY_SX126x_RF_SWITCH_PIN (PA4)
#define MY_SX126x_VARIANT (3)
#define MY_SX126x_MAX_POWER_LEVEL_DBM (22) // Max chip capability. Check local regulations
#define MY_SX126x_MIN_POWER_LEVEL_DBM (-9)
#define MY_SX126x_RF_SWITCH_IDLE LOW
#define MY_SX126x_RF_SWITCH_RX HIGH
#define MY_SX126x_RF_SWITCH_HPTX LOW

```

---

SEEED WIO-E5-LE

- This module has only the Low Power Amplifier
- It uses the additional RF switch pin, but does not use the enable pin
- It only supports 868 or 915 MHz
- The lower power consumption of this module makes it a good candidate for battery powered nodes

```
#define MY_SX126x_TCXO_VOLTAGE (SX126x_TCXO_1V7)
#define MY_SX126x_ANT_SWITCH_PIN (PA5)
#define MY_SX126x_RF_SWITCH_PIN (PA4)
#define MY_SX126x_VARIANT (3)
#define MY_SX126x_MAX_POWER_LEVEL_DBM (14)
#define MY_SX126x_MIN_POWER_LEVEL_DBM (-17)
#define MY_SX126x_RF_SWITCH_IDLE LOW
#define MY_SX126x_RF_SWITCH_RX HIGH
#define MY_SX126x_RF_SWITCH_LPTX HIGH
```

---

STM NUCLEO-WL55JC

- This is the original dev board for the STM32WL55
- This module has both the Low Power Amplifier and the High Power Amplifier
- It uses the additional RF switch pin and the RF enable pin
- NUCLEO-WL55JC1 supports high-frequency band
- NUCLEO-WL55JC2 supports low-frequency band

```
#define MY_SX126x_TCXO_VOLTAGE (SX126x_TCXO_1V7)
#define MY_SX126x_ANT_SWITCH_PIN (PC5) // FE_CTRL2 on schematic
#define MY_SX126x_RF_SWITCH_PIN (PC4) // FE_CTRL1 on schematic
#define MY_SX126x_RF_ENABLE_PIN (PC3) // FE_CTRL3 on schematic
#define MY_SX126x_VARIANT (3)
#define MY_SX126x_MAX_POWER_LEVEL_DBM (22) // Max chip capability. Check local regulations
#define MY_SX126x_MIN_POWER_LEVEL_DBM (-17)
#define MY_SX126x_RF_SWITCH_IDLE LOW
#define MY_SX126x_RF_SWITCH_RX HIGH
#define MY_SX126x_RF_SWITCH_LPTX HIGH
#define MY_SX126x_RF_SWITCH_HPTX LOW
```
4 changes: 2 additions & 2 deletions hal/transport/SX126x/MyTransportSX126x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
bool transportInit(void)
{
const bool result = SX126x_initialise();
#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_SX126x_ATC_MODE_DISABLED)
SX126x_setATC(true, SX126x_TARGET_RSSI);
#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_SX126x_DISABLE_ATC)
SX126x_setATC(true, MY_SX126x_ATC_TARGET_DBM);
#endif
return result;
}
Expand Down
Loading