Questions about enabling external 32 MHz crystal (HFXO) on nRF54L15 custom board

Hi everyone,

I’m testing a custom nRF54L15 board with BLE, but it gets stuck inside bt_enable(). To debug the issue, I checked whether my 32 MHz external crystal (HFXO) is actually running by using nrf_clock_is_running(). The function shows that both HF and LF clocks are running, but the high-frequency clock source reports as RC instead of XTAL. The low-frequency crystal (32.768 kHz) looks fine.

So I tried to verify if this was a soldering issue. When I desoldered the 32 MHz crystal, the HF clock completely stopped and nrf_clock_is_running() returned 0. So I think soldering may not be the issue.

My questions are : 

1. Is nrf_clock_is_running() a reliable API on nRF54L15 for checking the actual clock source?

2. How can I enable the 32 MHz external crystal instead of using the internal RC oscillator on the nrf54l15.

And here are my code for this testing:

int main(void)
{
    #if defined(NRF_CLOCK_S)
        NRF_CLOCK_Type *C = NRF_CLOCK_S;
    #else
        NRF_CLOCK_Type *C = NRF_CLOCK;
    #endif
    // HFXO
    nrf_clock_task_trigger(C, NRF_CLOCK_TASK_HFCLKSTART);
    uint32_t t0 = k_uptime_get_32();
    while (!nrf_clock_event_check(C, NRF_CLOCK_EVENT_HFCLKSTARTED)) {
        if (k_uptime_get_32() - t0 > 100) {
            LOG_ERR("HFCLKSTARTED event not seen");
            break;
        }
        k_busy_wait(50);
    }
    nrf_clock_event_clear(C, NRF_CLOCK_EVENT_HFCLKSTARTED);
    nrf_clock_hfclk_t src;
    bool running = nrf_clock_is_running(C, NRF_CLOCK_DOMAIN_HFCLK, &src);
    LOG_INF("HF running=%d, src=%d (0=RC,1=XTAL)", running, (int)src);
    nrf_clock_lfclk_t lf_src;
    bool lf_running = nrf_clock_is_running(NRF_CLOCK, NRF_CLOCK_DOMAIN_LFCLK, &lf_src);
    LOG_INF("LF running=%d, src=%d (0=RC,1=XTAL,2=SYNTH)", lf_running, lf_src);

}

Thank you very much for any suggestions!

Parents Reply Children
No Data
Related