Timer does not work properly

I set a timer on the net core of nrf5340. The timer sets an interrupt of 10s. After the chip is reset and runs for 10s, the while (1) of the main function is interrupted, but it doesn't seem to enter the interrupt function. I don't know where the problem is. The following my initialization code, please help me see, thank you.

const nrfx_timer_t TIMER_FC = NRFX_TIMER_INSTANCE(0);


void timer_fc_event_handler(nrf_timer_event_t event_type, void* p_context)
{
    switch (event_type)
    {
	case NRF_TIMER_EVENT_COMPARE0:
            printk("test\r\n");
        break;
            
        default:
            //Do nothing.
            break;
    }
}


void timer_fc_init(void)
{
    uint32_t time_ms = 10000; 
    uint32_t time_ticks;

    nrfx_err_t err_code;
	
    nrfx_timer_config_t timer_cfg = NRFX_TIMER_DEFAULT_CONFIG;

    timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
    timer_cfg.p_context = timer_fc_event_handler;
    timer_cfg.frequency = NRF_TIMER_FREQ_16MHz;
    timer_cfg.interrupt_priority = 7;
    timer_cfg.mode = NRF_TIMER_MODE_TIMER;
    
    err_code = nrfx_timer_init(&TIMER_FC, &timer_cfg, timer_fc_event_handler);
	  
    time_ticks = nrfx_timer_ms_to_ticks(&TIMER_FC, time_ms);

    nrfx_timer_extended_compare(
         &TIMER_FC, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

    IRQ_DIRECT_CONNECT(TIMER0_IRQn, 0,
			   timer_fc_event_handler, 0);

    irq_enable(TIMER1_IRQn);

    nrfx_timer_enable(&TIMER_FC);
}


void main(void)
{
	int err;
        uint32_t temp;
        uint8_t rx_data[100];


        PA_Init();
        PA_mode_set(pa_rx_mode);
        ANT_Switch_set(ant4);

        printk("This RX NET Core\r\n");

        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);

        printk("clock init\r\n");
        
        printk("channel set:%d\r\n", esb_set_rf_channel(86));
        err = esb_start_rx();

        //radio_registers_read();
        
        printk("channel:%d\r\n",NRF_RADIO->FREQUENCY);

        timer_fc_init();

        while(1)
        {
            printk("main while\r\n");
            k_sleep(K_MSEC(2000));
        }
}

Parents Reply Children
No Data
Related