Configuring NRF NFC as I2C

I am having trouble reconfiguring NFC pins on NRF devices as an I2C interface. Following the I2C example (from here), I was able to communicate with an I2C device on the nrf52dk, and I was able to change the pins in pinctrl.dtsi to modify which pins were used for I2C. When I change to pins P0.09 and P0.10, the NFC pins, and adjust hardware accordingly, the write-read command to check the "WHO-AM-I" register fails with a negative return value. I am looking for a solution as my custom board, built off the NRF52833-QDAA chip, currently has I2C hardwired to P0.09 and P0.10. as I didn't realize there would be configuration issues. 

Most questions on here point to the configuration "CONFIG_NFCT_PINS_AS_GPIOS" which is deprecated - I included "nfct-pins-as-gpios;" in &uicr in the devicetree file.

Test device is an MPU 6050, same issue on the custom board with a ICM 42688.

nrf52dk: PCA10040 3.0.0
NRF Toolchain/Connect SDK 2.6.0 
VS Code on Windows 10

  • Hi

    Can you confirm what .dts/overlay file you have set the nfct-pins-as-gpios in, and confirm that it is as the following:

    &uicr {
        nfct-pins-as-gpios;
    };
    Also, what return value does the WHO-AM-I register fail with? That might point us in the direction with an error code. Lastly, I see that you mention both the nRF52833 and nRF52832 SoCs. I assume you are initially trying to build and run this sample on the nRF52832 DK with the nrf52dk_nrf52832 board as the build target? If so, add the nfct-pins-as-gpios; as a .overlay file to your project to correctly use the NFC pins as GPIOS.

    Best regards,

    Simon

  • Yes, I added "nfct-pins-as-gpios" to &uicr in nrf52dk_nrf52832.dts, as the "gpio-as-nreset" parameter was already there. I also tried adding it to the corresponding overlay file, nrf52dk_nrf52832.overlay, without success. I2C fails with return value -5. And yes, I have two build configurations, one for each SoC- I have code running on both, it's just the I2C on the NFC pins that's been the issue.

  • Okay, one thing we might have missed. To use the P0.09 and P0.10 as GPIOs on the nRF52832 DK, you will need to change the following on the DK itself: R25 and R26 must be not connected (NC) and R27 and R28 must be shorted with an OR resistor. By default, this is inversed, so moving the resistors on R25 and R26 to R27 and R28 should be sufficient. The other thing I can think of is that you need to do a pristine build after making changes to overlay files/configs in your NCS application.

    Best regards,

    Simon

  • Thanks for the update- I was able to move those resistors, and ran Blinky on each pin- P0.10 was only hitting 0.6V when high. I retried the I2C connection using P0.09 and P0.12, and it worked, indicating that the config option was working as intended. I then tried the same blink exercise on my custom board - P0.09 wasn't working correctly. Tried a different board than my main test PCB and it worked like a charm. Seems like I was dealing with a bad/fried connection on both the DK and my custom board. Thanks for the help working through this!

  • Okay, glad to hear you seem to have figured it out. Let me know if there's anything else we can do for you!

    Best regards,

    Simon

Related