This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Disabling the GPIOTE interrupt using INTENCLR

Hi, I am using nrf52832 board. I was trying to disable the GPIOTE interrupt for a particular event (Event4) using INTENCLR register.  My code was NRF_GPIOTE->INTENCLR = 1 < < 4; But still the interrupt is not getting disabled. How to do the disabling actually?

Parents
  • NRF_GPIOTE->INTENCLR = NRF_GPIOTE_INT_IN4_MASK;

    That should disable the interrupt for IN[4] event.

    Not sure what your code does, there seems to be  white space between the "<". Should yield a compiler error IMHO.

  • Hi,
    Here is the section of code in which I am trying to disable the GPIOTE interrupts. This product communicates to Mobile device using BLE. Can you please go through this and suggest a solution?
    #define LOGIC_HIGH                                    1
    #define LOGIC_LOW                                     0
    enum interrupt_events_t {
        EVENT0 = 0,
        EVENT1,                                        
        EVENT2,                                        
        EVENT3,                                        
        EVENT4,                                        
        EVENT5,                                        
        EVENT6,                                        
        EVENT7                                        
    };
    void enableTrashBinInterrupt() {
        NRF_GPIOTE->INTENSET = LOGIC_HIGH << EVENT5;
    }
    void enableTrayLidInterrupt() {
        NRF_GPIOTE->INTENSET = LOGIC_HIGH << EVENT4;
    }
    void disableTrashBinInterrupt() {
        NRF_GPIOTE->INTENCLR = LOGIC_HIGH << EVENT5;
    }
    void disableTrayLidInterrupt() {
        NRF_GPIOTE->INTENCLR = LOGIC_HIGH << EVENT4;
    } 
    int main(void) {
       
        /* Switches, LEDs, ADC initialisations*/
        
        if (deviceStatus == TEST_PASSED) {               
            lockTrayLidAndTrashBin();
            goToHomePosition();                          
            enableTrashBinInterrupt();
            enableTrayLidInterrupt();
            if (deviceCalibrationStatus == DEVICE_CALIBRATED)                 
                disposeTip();                                                
            if (currentState != ERROR_STATE)                             
                goToLoadingPosition();                                        
        }
        unlockTrayLidAndTrashBin();
        runConfirmationBuzzer();                                              
        nrf_delay_ms(100);  
        disableTrashBinInterrupt();
        disableTrayLidInterrupt();
        err_code = advertisementInit(false);                                  // Initialize the bluetooth communication
        bootupErrorHandler(err_code);                                         
        
        if (err_code == NRF_SUCCESS) {
            err_code = startAdvertisement();                                  
            bootupErrorHandler(err_code);
        } 
       
        while(1) {
        // waiting for start command from apk
        }
    }
    Thanks
  • Hi

    What does your interrupt handler look like?

    Could you try to clear the event in the disable interrupt functions, in addition to writing to the INTENCLR register?

    Like so:

    NRF_GPIOTE->INTENCLR = LOGIC_HIGH << EVENT5;
    NRF_GPIOTE->EVENTS_IN[5] = 0;

    Best regards
    Torbjørn

  • Hi, Can you help with the same problem

    I am enabling a interrupt using this code

            nrf_drv_gpiote_in_config_t gpiote_inConfig =
            {
                .sense           = senseTrnsiton,                         \
                .pull            = GPIO_PIN_CNF_PULL_Pullup,              \
                .is_watcher      = false,                                 \
                .hi_accuracy     = true,                                  \
                .skip_gpio_setup = false,                                 \
            };
            err_code = nrf_drv_gpiote_in_init(pin_number, &gpiote_inConfig, gpiote_drvInEventhandler);
            *gpiote_appInEventHandler[pin_number] = actionEvent;
            APP_ERROR_CHECK(err_code);
            nrf_drv_gpiote_in_event_enable(pin_number, true);

    and want to disable this event inside the event handler as soon as it triggers.

    I am calling this function to disable interrupt.

    nrf_drv_gpiote_in_event_disable(pin_number);
    

    But its not working. Please help.

  • Hi 

    Did you figure this out? 

    It is not recommended to re-open old cases like this, it is better to open a new devzone ticket.

    I have been on vacation for the last couple of weeks, and didn't notice it. 

    Best regards
    Torbjørn

Reply Children
No Data
Related