Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

GPIO interrupt is not working as expected. #16

@m1el

Description

@m1el

I have tried to set up a GPIO interrupt handler the following way:

#[interrupt(gpio)]
fn gpio_intr() {
  // do something
}
#[entry]
fn main() -> ! {
   enable_interrupt(InterruptType::GPIO);
   // ...
}

Full code here: https://gist.github.com/m1el/41b2c1c210d92b45ff015483c9dd59d8
However, the chip hangs immediately upon receiving an interrupt.
With some help and reading the manuals, it was discovered that the interrupt routine is getting repeatedly called.
This happens because GPIO interrupt status is not getting cleared.
After adding (*target::GPIO::ptr()).gpio_status_w1tc.write(|w| w.bits(0xffff)) to the interrupt handler, the code works as expected.

Since interrupt_trampoline clears interrupt status with xtensa_lx::interrupt::clear(mask), one would expect it to clear GPIO interrupt status as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions