Hi Nordic,
I am interested to use one timer (NRF_TIMER3) and 2 channels of the timer counter CC to generate a gpioe task for toggleling a pin. This is the current code that I have.
nrf_gpiote_task_configure(3, 12, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_LOW); nrf_gpiote_task_enable(3); nrf_gpiote_task_configure(4, 24, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_enable(4); nrf_ppi_channel_endpoint_setup( NRF_PPI_CHANNEL2, (uint32_t) nrf_timer_event_address_get(NRF_TIMER3, NRF_TIMER_EVENT_COMPARE3), nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_3)); nrf_ppi_channel_enable(NRF_PPI_CHANNEL2); nrf_ppi_channel_endpoint_setup( NRF_PPI_CHANNEL3, (uint32_t) nrf_timer_event_address_get(NRF_TIMER3, NRF_TIMER_EVENT_COMPARE0), nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_4)); nrf_ppi_channel_enable(NRF_PPI_CHANNEL3); NRF_TIMER3->TASKS_STOP = 1; NRF_TIMER3->TASKS_CLEAR = 1; NRF_TIMER3->PRESCALER = 0; NRF_TIMER3->BITMODE = TIMER_BITMODE_BITMODE_32Bit << TIMER_BITMODE_BITMODE_Pos; NRF_TIMER3->CC[0] = 4000; //TIME_SYNC_TIMER_MAX_VAL; NRF_TIMER3->CC[1] = 0xFFFFFFFF; NRF_TIMER3->CC[2] = 0xFFFFFFFF; NRF_TIMER3->CC[3] = 2000; //0xFFFFFFFF; NRF_TIMER3->CC[4] = 4000 ; // Only used for debugging purposes such as pin toggling NRF_TIMER3->SHORTS = TIMER_SHORTS_COMPARE3_CLEAR_Msk ; NRF_TIMER3->SHORTS |= TIMER_SHORTS_COMPARE0_CLEAR_Msk; NRF_TIMER3->TASKS_START = 1;
It should be able to toggle both pins (12 and 24) but it just toggles one of them. My assumption is that it is related with the NRF_TIMER3->SHORTS that I'm using.
which are the correct values that I should use here? or there is any other error that I'm missing?