Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using nrf_drv_ppi_channel_assign() to trigger timer clear task?

I'm trying to be a good camper and stick to published SDK interfaces, but I'm stuck on one point.

I want to use the PPI to toggle a GPIO pin AND clear the timer on a timer CC event.  So I have something like:

uint32_t cc0_eep = nrf_drv_timer_compare_event_address_get(&m_timer, NRF_TIMER_CC_CHANNEL0);

err_code = nrf_drv_ppi_channel_assign(&ppi_channel,
cc0_eep, nrfx_gpiote_set_task_addr_get(pin));
APP_ERROR_CHECK(err_code);

err_code = nrf_drv_ppi_channel_fork_assign(&ppi_channel, cc0_eep, nrfx_timer_clear_task_addr_get(&m_timer)); // this is wrong
APP_ERROR_CHECK(err_code);

My confusion is that there is no function "nrfx_timer_clear_task_addr_get()".  What's the right argument to pass here?

(Related, but less critical: is it possible to mix calls to shortcuts and regular nrf_drv_ppi_channel_assign()?  If so, how?)

Parents
  • I think i've answered my own question, but let me know if this is incorrect!  

    uint32_t cc0_eep = nrf_drv_timer_compare_event_address_get(&m_timer, 
                                                               NRF_TIMER_CC_CHANNEL0);
    
    err_code = nrf_drv_ppi_channel_assign(&ppi_channel, 
                                          cc0_eep, 
                                          nrfx_gpiote_set_task_addr_get(pin));
    APP_ERROR_CHECK(err_code);
    
    err_code = nrf_drv_ppi_channel_fork_assign(&ppi_channel, 
                                               cc0_eep, 
                                               nrfx_timer_task_address_get(&m_timer,
                                                                           NRF_TIMER_TASK_CLEAR));
    APP_ERROR_CHECK(err_code);

    In particular, nfrx_timer_task_addr_get() takes a second argument describing what kind of task to trigger.

Reply
  • I think i've answered my own question, but let me know if this is incorrect!  

    uint32_t cc0_eep = nrf_drv_timer_compare_event_address_get(&m_timer, 
                                                               NRF_TIMER_CC_CHANNEL0);
    
    err_code = nrf_drv_ppi_channel_assign(&ppi_channel, 
                                          cc0_eep, 
                                          nrfx_gpiote_set_task_addr_get(pin));
    APP_ERROR_CHECK(err_code);
    
    err_code = nrf_drv_ppi_channel_fork_assign(&ppi_channel, 
                                               cc0_eep, 
                                               nrfx_timer_task_address_get(&m_timer,
                                                                           NRF_TIMER_TASK_CLEAR));
    APP_ERROR_CHECK(err_code);

    In particular, nfrx_timer_task_addr_get() takes a second argument describing what kind of task to trigger.

Children
No Data
Related