nRF54L15: How to explicitly enable and keep HFCLK running for TIMER00 in Zephyr?

Hi,

I am using an nRF54L15 and I would like to explicitly enable the HFCLK (32MHz). I want to use it to drive TIMER00, which will run during the whole application runtime. I have my custom board - also I tried to resolder the XTALL.

Ideally I would use the Zephyr clock API, but I also tried a more direct approach like this and I got always stuck on the while:

NRF_CLOCK->TASKS_XOSTART = 1;

while (NRF_CLOCK->EVENTS_XOSTARTED == 0);

In my device tree overlay I added:

&hfxo {
    status = "okay";
    clock-frequency = <DT_FREQ_M(32)>;
    load-capacitors = "internal";
    load-capacitance-femtofarad = <15000>;  // ~8 pF per pin
};

And in my prj.conf I have:

CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y

But it  does not work. Could you please advise what is the correct way to explicitly start and keep HFCLK running on nRF54L15 in Zephyr, preferably using the Zephyr API?

Maybe my HW design is not perfect?
Thank you.

Even AI solution like this could not help me: I get stuck in a loop.

void my_hfclk_start(void)
{
    struct onoff_manager *mgr =
        z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);

    __ASSERT_NO_MSG(mgr != NULL);

    sys_notify_init_spinwait(&hfclk_cli.notify);

    int ret = onoff_request(mgr, &hfclk_cli);
    __ASSERT_NO_MSG(ret >= 0);

    /* Wait for clock to be ready */
    int res;
    int err;
    do {
        err = sys_notify_fetch_result(&hfclk_cli.notify, &res);
    } while (err);
}
Related