Hi,
I am woking on NRF52840.
OS : Windows
SDK version : 15.0
Dev : Keil IDE.
I am using Timer -2, Compare value method to obtain an interrupt.
The interrupt is being generated every time but the call back is executed only on the first interrupt.
Here is a small Snippet of my code.
nrf_ppi_channel_t m_ppi_channel;
const nrfx_timer_t m_timer2 = NRF_DRV_TIMER_INSTANCE(2);
/* Timer Init */
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
err_code = nrf_drv_timer_init( &m_timer2, &timer_cfg, event_handler);
APP_ERROR_CHECK( err_code );
/* PPI Init */
// Configuring the PPI used for automating the data streaming
err_code = nrf_drv_ppi_channel_alloc( &m_ppi_channel );
APP_ERROR_CHECK( err_code );
// Set up PPI Chn0 for triggering of SPIM start when DR pin event occurs (set up for falling edge event)
err_code = nrf_drv_ppi_channel_assign( m_ppi_channel,
nrf_drv_gpiote_in_event_addr_get( AFE_DR_PIN ),
nrf_spim_task_address_get( nrfbusHandle->busIdentifier.u.spim.p_reg, NRF_SPIM_TASK_START ) );
APP_ERROR_CHECK( err_code );
// Fork PPI to also trigger count on timer2 to keep track of number of samples.
err_code = nrf_drv_ppi_channel_fork_assign( m_ppi_channel,
nrf_drv_timer_task_address_get( &m_timer2, NRF_TIMER_TASK_COUNT ) );
APP_ERROR_CHECK( err_code );
/* Waiting for INT */
nrf_drv_timer_extended_compare( &m_timer2, NRF_TIMER_CC_CHANNEL1,Count, NRF_TIMER_SHORT_COMPARE1_STOP_MASK, true ); //Tried with clear mask also
err_code = nrf_drv_ppi_channel_enable( m_ppi_channel );
APP_ERROR_CHECK( err_code );
nrf_drv_timer_enable( &m_timer2 );
My code is hung.
I tried debugging and I found out that the Interrupts are Generated and not cleared. My timer is counting and restarting the count when i try the second time.
It's just that my Interrupt Handler : event_handler is not called the second time.
I even tried increasing the Timer Interrupt Priority.
Is there anything I have missed out or I have misunderstood?
Thanks in advance.
:-) Tejaswini