Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Enabling NFC when using TFM

This has been resolved, but resolving this issue took quite a bit effort:

I was wondering why my NFC was not working on my custom board. First I thought it would be an antenna matching issue and we made improvements. But it didn't help although the matching looked ok. Then I thought that it must be something with the sw. Unfortanetely I had only nRF52dk in my hands, and (simplified verstion) of the sw worked fine on that board.

In the end the problem turned out the be in the TFM. The KConfig has

config TFM_NFCT_PINS_AS_GPIOS
    bool
    default y if !DT_HAS_NORDIC_NRF_NFCT_ENABLED
    depends on SOC_NRF5340_CPUAPP
    help
      Two pins are usually reserved for NFC in SoCs that implement the
      NFCT peripheral. This option switches them to normal GPIO mode.
      HW enabling happens once in the device lifetime, during the first
      system startup. Disabling this option will not switch back these
      pins to NFCT mode. Doing this requires UICR erase prior to
      flashing device using the image which has this option disabled.

      NFC pins in nRF5340: P0.02 and P0.03

      TF-M configures these pins as GPIOS when the NFCT peripheral is not
      enabled in the device-tree of the target.

So, you will need tfm.overlay where you enable the NFC (and make sure that the overlay file is been used in the build). Enabling the NFC in the main application is not enough. 

This is quite annoying, for example because UICR documentation says that the NFC pins are functioning as NFC by default.

I don't know how, but this shuold be documented better. And not only in TFM documentation, but in general inside NFC documentation.

 

Parents
  • Hi Veli-Pekka,

    Thanks for contacting us and description regarding the documentation. I will forward it to relevant team for improvement. As you figured it out r
    elying only on UICR defaults or enabling NFC in the non‑secure app dts/Kconfig is not enough when TF‑M is present, because TF‑M owns the hardware configuration for NFC.



    Best regards,
    Ressa

Reply
  • Hi Veli-Pekka,

    Thanks for contacting us and description regarding the documentation. I will forward it to relevant team for improvement. As you figured it out r
    elying only on UICR defaults or enabling NFC in the non‑secure app dts/Kconfig is not enough when TF‑M is present, because TF‑M owns the hardware configuration for NFC.



    Best regards,
    Ressa

Children
No Data
Related