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

unable to disable a GPIOTE Event using nrf_drv_gpiote_in_event_disable

Hello:

I need to disable an interrupt event outside the handler. During debugging when the nrf_drv_gpiote_in_event_disable function gets executed, the program seems to reset. I have also tried nrf_gpio_cfg_sense_set with NRF_GPIO_PIN_NOSENSE with the same results. I need to be able to enable and disable interrupt functions based on received modes from a central device. Any help will be greatly appreciated.

Regards,

Parents
  • void Configure_CDC_Interrupt(bool enable) { uint32_t err_code;

    	if(enable)
    	{
    			nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
    			err_code = nrf_drv_gpiote_in_init(CDC_INT_PIN, &in_config, CDC_interrupt_handler);
    			APP_ERROR_CHECK(err_code);
    			
    			nrf_drv_gpiote_in_event_enable(CDC_INT_PIN, true);
    	}
    	else
    	{
    //			nrf_drv_gpiote_in_event_disable(CDC_INT_PIN);
    			nrf_gpio_cfg_sense_set(CDC_INT_PIN, NRF_GPIO_PIN_NOSENSE);
    	}
    }
    void Configure_IMU_Interrupt(bool enable)
    {
    		uint32_t err_code;
    	
    		if(enable)
    		{
    				nrf_drv_gpiote_in_config_t in_config2 = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
    				in_config2.pull = NRF_GPIO_PIN_PULLDOWN;
    				in_config2.hi_accuracy = true;
    				err_code = nrf_drv_gpiote_in_init(IMU_INT1_PIN, &in_config2, IMU_interrupt_handler);
    				APP_ERROR_CHECK(err_code);	
    			
    				nrf_drv_gpiote_in_event_enable(IMU_INT1_PIN, true); 
    		}	
    		else
    		{		
                    //nrf_gpio_cfg_sense_set(IMU_INT1_PIN, NRF_GPIO_PIN_NOSENSE);
    
    				nrf_drv_gpiote_in_event_disable(IMU_INT1_PIN);									
    		}
    
    }
    

    The above 2 functions get called during the startup of the program. when I receive a BLE command to switch modes, I would call one of the above functions to disable the appropriate event. Can it be the program resets because of some error do to the event being(or has) triggered and the handler has not been executed when I try to disable it?

Reply
  • void Configure_CDC_Interrupt(bool enable) { uint32_t err_code;

    	if(enable)
    	{
    			nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
    			err_code = nrf_drv_gpiote_in_init(CDC_INT_PIN, &in_config, CDC_interrupt_handler);
    			APP_ERROR_CHECK(err_code);
    			
    			nrf_drv_gpiote_in_event_enable(CDC_INT_PIN, true);
    	}
    	else
    	{
    //			nrf_drv_gpiote_in_event_disable(CDC_INT_PIN);
    			nrf_gpio_cfg_sense_set(CDC_INT_PIN, NRF_GPIO_PIN_NOSENSE);
    	}
    }
    void Configure_IMU_Interrupt(bool enable)
    {
    		uint32_t err_code;
    	
    		if(enable)
    		{
    				nrf_drv_gpiote_in_config_t in_config2 = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
    				in_config2.pull = NRF_GPIO_PIN_PULLDOWN;
    				in_config2.hi_accuracy = true;
    				err_code = nrf_drv_gpiote_in_init(IMU_INT1_PIN, &in_config2, IMU_interrupt_handler);
    				APP_ERROR_CHECK(err_code);	
    			
    				nrf_drv_gpiote_in_event_enable(IMU_INT1_PIN, true); 
    		}	
    		else
    		{		
                    //nrf_gpio_cfg_sense_set(IMU_INT1_PIN, NRF_GPIO_PIN_NOSENSE);
    
    				nrf_drv_gpiote_in_event_disable(IMU_INT1_PIN);									
    		}
    
    }
    

    The above 2 functions get called during the startup of the program. when I receive a BLE command to switch modes, I would call one of the above functions to disable the appropriate event. Can it be the program resets because of some error do to the event being(or has) triggered and the handler has not been executed when I try to disable it?

Children
No Data
Related