nrf5340 External high-speed clock source & Lowpower

Hello,

I have a few questions:
1. How to add a prj.conf or an overlay file to enable peripherals to use an external high-frequency crystal oscillator as the clock source?
        I tested by configuring the device tree as follows, but the high-frequency clock did not take effect. It only works when I add the following code to the application code.

&clock {
    status = "okay";
    lfxo: lfxo {
        // source = "LFXO";
        compatible = "nordic,nrf-lfxo";
        #clock-cells = <0>;
        clock-frequency = <32768>;
        // zephyr,pm-device-runtime-auto;
        status = "okay";
    };

    hfxo: hfxo {
        // source = "HFXO";  
        compatible = "nordic,nrf-hfxo";
        #clock-cells = <0>;
        clock-frequency = <DT_FREQ_M(32)>;
        // zephyr,pm-device-runtime-auto;
        status = "okay";
    };  
};
void hfxo_start(void) {
    // Enable external high-speed 32MHz crystal oscillator
    nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_HFCLKSTART);

    // Wait for the HFXO to stabilize
    while (!nrf_clock_event_check(NRF_CLOCK, NRF_CLOCK_EVENT_HFCLKSTARTED)) {
        // Wait for the event flag
    }
}




2. How can I configure the system to enable the high-frequency external clock to automatically turn on when peripherals are in use and turn off when not in use for low-power management?

Parents Reply Children
Related