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

Using two GPIOTE config to a single pin

In another thread entitled:

Change in GPIO to start/stop timer and fire interrupt

The following code is used:

  NRF_GPIOTE->CONFIG[0] = (GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos)
        | (myPin << GPIOTE_CONFIG_PSEL_Pos) // using GPIO 5 as input
        | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);

    //// Configure GPIOTE channel 1 as event that occurs when pin 5 changes from digital
    //// low to hi.
    NRF_GPIOTE->CONFIG[1] = (GPIOTE_CONFIG_POLARITY_LoToHi << GPIOTE_CONFIG_POLARITY_Pos)
        | (myPin<< GPIOTE_CONFIG_PSEL_Pos) // using GPIO 5 as input
        | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);

In the nRF51 RM, there is a statement: Each GPIOTE channel is associated with one physical GPIO pin through the CONFIG.PSEL field...

Is the above code breaking this rule? Are two configurations being mapped to a single pin?

Would the correct code be to look for a change, then check the PIN state in the ISR to determine whether it was HiToLo or LoToHi?

If so, what would be the recommended debounce approach?

Parents
  • I am confused by terminology. I have a physical connection to what I call a pin. I want an interrupt on both rising and falling events. I do not have the option of connecting two physical pins to a single signal line. I am also new to the M0 architecture. Is an input a logical concept inside the M0? What is the difference between an input and a pin? I think of pin and input as synonyms. If you could point me to the correct section of the RM, I would appreciate it.

Reply
  • I am confused by terminology. I have a physical connection to what I call a pin. I want an interrupt on both rising and falling events. I do not have the option of connecting two physical pins to a single signal line. I am also new to the M0 architecture. Is an input a logical concept inside the M0? What is the difference between an input and a pin? I think of pin and input as synonyms. If you could point me to the correct section of the RM, I would appreciate it.

Children
No Data
Related