PN7160 with nRF52840

Hello,

I’m using an external NFC reader/controller (NXP PN7160A1HN/C100E) connected via I2C to an nRF52840 module (Raytac MDBT50Q-1MV2) on a custom PCB. (Programming is via SWD using an nRF52840 DK as the debug probe.) 

My current software environment is nRF Connect SDK (NCS) v3.2.0 in VS Code (Windows 11) and Zephyr RTOS v4.2.99. The goal is to start RF discovery and read the UID of a 13.56 MHz passive card using the PN7160 (NCI-over-I2C).

I attempted to integrate PN7160 the “typical Zephyr way” by only editing:

  • src/main.c

  • boards/nrf52840dk_nrf52840.overlay

  • prj.conf

I can configure the I2C pins and PN7160 GPIOs (VEN/IRQ), but initialization is failing (I2C -EIO/NACK during probe or first command), and I’m not sure if my integration approach is correct.

Questions:

  1. In NCS/Zephyr, is it possible to programm PN7160 by only changing `main.c` + `nrf52840dk_nrf52840.overlay` + `prj.conf`, or is it expected that PN7160 requires a proper custom driver?

  2. If a driver is required: what is the recommended approach in NCS to add it (devicetree binding YAML + Kconfig + CMake + driver source), and should it be packaged as an external Zephyr module (zephyr/module.yml + EXTRA_ZEPHYR_MODULES)? Are there example codes how to do this (like a public github repo, I namely could not find it)?

  3. Are there known NCS v3.2.0 / Zephyr 4.2.99 I2C/TWIM behaviors that can cause -EIO on probing/first writes that I should handle differently?

If you have any other handy comments that would help, I’d appreciate them

Thank you!

  • Is the custom board here also the same? The only difference being you having swapped the ESP32-C3 for a nRF52840 module?

    Yes — the hardware is the same. The only difference is the I2C pin mapping on the MCU side. However, I can scan the bus and the PN7160 responds at 0x28, and my other I2C peripherals also show up correctly, so basic I2C connectivity seems OK.

    Have you tested that the overlay files you use for this module etc. works okay though? So you have tried doing other things with this nRF module, like BLE and flashing an LED etc?

    Yes, I’ve validated the nRF52840 setup separately. I can flash firmware reliably and I’ve tested other functions (e.g., blinking an LED and communicating with other peripherals (also via I2C)), and those work as expected. So the MCU + board config appears to be fine.

    I have also measured every NFC pin from the old board where the nfc worked (where I also have the same layout) and have compared that to my current NFC on my PCB. And the weird thing is that even the current is the same. 

    Because of that, I currently suspect the issue is in my custom PN7160 driver implementation (IRQ polarity/pull/edge handling or the NCI-over-I2C read/response framing), rather than a hardware fault.

  • I see, yeah this might be.

    Have you gotten a logic trace yet?

    Regards,

    Elfving

Related