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
  • Yes, you can do this no problem. and you need to use GPIOTE. I guess you are capturing pulse width using RTC?

  • I'm trying to halt the execution of code which is periodically called with the RTC, using an external interrupt.

    Do i use the placeholder pin when i run nrf_drv_gpiote_in_event_addr_get(placeholder) when assigning EEP and TEP to a ppi channel?

    exp: APP_ERROR_CHECK(nrf_drv_ppi_channel_assign(ppi_channel_rtc_start, nrf_drv_gpiote_in_event_addr_get(ADXL362_INT_PIN), nrf_drv_rtc_task_address_get(&rtc, NRF_RTC_TASK_STOP)));

    edit: It seems that nrf_gpiote_event_configure is only valid when GPIOTE is in high accuracy mode (using hfclk), otherwise it is using: m_cb.port_handlers_pins[channel-NUMBER_OF_GPIO_TE] |= (p_config->sense)<< SENSE_FIELD_POS;

    The control block is locked static in the driver, so i don't have access to it.

Reply
  • I'm trying to halt the execution of code which is periodically called with the RTC, using an external interrupt.

    Do i use the placeholder pin when i run nrf_drv_gpiote_in_event_addr_get(placeholder) when assigning EEP and TEP to a ppi channel?

    exp: APP_ERROR_CHECK(nrf_drv_ppi_channel_assign(ppi_channel_rtc_start, nrf_drv_gpiote_in_event_addr_get(ADXL362_INT_PIN), nrf_drv_rtc_task_address_get(&rtc, NRF_RTC_TASK_STOP)));

    edit: It seems that nrf_gpiote_event_configure is only valid when GPIOTE is in high accuracy mode (using hfclk), otherwise it is using: m_cb.port_handlers_pins[channel-NUMBER_OF_GPIO_TE] |= (p_config->sense)<< SENSE_FIELD_POS;

    The control block is locked static in the driver, so i don't have access to it.

Children
No Data
Related