arduino / arduino/ArduinoCore-sam

If interrupt attached to 2 or more pins of a port, detachInterrupt() doesn't work correctly

Open
#122 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
91
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Here's the problem code in WInterrupts.c - note PIOB/C/D handlers have the same problem:

void PIOA_Handler(void) {
uint32_t isr = PIOA->PIO_ISR; // this line should be: uint32_t isr = PIOA->PIO_ISR & PIOA->PIO_IMR;
uint8_t leading_zeros;
while((leading_zeros=__CLZ(isr))<32)
{
uint8_t pin=32-leading_zeros-1;
if(callbacksPioA[pin]) callbacksPioA[pin]();
isr=isr&(~(1<

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in WInterrupts.c with PIOA_Handler and compare the PIOB, PIOC, and PIOD handlers, which the issue says have the same problem. Check how PIO_ISR, PIO_IMR, and callbacksPioA[] are used; done means detaching one interrupt no longer invokes its callback while other attached pins on the same port continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.