NRFX Oscillator will never allow setting bypass for LFXO

In NRFX Oscillator header, accessing the function 

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

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
  • Hi there,

    I think you're right, let me double check with the developers.

    In meantime you can try to set the register directly instead.

    regards

    Jared 

Reply
  • Hi there,

    I think you're right, let me double check with the developers.

    In meantime you can try to set the register directly instead.

    regards

    Jared 

Children
  • Modifying the register directly produces expected results. Glad the feedback is making its way through the channels. Thanks!

  • Hi,

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

    Fullscreen
    1
    2
    3
    4
    5
    #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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    regards

    Jared 

  • Hi Jared, I am wondering when this fix will be in the main branches of the nrfx repo? NCS 2.7.0 released and this bug still appears to be present.

  • Hi, 

    Let me check with the developers again,

    I'll be back with more,

    regards

    Jared 

  • Hi,

    Indeed it doesnt look like it was included in the nrfx version that is included with NCS v2.7.0. But the fix has been added in nrfx 3.6.0, so you can pull that version of nrfx.

    regards

    Jared