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

LPCOMP interrupts are not getting triggered.

Hi,

I'm trying to use the LPCOMP of the nrf52 telit board.Configured lpcomp with the following settings :

Input : AIN2 Ref : AIN1 ( external ref. of 1.6V) Detection : Crossing

I've initialised the lpcomp and enabled the lpcomp with nrf_drv_lpcomp_enable() My init function is :

static void lpcomp_init(void)
{
    uint32_t                err_code;

    nrf_drv_lpcomp_config_t config = NRF_DRV_LPCOMP_DEFAULT_CONFIG;
    config.input = NRF_LPCOMP_INPUT_2;
    // initialize LPCOMP driver, from this point LPCOMP will be active and provided
    // event handler will be executed when defined action is detected
    err_code = nrf_drv_lpcomp_init(&config, lpcomp_event_handler);
    APP_ERROR_CHECK(err_code);
    nrf_drv_lpcomp_enable();
}

My handler function is :

static void lpcomp_event_handler(nrf_lpcomp_event_t event)
{
	
	 switch(event)
	 {
		 case NRF_LPCOMP_EVENT_CROSS:
			 lpcomp_result = nrf_lpcomp_result_get();
			 cross_count++;
			 break;
		 default:
	 }
	
}

When debugging, i do not receive any interrupts and cross count is always zero. Same is observed when i change to internal ref with vtg supply*4/8.

Related