nRF5340: best way to configure P0.02 (NFCT) as GPIO with TFM

Hello,

We have an nRF5340 (custom PCB) application, based on NCS 2.6, that uses the TFM and needs to use P0.02 (NFCT) as SPI CS.

Currently, the CS is not moving, since the pin is by default assigned as NFCT.

I am unsure what is the best way to let it be used as SPI CS: CONFIG_NFCT_PINS_AS_GPIOS has been deprecated and the deprecation note advises to use &uicr { nfct-pins-as-gpios; }; instead.However this property is not available in the non-secure device tree for the nRF5340, since the non-secure domain can't access the UICR.

This devzone post seems relevant, but also out of date: it seems that at the time the "proper solution" was to set CONFIG_NFCT_PINS_AS_GPIOS=y, which was affected by a bug that made it not propagate to the TFM. The lack of propagation has been fixed since, but meanwhile CONFIG_NFCT_PINS_AS_GPIOS has been deprecated. 

Setting CONFIG_NFCT_PINS_AS_GPIOS seems to work, but since it's deprecated I am worried that this might break soon. Is there a different, "officially supported" way to get the TFM to configure P0.02 as GPIO?

Parents Reply
  • So this was unfortunately not resolved for 2.6. We have a fix that got merged in 2.7 with the ‘correct’ way of configuring this that will be supported in the future in this PR here:

    https://github.com/nrfconnect/sdk-nrf/pull/14228

    The way to do this with this PR is that you just enable or disable the nfct device in the overlay of the non secure board.
    So by default the NFCT as GPIOS will be enabled since the device is disabled. In case you want to use the NFCT device you will have to enable it in the non secure overlay like this:

    &nfct { status = "okay";

    };

    This will basically automatically disable the NFCT as GPIOS option since you are using the NFCT device.

Children
Related