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

app_button missing fast events of 100ms

Hello, 

I am using NRF52840 with SDK 16.0.0.

We have to detect reed switch pulses coming from a water meter. We use app_button as it provides debouncing inbuilt.

Pulses can comes as fast as of 100 ms  debounce(Low Trigger).

But in 100 out of 94 to 98 only be read by NRF52840 other get missed. It is tasted 10 times. But never get 100 out of 100 pulse count.

So, please help us to solve this issue.

Thank You

Bivay  



Parents Reply
  • How about use the gpiote interrupt instead of app_button, for instance look at:
    examples\peripheral\pin_change_int

    In the callback handler you should be able to differentiate the pin that triggered the callback by:
    void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)

    You can for instance in the callback start an app_timer that will read the pin after for instance 10ms, by using nrf_gpio_port_in_read() or nrf_gpio_pin_read(), this will work the same as debouncing.

Children
Related