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
  • Hello Rob,

    Can you please upload the current application you are using (zip the application folder and drag and drop it here). Then I can see what you have done, and see if I can replicate your issue.

    Best regards,

    Edvin

  • Edvin,

    Our app targets a modified board but here is a hello world app that you can see has the same issue. Look at the third page of the BuildSettings.pdf that I included. You will see that when you break in main the first two gpios are set to Peripheral mode instead of AppMCU even with the changes suggested above. If you can show me how to modify this hello world app make them usable then I should be able to make the same mod to our app.

    Thanks, Rob

    6888.hello.zip 

  • Hello Rob,

    Both Edvin and Håkon are currently out of the office, so I haven’t had a chance to discuss the case with them yet. But I was able to replicate the same problem as you. And like you, I don’t see any way to prevent LFXO_CAP from being defined by making changes to Kconfig or the devicetree. I see Håkon already created a bug report in our internal bug tracker about this issue. I will add to this report that just deleting the lfxo node may not be sufficient.

    Are you able to work around this issue for now by patching the SDK file(s) or by calling nrf_gpio_pin_control_select() again from the app?

    Best regards,

    Vidar

  • Vidar,

    Currently we are patching the SDK until we find a solution. Thanks for the update.

    Rob

Reply Children
No Data
Related