Skip to content

NRF52 interrupts already activated by fall/rise call #8188

@ChiSaw

Description

@ChiSaw

Description of defect

In InterruptIn::fall(..) and InterruptIn::rise(..) calling gpio_irq_set in target https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NORDIC/TARGET_NRF5x/gpio_api.c#L221 , the interrupts get activated per default. This results in direct ISR calls on hardware if the interrupt input pin is floating during boot up for example. Per default interrupts shouldn't be activated after hooking up an ISR with fall or rise, right? Only after explicitly calling InterruptIn::enable_irq().

Target(s) affected by this defect ?

NRF52832

Toolchain(s) (name and version) displaying this defect ?

  • (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 7.12.1.20170417-git

What version of Mbed-os are you using (tag or sha) ?

mbed-os-5.9.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-cli 1.8.1

How is this defect reproduced ?

  • empty mbed project

  • main.cpp

     #include "mbed.h"
    
    volatile uint8_t count = 0;
    void handler() {
        count++;
    }
    
     void main() {
         InterruptIn interrupt(p0);
         interrupt.fall(callback(&handler));
         while(1);
     }
    

and then toggling p0 on hw e.g. calls handler() for me

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions