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

GPIO event not triggered by accelerometer interrupt

I am using LSM9DS1 IMU, nRF52840 with SDK v16.0.0. I configured the IMU to raise an interrupt when the FIFO buffer be full by writing to register INT2_CTRL the value '0b00011000', I read the register to check if the configuration was written correctly and it was. Pin INT2_A/G of IMU is connected to P0.11.

Below, the GPIOTE configurations.

#define INT_PIN 11

/* GPIO congifuration */
nrfx_gpiote_in_config_t int_pin_config = {             
    .sense = NRF_GPIOTE_POLARITY_HITOLO,
    .pull = NRF_GPIO_PIN_PULLUP,
    .is_watcher = false,                            
    .hi_accuracy = true,                        
    .skip_gpio_setup = false,                      
};

nrfx_err_t err_code = nrfx_gpiote_in_init(INT_PIN, &int_pin_config, gpio_handler);    //Initialize GPIO interrupt
nrfx_gpiote_in_event_enable(INT_PIN, true);

Below, the GPIOTE event handler.

void gpio_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action){

    if(action == NRF_GPIOTE_POLARITY_HITOLO){
        
        tx_buff[0] = OUT_X_L_G;
        //Read data when the interrup occurs
        lsm9ds1_read_data(tx_buff, TX_BUFF_SIZE, rx_buff, RX_BUFF_SIZE);

    }
}

I set a checkpoint in the handler but it never enters. When I check the FIFO_SRC register, FTH and OVRN bits are set to 1 so I am assuming that the interrup in actually raised. 

Any ideas of why it does not enter in the handler?

PS: I have tried all possible combinations of sense and pull in the configurarion and the result is the same.

Parents
  • Hello,

    Have you tested the pin_change_int example found in:

    SDK16\examples\peripheral\pin_change_int

    As far as I can say, your setup looks pretty much the same (hitolo instead of toggle, but otherwise, similar.

    I don't know what your sensor does. Have you tried shorting the INT_PIN to both GND and VDD? Does anything happen then? Can you confirm that you use pin P0.11?

    The reason I want you to try and short to both GND and VDD is that perhaps both your sensor requires another pull configuration. Perhaps you are using pullup, but the sensor only pulls the pin high (and expect a pulldown).

    Try to physically short the pin to GND and VDD (a couple of times), and try to change your pull settings.

    Best regards,

    Edvin

Reply
  • Hello,

    Have you tested the pin_change_int example found in:

    SDK16\examples\peripheral\pin_change_int

    As far as I can say, your setup looks pretty much the same (hitolo instead of toggle, but otherwise, similar.

    I don't know what your sensor does. Have you tried shorting the INT_PIN to both GND and VDD? Does anything happen then? Can you confirm that you use pin P0.11?

    The reason I want you to try and short to both GND and VDD is that perhaps both your sensor requires another pull configuration. Perhaps you are using pullup, but the sensor only pulls the pin high (and expect a pulldown).

    Try to physically short the pin to GND and VDD (a couple of times), and try to change your pull settings.

    Best regards,

    Edvin

Children
No Data
Related