Use B404X NFC pins as GPIO

Hi everyone,

Does anyone know if it’s possible to use the NFC pins on the B404X as GPIO?

1 Like

It's not recommended. It can be done because the E404X and Monitor One use the pins as GPIO, however.

When the pins are in NFC mode there's a diode inside the nRF52 MCU that kicks in when the voltage differential between NFC1 and NFC2 is greater than 2.0V. This is designed to protect the MCU from induced voltage from the NFC coils, but obviously would have bad side effects if using as GPIO. The NFC setting is stored in the UICR bytes in the nRF52840 MCU flash and can be written with a SWD programmer.

So basically you need to change the values of the UICR bytes with an SWD programmer, then you can use the NFC pins as GPIO.

Thanks, rickkas7. Is this something I can do with the SoM M.2 eval board or do I need a separate SWD programmer?

Could you describe in more detail which files I'll need to change and flash? Or point me towards some resources? I'd really appreciate it.

You need a CMSIS/DAP debugger or Segger J-LINK in order to set the UICR bytes in the nRF52840 MCU.

The NFC function is at offset 0x20C. The default value is enabled (0xffffffff) and to disable NFC, set bit 0 to 0, so 0xfffffffe. There's more information in the Nordic UICR documentation.

The offset is relative to the UICR base address 0x10001000, but the exact way to set it depends on which tool you are using. If you diff the hex files for most devices and the esomx, there are two differences. The second one is the NFC bits (0xffffffff vs. 0xfffffffe).

diff uicr_no_eof.hex esomx_uicr_no_eof.hex 
3c3
< :10101000FFFFFFFF00400F00FFFFFFFFFFFFFFFF8D
---
> :10101000FFFFFFFF00400F0000F00200FFFFFFFF97
34c34
< :101200001200000012000000FFFFFFFFFFFFFFFFC2
---
> :101200001200000012000000FFFFFFFFFEFFFFFFC3

The last byte difference on each line is the checksum for the hex file line.

Thanks for the details! I'll let you know if I hit any walls when I try this out.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.