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

Timer 2 doesn't tick in S130

I'm trying to use a timer with S130, but it doesn't seem to tick:

void timer_event_handler(nrf_timer_event_t event_type, void * p_context) {
	NRF_LOG_INFO("Timer 1 interrupt\r\n");
}

const nrf_drv_timer_t timer2 = NRF_DRV_TIMER_INSTANCE(2);
nrf_ppi_channel_t ppi_channel1;
static void timers_init() {
	nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
	timer_cfg.mode = NRF_TIMER_MODE_TIMER;
	timer_cfg.frequency = NRF_TIMER_FREQ_125kHz;
	NRF_LOG_INFO("Timer init\r\n");
	APP_ERROR_CHECK(nrf_drv_timer_init(&timer2, &timer_cfg, timer_event_handler));
	nrf_drv_timer_extended_compare(&timer2, NRF_TIMER_CC_CHANNEL0, 1250, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

	nrf_drv_timer_enable(&timer2);
}

I'm running the timers_init() routine after the ble stack etc. has started. But the eventhandler never get's triggered. Am I missing something here?

Parents
  • #ifndef TIMER_ENABLED #define TIMER_ENABLED 1 #endif #if TIMER_ENABLED

    #ifndef TIMER_DEFAULT_CONFIG_FREQUENCY
    #define TIMER_DEFAULT_CONFIG_FREQUENCY 0
    #endif
    
    #ifndef TIMER_DEFAULT_CONFIG_MODE
    #define TIMER_DEFAULT_CONFIG_MODE 0
    #endif
    
    #ifndef TIMER_DEFAULT_CONFIG_BIT_WIDTH
    #define TIMER_DEFAULT_CONFIG_BIT_WIDTH 2
    #endif
    
    #ifndef TIMER_DEFAULT_CONFIG_IRQ_PRIORITY
    #define TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 3
    #endif
    
    #ifndef TIMER2_ENABLED
    #define TIMER2_ENABLED 1
    #endif
    
Reply
  • #ifndef TIMER_ENABLED #define TIMER_ENABLED 1 #endif #if TIMER_ENABLED

    #ifndef TIMER_DEFAULT_CONFIG_FREQUENCY
    #define TIMER_DEFAULT_CONFIG_FREQUENCY 0
    #endif
    
    #ifndef TIMER_DEFAULT_CONFIG_MODE
    #define TIMER_DEFAULT_CONFIG_MODE 0
    #endif
    
    #ifndef TIMER_DEFAULT_CONFIG_BIT_WIDTH
    #define TIMER_DEFAULT_CONFIG_BIT_WIDTH 2
    #endif
    
    #ifndef TIMER_DEFAULT_CONFIG_IRQ_PRIORITY
    #define TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 3
    #endif
    
    #ifndef TIMER2_ENABLED
    #define TIMER2_ENABLED 1
    #endif
    
Children
No Data
Related