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

Missing interrupt sometimes

Hello all,

I am using the nrf51822 chip as well as an accelerometer LIS3DH. The device does advertising and turns on a LED when it is active.

The accelerometer is configured to detect when the device has not been moved for 2 minutes. When this happens, the nRF51822 stops advertising and switches off the LED until the accelerometer detectes movement again. This works with an interruption (same interruption for putting to sleep as well as to awake).

I have found that sometimes the interrupt handler does not trigger (I checked with an oscylloscope that the accelerometer does trigger the interrupt, so the problem is in the processor). When this happens, I have to wait a couple of minutes and then the processor awakes normally.

I attach here the relevant part of the code:

static void accel_interrupt_handler1(uint8_t pin_no, uint8_t button_action)
{
stopped_person=button_action;
}

The stopped_person variable is dealt with in another part of the code.

The initialization of the interrupt is:

static void interrupts_init(void)
{	
	//Interrupts
	static app_button_cfg_t buttons[] =
    {
				{ACCEL_INT1, APP_BUTTON_ACTIVE_HIGH, NRF_GPIO_PIN_NOPULL, accel_interrupt_handler1},			
    };	
		
    APP_BUTTON_INIT(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY, true); 			
}

It is important to note that this works most of times. Could anyone tell me why I am missing some interrupts?

Thank you very much!

Related