Skip to content

Add STM32WL Support to SX126x Radio Driver#1619

Open
spike314 wants to merge 5 commits into
mysensors:developmentfrom
spike314:development
Open

Add STM32WL Support to SX126x Radio Driver#1619
spike314 wants to merge 5 commits into
mysensors:developmentfrom
spike314:development

Conversation

@spike314

@spike314 spike314 commented May 11, 2026

Copy link
Copy Markdown
Contributor

This PR changes the MySensors SX126x radio driver to allow use by STM32WL processors.

The STM32 series processors combine an STM32 processor and SX126x radio on the same chip. The MySensors SX126x driver needs to be updated to work with the on-chip radio in the STM32WL processors. The PR addresses 3 main differences between the SX126x radios and the internal radios in the STM32WL processors.

  • For transmitting, the SX1261 radio has only a low power amplifier and the SX1262 radio has only a high power amplifier. Depending on the processor, STM32WL chips can support either low power, high power, or both amplifiers. The PR adds code to handle Power Amplifier selection based on chip capability and desired power setting.

  • Since the STM32WL processors combine the processor and radio on chip, they do not expose the normal SPI pins used by Arduino SPI libraries. The PR adds code to use the STM32 HAL SUBGHZSPI functions to handle low level SPI calls when the STM32WL is used.

  • STM32WL modules require extra pins for control of the RF front end. This PR adds an option to use MY_SX126x_RF_SWITCH_PIN and MY_SX126x_RF_ENABLE_PIN in addition to the MY_SX126x_ANT_SWITCH_PIN already provided in the SX126x driver. In the MySensors examples folder, the PR adds STM32WLConfiguration examples for the WIO-E5, WIO-E5-LE, and STM32WL55-Nucleo modules that show the correct defines needed for the pins in these modules.

Addresses issue #1620

I tested these changes on STM32WLE5 (WIO-E5 and WIO-E5-LE modules)

spike314 added 4 commits May 4, 2026 16:07
- Load SUBGHZSPI of STM32WL used
- Use STM32 HAL for CS
- Add support for both High and Low Power PA
- Add RF control and enable pins
- Move pin setting to rx, tx, and standby functions
- Adapt PA clamping for switching betweeh HP and LP PA
- Add generic encryption for SX16x
- Add configuration examples
- Align defines with MyConfig.h
- Rewrite sendRegister() for portability
- Make SX126x capitalization consistent
- Make const bool variables in header static
- Fix typos from compile checks
- Format Configuration examplea as md
@spike314
spike314 marked this pull request as ready for review May 11, 2026 03:33
@tekka007 tekka007 added this to the 2.4.0 milestone May 12, 2026
@tekka007 tekka007 added the STM32 label May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants