Nrf9160 External Pin Interrupt Issue in PSM Mode

We are trying to read a flow sensor in our device. The device is in PSM mode most of the time.

The sensor outputs its state in digital mode HIGH or LOW. We are checking a falling edge interrupt to get sensor trigger.

Interrupts are working fine in non-psm mode. The problem is that sometimes we cannot catch pin interrupts in PSM mode after 15-20 minutes.

Some interrupts can be caught some of them not.

Is there a correct way of interrupt setting to wake the device with external pin interrupt in PSM mode.

Here is the code snippet we have used to configure the external pin interrupt.

#define FLOW_NODE           DT_ALIAS(flow_in)

const struct device *dev_flow;

dev_flow = device_get_binding(DT_GPIO_LABEL(FLOW_NODE, gpios));
if (dev_flow == NULL)
{
    return;
}
else
{
    err = gpio_pin_configure(dev_flow, DT_GPIO_PIN(FLOW_NODE, gpios),
                             GPIO_INPUT | GPIO_INT_DEBOUNCE);
    if (err < 0)
    {
        return;
    }

    gpio_init_callback(&button_callback, flow_int_callback, BIT(DT_GPIO_PIN(FLOW_NODE, gpios) ) );
    gpio_add_callback(dev_flow, &button_callback);
    gpio_pin_interrupt_configure(dev_flow, DT_GPIO_PIN(FLOW_NODE, gpios),
                                 GPIO_INT_EDGE_FALLING);
}

Parents Reply Children
  • 1) What SDK version are you using?

    2) What pin number are you using for the sensor?

    3) 

    The sensor outputs its state in digital mode HIGH or LOW.

    What is the voltage of the pin when it goes high again?

  • Hi,

    Here are the details ;

    1) What SDK version are you using?

    - 1.9.1

    2) What pin number are you using for the sensor?

    - GPIO26

    3) What is the voltage of the pin when it goes high again?

    - The pink is normally HIGH, connected to VDD_GPIO with 10 K resistor. It goes low when a trigger occurs. We also tried connecting sensor pin directly to GPIO26 with internal pull-up enabled but the results are the same.

  • Cosar said:
    - The pink is normally HIGH, connected to VDD_GPIO with 10 K resistor. It goes low when a trigger occurs. We also tried connecting sensor pin directly to GPIO26 with internal pull-up enabled but the results are the same.

    Ok, so you have measured that the when it's 'high', it's actually reaching VDD_GPIO.

    How does your button_callback() function looks like? Anything there that could be blocking? or somehow explain the behavior you are seeing?

Related