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
  • The GPIOTE driver toggles sensing mode (hi-lo) each time before the handler is called. By utilizing the same functions as the driver i finally got it to work.

    nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(ADXL362_INT_PIN);

    if(sense == NRF_GPIO_PIN_SENSE_HIGH) { NRF_RTC0->TASKS_STOP = 1; } else if (sense == NRF_GPIO_PIN_SENSE_LOW) { NRF_RTC0->TASKS_START = 1; }

    Thanks for all the help anyways :)

Reply
  • The GPIOTE driver toggles sensing mode (hi-lo) each time before the handler is called. By utilizing the same functions as the driver i finally got it to work.

    nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(ADXL362_INT_PIN);

    if(sense == NRF_GPIO_PIN_SENSE_HIGH) { NRF_RTC0->TASKS_STOP = 1; } else if (sense == NRF_GPIO_PIN_SENSE_LOW) { NRF_RTC0->TASKS_START = 1; }

    Thanks for all the help anyways :)

Children
No Data
Related