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

Start and stop RTC with PORT events on a single pin

Hi, i'm wondering if it's possible to make a GPIO pin trigger different tasks when it is externally driven from low to high, and high to low.

I'm trying to stop an RTC timer when a pin goes high and start it again when it goes low, using PPI. Do i need to allocate two GPIOTE channels? And how do i get the different event adresses?

I'm on the nRF52, and i'm not using SD, I also don't want the high frequency clock running.

Parents
  • You technically can't do this the obvious way, by assigning two GPIOTE channels, one up, one down, to the same pin .. from the manual

    "Only one GPIOTE channel can be assigned to one physical pin. Failing to do so may result in unpredictable behavior."

    In the nrf51 series this limitation only actually applied to output to the pin, which makes sense, and although never documented as safe, you could attach two input GPIOTE channels to the same pin and it worked.

    So you could try that - see if it works or not, but be aware you're not really following the spec if you do.

    Another option would be to use one toggle GPIOTE, then two groups of 3 PPIs each, one group containing a PPI to start the timer, one a PPI to stop it and the other two PPIs to enable/disable the other group each time. In that way you flip-flop between two states automatically.

    The best way to do this however is to attach your input signal to two GPIOs and configure one GPIOTE each on them.

  • Spec says that having one or more GPIOTE active channels in input mode draws .5uA. I don't see a block resource chart for the nRF52 but the GPIOTE requiring HFCLK in IN mode was always listed as a product anomaly for the nRF51 series, I don't see any similar PAN for the nRF52, so are you sure HFCLK is required? The 0.5uA would indicate that it's not.

Reply
  • Spec says that having one or more GPIOTE active channels in input mode draws .5uA. I don't see a block resource chart for the nRF52 but the GPIOTE requiring HFCLK in IN mode was always listed as a product anomaly for the nRF51 series, I don't see any similar PAN for the nRF52, so are you sure HFCLK is required? The 0.5uA would indicate that it's not.

Children
No Data
Related