Device resetting after I have enabled Timer0

OK, full disclosure - I'm pretty new to the whole nRF Connect/Nordic Semi environment, having had to jump across here after all the issues with silicon availability meant I could no longer get Cypress IC's for the products I build.

I'm slowly (very, very, slowly) getting familiar with coding using VSC + nrF Connect + nrF52-DK as my environment.  Its painful, but I'm making forward progress.

However, I seem to have come unstuck with a simple piece of code that uses Timer0 to flash a LED at a set period.  My code builds, and I can flash it to my DK, but the chip seems to just reset itself shortly after I make a call to the function that enables the timer I am using.

My main loop looks like this:

    led_config();
    printf("led_config SUCCESS\n");
    main_loop_timer_init();
    printf("main_loop_timer_init SUCCESS\n");
    nrfx_timer_enable(&TIMER_MAIN_LOOP);
    printf("nrfx_timer_enable SUCCESS\n");
    while (1) 
    {
    
    }
And if I monitor the UART output, I can see the following:

*** Booting Zephyr OS build v2.6.0-rc1-ncs1 ***
led_config SUCCESS
NRF_SUCCESS
main_loop_timer_init SUCCESS
*** Booting Zephyr OS build v2.6.0-rc1-ncs1 ***
led_config SUCCESS
NRF_SUCCESS
main_loop_timer_init SUCCESS
*** Booting Zephyr OS build v2.6.0-rc1-ncs1 ***
led_config SUCCESS
NRF_SUCCESS
main_loop_timer_init SUCCESS
*** Booting Zephyr OS build v2.6.0-rc1-ncs1 ***

So, it seems to be getting to the call to  nrfx_timer_enable(&TIMER_MAIN_LOOP);
If I dig down into that, I can see that its bombing out somewhere between these two lines of code (in nrfx_timer_enable() in nrfx_timer.c)
    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START);
    m_cb[p_instance->instance_id].state = NRFX_DRV_STATE_POWERED_ON;
Any ideas what's going on?
Cheers,
Mike
Related