nRF54L15 - NFCT Pins as GPIO with TF-M

Good day,

I'm trying to use pin 1.02 as a GPIO in a TF-M build using a (custom) non-secure board target, and I'm struggling to find the appropriate way to accomplish this. 

All current resources point to deprecated Kconfig defines (USE_NFCT_PINS_AS_GPIO), do not support non-secure targets (uisng the &uicr node in devicetree), are for older SoCs (

TFM_NFCT_PINS_AS_GPIOS only applies to nRF5340 according to v2.9.0 SDK). The only working option I've found is to edit the NFCT PADCONFIG register (which worked); are there any other options?

Thank you
Kind regards,
Mark Laloo
Parents
  • Hi Mark,

    Referring to this earlier DevZone case:  nRF5340: best way to configure P0.02 (NFCT) as GPIO with TFM .

    As long as the NFC node is disabled in DeviceTree on the non-secure target, P1.02 will be enabled as a GPIO pin by default.

    Best regards,

    Hieu

  • HI Hieu,

    Thanks for the response. I've seen this post before, with no luck. 

    I've tried disabled the NFC node using:

    &nfct {
        status = "disabled";
    };

    in board_nrf54l15_cpuapp_ns.dts, and after testing again, this does not solve the issue. Debugging in VSCode/Ozone and inspecting the registers, PADCONFIG is still enabled in the NFCT_NS register, and the pin does not function as a GPIO unless I manually disable. Worth noting, the TFM_NFCT_PINS_AS_GPIO appears to target only the 5340 SoC. Is there perhaps something I'm missing alongside the NFCT node change in devicetree?

    Kind regards,
    Mark Laloo 
  • Hi Justin and Mark,

    Sorry for the late reply. I broke the environment on my machines and can't test anything for a while.

    That is fixed now, but I still can't reproduce your issue with NVS v3.1.1.

    Do you have a minimal setup I can reproduce the issue with?

    Here is my copy of modified zephyr/samples/basic/blinky sample, where P1.02 works as expected.

    c339307-251106_01.zip

    Best regards,

    Hieu

  • Hi Hieu,

    Sorry for the delay, We only have one nRF54L15 dev kit laying around and we modified it to function exactly as in the prototype hardware so getting an exact working example is difficult and I also do not have enough time to prepare a minimal repoducable example.

    I cut and soldered the connections such that the external 32kHz crystal is disconnected and redirected to the IO headers just like the NFC pins. I use the dev kit board files as base with an overlay file to redirect the debug uart pins on the P1 block to other pins since I needed the default UART pins for different connections. My project Kconfig contains some additional configurations to enable the internal RC oscilator.

    I attempted to write the PADCONFIG register in the main function while in secured and non-secured to attempt to change it with the mentioned results. The results reflect the same on the prototype hardware in that we are unable to change the register in non-secured mode.

    Sadly I do not have enough time to dive much deeper since we internally decided to just use different pins and avoid the problem in our next revision of the hardware. If required I can provide more information but I do not have the time to setup a dev kit for further testing.

    Sadly it is not a quick fix and you provided good support but we need to continue.

    Kind regards,
    Justin Verkade

  • Hi Justin,

    No problem. I too agree that choosing a less special pin is the best way forward. Would also limit the amount of change necessary if one day in the future, NFC is considered.

    Please just let me know if the issue becomes bothersome again in the future.

    -----------------------

    Hi Mark,

    If the issue is blocking your project, please let me know.

    Best regards,

    Hieu

  • Hi Hieu,
    I am trying to use P1.02 and P1.03 as PWM outputs on a custom board that I developed. Now I am running into the same issue, that disabling NFC does not release these two GPIOs. As I need 8 Analog inputs and 7 analog outputs I used all GPIOs from P1 and cannot simply change the PIN. Could you please assist me in solving that issue?
    Do you have any news from the DeviceTree team working on this?

    Thank you in advance!

    Best regards,

    Walter

  • Hi Hieu,

    I was able to fix the issue by deleting the PADCONFIG bit manually like suggested by you. I used:

    static int disable_nfc_pads_early(const struct device *unused)
    {
        ARG_UNUSED(unused);
    
        /* Clear the PADCONFIG bit so the NFC pads stop being forced to NFC */
        NRF_NFCT_NS->PADCONFIG = 0;   /* Use NRF_NFCT_NS if called from non-secure */
        return 0;
    }
    
    /* Run before GPIO and pinctrl take effect */
    SYS_INIT(disable_nfc_pads_early, PRE_KERNEL_1, 0);

    Br

    Walter

Reply
  • Hi Hieu,

    I was able to fix the issue by deleting the PADCONFIG bit manually like suggested by you. I used:

    static int disable_nfc_pads_early(const struct device *unused)
    {
        ARG_UNUSED(unused);
    
        /* Clear the PADCONFIG bit so the NFC pads stop being forced to NFC */
        NRF_NFCT_NS->PADCONFIG = 0;   /* Use NRF_NFCT_NS if called from non-secure */
        return 0;
    }
    
    /* Run before GPIO and pinctrl take effect */
    SYS_INIT(disable_nfc_pads_early, PRE_KERNEL_1, 0);

    Br

    Walter

Children
No Data
Related