This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can the software adjust the internal load capacitance of the nrf5340 crystal oscillator

Hello,

Purpose: Adjust 5340 frequency offset.

I want to use software adjust the internal load capacitance, but I don't know how to do it.

I found this below.

Can you give me some advice?

Parents Reply Children
  • You should be able to use the api in hal/nrf_oscillators.h for that also, see api here:

    /**
     * @brief Function for configuring the internal capacitors of HXFO.
     *
     * The capacitance of internal capacitors ranges from 7 pF to 20 pF in 0.5 pF steps.
     * To calculate the correct @p cap_value, use the following equation:
     * CAPVALUE = (1+FICR->XOSC32MTRIM.SLOPE/16) * (CAPACITANCE*2-14) + FICR->XOSC32MTRIM.OFFSET
     *
     * @param[in] p_reg     Pointer to the structure of registers of the peripheral.
     * @param[in] enable    True if internal capacitors are to be enabled, false otherwise.
     * @param[in] cap_value Value representing capacitance, calculated using provided equation.
     *                      Ignored when internal capacitors are disabled.
     */
    NRF_STATIC_INLINE void nrf_oscillators_hfxo_cap_set(NRF_OSCILLATORS_Type * p_reg,
                                                        bool                   enable,
                                                        uint32_t               cap_value);

    Just call this in the beginning of the application.

Related