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

Why can't I use nrf_drv_gpiote_in_init request two pin for irq.

Hi:

When I call nrf_drv_gpiote_in_init to request twice for the pin irq.

but the second irq is not work.

How Can I do ?

Thank you very much.

  • Hello weiqifa

    If I have understood your post correct you want to have two seperate events from the same pin, and you have tried to set this up by calling nrf_drv_gpiote_in_init twice for the same physical pin. Please correct me if this is wrong.

    You can only initialize a GPIOTE pin once, and trying to do it a second time will result in an error.

    Unfortunately, you cannot trigger two separate GPIOTE events from the same pin. The event generated by a pin is either a high-to-low transition, a low-to-high transition, or a toggle which generates the toggle event on either transition.

    However, when you initialize a GPIOTE input pin you also define a callback function. In this callback function you could do a check on whether the pin is high or low, and perform different actions based on that.

    In this way, you could have the input event set to toggle, and then perform a check on the pin state. This would allow you to perform different actions for a high-to-low, or low-to-high transition on the same pin. This would not work if using PPI as it does not use the callback function.

    Best regards

    Jørn Frøysa

  • I have find this problem. because of the sensor pin. now,I have modify it.

Related