arch/arm/src/samvX/sam_gpioirq.c: fix pin base address calculation#18494
Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom Mar 5, 2026
Merged
arch/arm/src/samvX/sam_gpioirq.c: fix pin base address calculation#18494xiaoxiang781216 merged 1 commit intoapache:masterfrom
xiaoxiang781216 merged 1 commit intoapache:masterfrom
Conversation
GPIO PIN base address calculation had double right shift, thus call to SAM_PION_BASE was always with port = 0 instead of correct port number. As a result, function sam_gpioirq didn't correctly configure additional interrupt modes (only rising or falling edge and level interrupts). The issue occured on SAMv7 and SAM34 platforms (likely copy-pasted from one to another). Signed-off-by: Michal Lenc <michallenc@seznam.cz>
linguini1
approved these changes
Mar 4, 2026
xiaoxiang781216
approved these changes
Mar 5, 2026
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.
Summary
GPIO PIN base address calculation had double right shift, thus call to
SAM_PION_BASEwas always withport = 0instead of correct port number. As a result, functionsam_gpioirqdidn't correctly configure additional interrupt modes (only rising or falling edge and level interrupts).The issue occured on SAMv7 and SAM34 platforms (likely copy-pasted from one to another).
Impact
Allows to use additional interrupts (falling/rising edge, level) on GPIO pins.
Testing
Tested on custom SAMv7 board. I noticed the issue while debugging a custom button on pin PD24 configured as
The application received the interrupt on both press and release events before the fix, now it correctly reacts only to falling edge.