CONFIG_NFCT_PINS_AS_GPIOS=y doesn't work

Hi,

I'm using an ISP2053 (nrf5340) chip on a custom board and debugging using the nrf5340dk. I'd like to use P0.02, P0.03 as part of an SPI bus.

I set up a simple experiment where I set `CONFIG_NFCT_PINS_AS_GPIOS=y` in my prj.conf and some code to toggle various pins that I can read on my board. P0.02 and P0.03 are always 0V and other pins toggle between 0V and 3V.

I believe the NFCPINS UICR register (0x00FF8028) should read 0xFFFFFFFE but using nrfjprog I can see that the register reads 0xFFFFFFFF:

```

nrfjprog --memrd 0x00FF8028
0x00FF8028: FFFFFFFF |....|

```

After I flash the code using nrfconnect vscode, I can set the register to 0xFFFFFFFE:
```

nrfjprog --memwr 0x00FF8028 --val 0xFFFFFFFE
Parsing parameters.
Writing.

nrfjprog --memrd 0x00FF8028
0x00FF8028: FFFFFFFE |....|
```

Now the NFC GPIO pins toggle on and off like the other pins.
Is this intended? It seems like CONFIG_NFCT_PINS_AS_GPIOS=y doesn't change the register value. I can see in Guiconfig, the `NFCT pins as GPIO` option is selected. Other options in prj.conf work.
I'd prefer not have to run `nrfjprog --memwr 0x00FF8028 --val 0xFFFFFFFE` when flashing. How do I diagnose the problem further?
I'm using ncs v2.1.1.
Parents Reply
  • Found something important not covered in any of the tickets I've seen on this:

    1. CONFIG_NFCT_PINS_AS_GPIOS=y is required

    2. Power cycling the board (as opposed to simply resetting it after a firmware update) was necessary to change the NFC pin state.

    It's not clear to me if there's a different route to making the NFC peripheral transition modes without requiring a power cycle, but this was sufficient to correct the issue.

    To Nico7's question, SYS_INIT is a macro from include/zephyr/init.h that allows initialization code to run before main.  It's important to know where it's being used in modules since an error in a SYS_INIT registered function can be hard to debug otherwise.

Children
No Data
Related