Enable timer interrupt in nRF54L15

int8_t timer_demo(void)
{
    const nrfx_timer_t timer_instance = NRFX_TIMER_INSTANCE(22);
    
    if(timer_init(&timer_instance) != OK)
        return TIMER_INIT_ERROR;
    while(1){
            i++;
        
             k_msleep(50);
        };
    return OK;
}

int8_t timer_init(nrfx_timer_t const* const ptr_timer_instance)
{
    nrfx_timer_config_t timer_config = NRFX_TIMER_DEFAULT_CONFIG(1000000);
    timer_config.interrupt_priority = 0;
    if(nrfx_timer_init(ptr_timer_instance,&timer_config,wcd_timer_callback) != NRFX_SUCCESS)
    {
        printk("Timer %d initiation error",(uint32_t)TIMER_INSTANCE_NUMBER);
        return TIMER_INIT_ERROR;
    }
    
    nrfx_timer_extended_compare(ptr_timer_instance, NRF_TIMER_CC_CHANNEL0,
     nrfx_timer_ms_to_ticks(ptr_timer_instance, WCD_TIMER_COMP_MS),
      NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
    
    nrfx_timer_enable(ptr_timer_instance);
        
    return OK;
}

Hi guys,

I am trying to enable timer interrupt in nRF54L15.

but when i debug the application it locks inside the IRQ_lock.

can anyone explain me the issue here. It would be very elpful in my development

regards 
JONES

Parents

  • Hi!

    In your code you have:

    timer_config.interrupt_priority = 0;

     Priority 0 is the very highest priority, above Zephyr’s own kernel and system ISRs. Using that for a periodic timer that keeps firing can starve everything else.

    Try e.g. this instead

    timer_config.interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY; 
Reply

  • Hi!

    In your code you have:

    timer_config.interrupt_priority = 0;

     Priority 0 is the very highest priority, above Zephyr’s own kernel and system ISRs. Using that for a periodic timer that keeps firing can starve everything else.

    Try e.g. this instead

    timer_config.interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY; 
Children
No Data
Related