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 Reply Children
  • Hi Turbo J, 

    There is no white space between "<" and I don't get any compiler error. 

  • Hi,

    Can we have a telephonic discussion regarding this issue?

    Thanks

  • Hi 

    Could you describe the issue in a bit more detail?

    Could there be any other GPIOTE events that trigger the interrupt, or are you sure it is the IN[4] event that is the cause?

    Are you able to share your code so I can have a look at it?

    Best regards
    Torbjørn

  • 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

Related