-
-
Notifications
You must be signed in to change notification settings - Fork 793
Add STM32WLE5xx Support #4695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tyler-potyondy
wants to merge
16
commits into
tock:master
Choose a base branch
from
jlab-sensing:upstream_staging/stm32wle5xx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add STM32WLE5xx Support #4695
tyler-potyondy
wants to merge
16
commits into
tock:master
from
jlab-sensing:upstream_staging/stm32wle5xx
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit provides an initial minimal stm32wle5xx chip implementation consisting of support for the: - gpio peripheral - clocks - rcc peripheral
This is a minimal implementation for the pwr peripheral that only implements a subset of the peripheral.
This provides a "virtual gpio" interface to the subghz radio. LoRa libraries (e.g. RadioLib) expect gpio pins for the SX1262 radio. The stm32wle5xx implements this differently as an integrated radio on the SoC. Because of this, there aren't gpios for the interrupt / busy lines. This driver wraps the sources for determining if there are interrupts or if the peripheral is busy and exposes them as a gpio (so they can be exposed to userspace).
This adds the subghzspi peripheral and wrapper for virtual gpios to the subghz interrupt / busy signals to the stm32wle5xx chip definition. Because the subghzradio interrupts are level triggered and can only be cleared by initiating spi commands, we mask the subghz radio interrupts when determining if the chip has pending interrupts and when finding the next pending interrupt.
Update gpio to use exti for gpio interrupts. Requires implementing syscfg. Also add gpioc and gpioh.
Driver to get factory provided device uid.
There exists a component for the MasterSlave Driver, but not for the MasterDriver. This adds the MasterDriver component.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Overview
This pull request adds support for the STM32WLE5xx family of chips. Specifically, this adds support for the Seeed Studio LoRa e5 Mini, a development board that uses the STM32WLE5JC. The STM32WLE5xx family of chips is a low power SoC that has an integrated SX126X LoRa radio.
A few Important Notes for Reviewing the PR
SubGhz LoRa Radio Interrupts
The architecture of the stm32wle5xx is somewhat unique as the SubGhz LoRa radio is located on the SoC and the cortex-m4 processor communicates with the radio using an internal SPI bus. SX126X radios (the type of the internal LoRa radio) typically expose an interrupt pin, reset pin, busy pin, and SPI pins. For the stm32wle5xx this is all internally mapped to various registers, NVICs, and EXTI.
This is all important and relevant for how we handle interrupts from the radio. When the radio triggers an interrupt, this results in an NVIC (that is level triggered). This interrupt will remain asserted until the processor sends a SPI command to the radio clearing the radio's internal interrupt.
For our implementation, we use
libtock-csupport for LoRa and LoRaWAN using RadioLib. To use this, we expose the needed GPIOs/SPI bus to userspace and allowlibtock-cto form the needed SPI commands. This creates an issue for the level triggered SubGhz Radio interrupt---the kernel will never exit the service interrupt loop and blocks initiating an upcall to the application/allowing the application to run. Without the application running, the SPI command is not generated/sent to the radio and the radio's interrupt is never cleared.To fix this, we use interrupt masks when checking for interrupts and manually check if the SubGhz radio interrupt is set after handling all other pending interrupts. This has worked well so far and has not caused issues when testing LoRa/LoRaWAN. I'm open to suggestions if others can think of a more elegant way to implement this.
SubGhz Driver - "Virtual/Logical" GPIOs
As mentioned above,
libtock-chas support for LoRa and LoRaWAN using RadioLib. RadioLib expects the radio's interrupt, busy, and data pins to be exposed as GPIOs. This creates issues for the stm32wle5xx as the internal radio maps these behaviors to registers. This issue was thoroughly discussed in RadioLib's bare metal port of the stm32wle5xx here. The solution they use (and what I'm emulating in the Tock port) are "virtual gpios". Thechips/stm32wle5xx/src/subghz_radio.rscreates an object that wraps the underlying registers and implements the gpio HIL so that this can be exposed to user space through the standard gpio capsule.Similarity to STM32f3
There is a high degree of carry over/copying from the STM32f3 chip drivers. This issue was brought up in #4672. It seems some of these drivers can be refactored to a shared directory. This seems like something that should be further discussed once this is merged as this is a larger issue to the STM32 chips in general.
Other Notes / Context
This PR is part of a larger effort to port the Environmental NeTworked Sensing (ENTS) platform to use Tock. ENTS, as the name implies, is a general purpose sensing platform that is already used by environmental scientist at universities across the US. It is in many ways similar to Tock's original roots in the SignPost platform. All this is to say, there will be more contributions coming from and built upon this PR!
Testing Strategy
This pull request was tested by running:
TODO or Help Wanted
Documentation Updated
/docs, or no updates are required.Formatting
make prepush.