[#942] STM32_GPIOPort: Separate IDR and ODR state#218
Open
PhysicistJohn wants to merge 2 commits into
Open
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
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.
Related issue
Fixes renode/renode#942
Description
Separates the STM32 GPIO output latch from the electrical/input pin state.
ODR, BSRR, and BRR now update a dedicated 16-bit latch. Only output-mode pins
drive that value onto their GPIO connection, and switching a pin to output mode
applies its existing latched value. Reset clears both the pin state and the
output latch.
A second commit makes BSRR set bits take priority when the same pin is both set
and reset in one write, matching the STM32 register specification.
Regression tests cover input/ODR independence, input/alternate-function/analog
non-driving behavior, switching to output mode, BSRR, BRR, reset, and BSRR
set-over-reset priority.
Usage example
The reproduction in renode/renode#942 now reads IDR as zero after latching ODR
bit 2, while ODR reads back bit 2. Writing both BSRR halves for bit 2 leaves the
ODR bit set.
Additional information
Validated on macOS Arm64 with .NET 8:
dotnet format --verify-no-changes: passed