Configuring PIN 0.00 and P0.01 as GPIO on NRF5340 with nrf connect sdk v3.0.2

Hello,

We upgraded our project to nrf connect sdk v3.0.2 from v2.9.0 and can no longer use pin 0.00 and pin 0.01 as gpio. The problem seems to be in the nrf53 soc.c file. In v2.9.0 I could just disable LFXO using CONFIG_SOC_ENABLE_LFXO=n and then use the pins as gpio. In v3.0.2 looking at nrf53/soc.c it seems you are to use the dts, but doesn't seem possible to disable the LFXO_NODE define and so the pins get set to peripheral. Every define path ends up setting LFXO_NODE.. I'm probably missing something simple here, can someone point me in the right direction? Maybe give me a dts snippet that allows for gpio on pins 0.00 and 0.01?

Thanks Rob

nrf53/soc.c

#ifdef CONFIG_SOC_NRF5340_CPUAPP
#define LFXO_NODE DT_NODELABEL(lfxo)
#define HFXO_NODE DT_NODELABEL(hfxo)

/* LFXO config from DT */
#if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, external)
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_EXTERNAL
#elif DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal)
#define LFXO_CAP (DT_ENUM_IDX(LFXO_NODE, load_capacitance_picofarad) + 1U)
#else
/* LFXO config from legacy Kconfig */
#if defined(CONFIG_SOC_LFXO_CAP_INT_6PF)
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_6PF
#elif defined(CONFIG_SOC_LFXO_CAP_INT_7PF)
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_7PF
#elif defined(CONFIG_SOC_LFXO_CAP_INT_9PF)
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_9PF
#else
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_EXTERNAL
#endif
#endif

....

#ifdef CONFIG_SOC_NRF5340_CPUAPP
#if defined(LFXO_CAP)
nrf_oscillators_lfxo_cap_set(NRF_OSCILLATORS, LFXO_CAP);
#if !defined(CONFIG_BUILD_WITH_TFM)
/* This can only be done from secure code.
* This is handled by the TF-M platform so we skip it when TF-M is
* enabled.
*/
nrf_gpio_pin_control_select(PIN_XL1, NRF_GPIO_PIN_SEL_PERIPHERAL);
nrf_gpio_pin_control_select(PIN_XL2, NRF_GPIO_PIN_SEL_PERIPHERAL);
#endif /* !defined(CONFIG_BUILD_WITH_TFM) */
#endif /* defined(LFXO_CAP) */

Parents
  • Hi,

     

    We upgraded our project to nrf connect sdk v3.0.2 from v2.9.0 and can no longer use pin 0.00 and pin 0.01 as gpio.

    Recently, the configuration of the external LFXO load caps has been moved to DTS.

    This requires you then to remove the lfxo node:

    /delete-node/ &lfxo;

    And this is required to configure it to the internal 32k RC oscillator:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

    Could you try this and see if this now works on your side?

     

    There is an unfortunate mix of kconfig and device tree here, which I do acknowledge and will bring up internally.

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    We upgraded our project to nrf connect sdk v3.0.2 from v2.9.0 and can no longer use pin 0.00 and pin 0.01 as gpio.

    Recently, the configuration of the external LFXO load caps has been moved to DTS.

    This requires you then to remove the lfxo node:

    /delete-node/ &lfxo;

    And this is required to configure it to the internal 32k RC oscillator:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

    Could you try this and see if this now works on your side?

     

    There is an unfortunate mix of kconfig and device tree here, which I do acknowledge and will bring up internally.

     

    Kind regards,

    Håkon

Children
No Data
Related