This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gpiote interrupt not taken

nRF51_SDK_9.0.0_2e23562 S310

/*
 * Setup the gpiote to handle pin events on the MMA8451Q INT1 pin. For the
 * accelerometer we want to detect high->low transitions in order to know
 * when accelerometer data is ready.
 */
static nrf_drv_gpiote_in_config_t m_INT1_pin_config =
{
    .is_watcher  = false,
    .hi_accuracy = true,
    .pull        = NRF_GPIO_PIN_NOPULL,
    .sense       = NRF_GPIOTE_POLARITY_HITOLO
};

There seems to be an issue around gpiote interrupts being lost when the pin config is set to low accuracy. This, I note, has been fixed in SDK 11.

We see an issue when the pin config is set to high accuracy.

I need a code sample for the workaround for this issue.

  • How is the timing for the pin interrupt? What do you mean "we see an issue"? Is the event not set? Is the ISR not running? Is the callback not called? Is nothing at all working? How is the GPIOTE configured, i.e how many pins are configured, what interrupt priority do you have and what others? You should provide A LOT more information. And, you need a username to be unique on the forum.

  • The issue is: the ISR does not run, inspection of the input pin by oscilloscope indicates that the interrupt input pin IS asserted.

    GPIOTE has 2 pins configured as follows:

    • MMA8451Q nRF51422


    • | | | |

    • | INT2 |-------->| P0.16 |

    • | | | |

    • | INT1 |-------->| P0.15 |

    • | | | |


    • Accelerometer IC Microcontroller IC

    GPIOTE Configuration is as follows

    /*

    • Setup the gpiote to handle pin events on the MMA8451Q INT1 pin. For the
    • accelerometer we want to detect high->low transitions in order to know
    • when accelerometer data is ready. */ static nrf_drv_gpiote_in_config_t m_INT1_pin_config = { .is_watcher = false, .hi_accuracy = true, .pull = NRF_GPIO_PIN_NOPULL, .sense = NRF_GPIOTE_POLARITY_HITOLO };

    /*

    • Setup the gpiote to handle pin events on the MMA8451Q INT2 pin. For the
    • accelerometer we want to detect high->low transitions in order to know
    • when the accelerometer has changed orientation e.g. from portrait to landscape. */ static nrf_drv_gpiote_in_config_t m_INT2_pin_config = { .is_watcher = false, .hi_accuracy = true, .pull = NRF_GPIO_PIN_NOPULL, .sense = NRF_GPIOTE_POLARITY_HITOLO };
  • Have you tried setting .pull to pullup?

  • Hmmm, adding a pull-up made the problem go away. I appreciate your help, thank you. Care to enlighten me as to why that would make the difference?

  • That depends on your hardware, but I guess that the floating state of your input pin is not high enough to trigger a transitional state. Say the GPIOTE IN pin is at 0.3V floating. Pulling that low wont trigger an actual low flank, but now with pullup, you'll have a transition from VCC->GND, which definately will be registered as a valid high to low transition.

Related