Skip to content
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

Interrupt callback function is instantly called on samd51 after setting it from within interrupt callback function #19861

Open
HendrikVE opened this issue Aug 7, 2023 · 1 comment
Assignees
Labels
Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@HendrikVE
Copy link
Contributor

Description

I'm setting a new interrupt callback function for a GPIO pin from within the previous callback function for the same GPIO pin.

Steps to reproduce the issue

static void _interrupt_on_gpio_cb_2(void *arg)
{
    // do something different
}

static void _interrupt_on_gpio_cb(void *arg)
{
    (void) arg;

    // do something

    // gpio_irq_disable(MY_GPIO_PIN);
    gpio_init_int(MY_GPIO_PIN, GPIO_IN_PD, GPIO_RISING, _interrupt_on_gpio_cb_2, NULL);
    // gpio_irq_enable(MY_GPIO_PIN);
}

int main(void)
{
    gpio_init(MY_GPIO_PIN, GPIO_IN);
    gpio_init_int(MY_GPIO_PIN, GPIO_IN_PD, GPIO_RISING, _interrupt_on_gpio_cb, NULL);
}

Expected results

I would expect nothing to happen except that the next time an interrupt is triggered the new callback function will be called.

Actual results

Unless disabling interrupts for this pin while setting the new callback, the new handler will be called instantly on samd51, but not on saml21.

Versions

Based on RIOT 2023.04

@HendrikVE HendrikVE added Area: cpu Area: CPU/MCU ports Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Aug 7, 2023
@benpicco
Copy link
Contributor

Might be worth getting back to #12082 or #13925, but only with a single function this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

No branches or pull requests

4 participants