NRFX Oscillator will never allow setting bypass for LFXO

In NRFX Oscillator header, accessing the function 

nrf_oscillators_lfxo_bypass_set
 requires the preprocessor macro 
NRF_OSCILLATORS_HAS_LFXO_BYPASS
 which in turn requires preprocessor conditional 
defined(OSCILLATORS_XOSC32KI_Type)

The problem is that final conditional is using the "defined" preprocessor macro to check if a typedef type exists which AFAIK is not valid usage and will always return false.

Tested using nrfconnect sdk 2.6.1 with a blinky project with CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL

#include <hal/nrf_oscillators.h> and then trying to use the function results in the function declaration being not found even though the NRF5340 has the bypass register.

Parents Reply
  • Hi,

    This is indeed a bug. Temporary fix would be to modify it to check the mask instead of the typedef like this:

    #if defined(OSCILLATORS_XOSC32KI_BYPASS_BYPASS_Msk) || defined(__NRFX_DOXYGEN__)
    /** @brief Symbol indicating whether LFXO bypass is present. */
    #define NRF_OSCILLATORS_HAS_LFXO_BYPASS 1
    #else
    #define NRF_OSCILLATORS_HAS_LFXO_BYPASS 0

    regards

    Jared 

Children
Related