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

How to trigger 2 timers on same PPI event

I have the following code. I need to add a second counter attached to the spi_end_event. The first counter "count_task" is working, but can you tell me how to get "count_task2" to also count on every spi_end_event? I'm unclear on how to get multiple tasks to occur on the same event.

    // Configure PPI to toggle CS pin and start SPI transfer on timer event
    uint32_t period_event = nrf_drv_timer_event_address_get(&m_timer1, NRF_TIMER_EVENT_COMPARE0);
    uint32_t cs_task = nrfx_gpiote_out_task_addr_get(GPIO_SPI_CS);
    uint32_t spi_start_task = nrf_drv_spi_start_task_get(&m_spi0);
   
    status = nrfx_ppi_channel_assign(m_ppi_channel0, period_event, cs_task);
    APP_ERROR_CHECK(status);
    status = nrfx_ppi_channel_fork_assign(m_ppi_channel0, spi_start_task);
    APP_ERROR_CHECK(status);
    // Configure PPI to toggle CS pin and count task on SPI transfer end event
    uint32_t spi_end_event = nrf_drv_spi_end_event_get(&m_spi0);
    uint32_t count_task = nrf_drv_timer_task_address_get(&m_timer2, NRF_TIMER_TASK_COUNT);
    uint32_t count_task2 = nrf_drv_timer_task_address_get(&m_timer4, NRF_TIMER_TASK_COUNT);
    status = nrfx_ppi_channel_assign(m_ppi_channel1, spi_end_event, cs_task);
    APP_ERROR_CHECK(status);
    status = nrfx_ppi_channel_fork_assign(m_ppi_channel1, count_task);
    APP_ERROR_CHECK(status);

Parents Reply Children
No Data
Related