PN7160 with nRF52840

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PN7160 with nRF52840

309 Views
newtechlearner
Contributor I

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) resulting that my whole RF discovery does not work, 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.

Thanks in advance for your help!

0 Kudos
Reply
0 Replies
%3CLINGO-SUB%20id%3D%22lingo-sub-2270902%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPN7160%20with%20nRF52840%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270902%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EHello%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%E2%80%99m%20using%20an%20external%20NFC%20reader%2Fcontroller%20(NXP%20PN7160A1HN%2FC100E)%20connected%20via%20I2C%20to%20an%20nRF52840%20module%20(Raytac%20MDBT50Q-1MV2)%20on%20a%20custom%20PCB.%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E(Programming%20is%20via%20SWD%20using%20an%20nRF52840%20DK%20as%20the%20debug%20probe.)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EMy%20current%20software%20environment%20is%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EnRF%20Connect%20SDK%20(NCS)%20v3.2.0%20in%20VS%20Code%20(Windows%2011)%20and%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EZephyr%20RTOS%20v4.2.99.%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EThe%20goal%20is%20to%26nbsp%3Bstart%20RF%20discovery%20and%20read%20the%20UID%20of%20a%2013.56%20MHz%20passive%20card%20using%20the%20PN7160%20(NCI-over-I2C).%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%20attempted%20to%20integrate%20PN7160%20the%20%E2%80%9Ctypical%20Zephyr%20way%E2%80%9D%20by%20only%20editing%3A%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3Esrc%2Fmain.c%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3Eboards%2Fnrf52840dk_nrf52840.overlay%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3Eprj.conf%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%20can%20configure%20the%20I2C%20pins%20and%20PN7160%20GPIOs%20(VEN%2FIRQ)%2C%20but%20initialization%20is%20failing%20(I2C%20-EIO%2FNACK%20during%20probe%20or%20first%20command)%20resulting%20that%20my%20whole%20RF%20discovery%20does%20not%20work%2C%20and%20I%E2%80%99m%20not%20sure%20if%20my%20integration%20approach%20is%20correct.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EQuestions%3A%3C%2FSPAN%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EIn%20NCS%2FZephyr%2C%20is%20it%20possible%20to%20programm%20PN7160%20by%20only%20changing%20%60main.c%60%20%2B%20%60nrf52840dk_nrf52840.overlay%60%20%2B%20%60prj.conf%60%2C%20or%20is%20it%20expected%20that%20PN7160%20requires%20a%20proper%20custom%20driver%3F%20%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EIf%20a%20driver%20is%20required%3A%20what%20is%20the%20recommended%20approach%20in%20NCS%20to%20add%20it%20(devicetree%20binding%20YAML%20%2B%20Kconfig%20%2B%20CMake%20%2B%20driver%20source)%2C%20and%20should%20it%20be%20packaged%20as%20an%20external%20Zephyr%20module%20(zephyr%2Fmodule.yml%20%2B%20EXTRA_ZEPHYR_MODULES)%3F%20Are%20there%20example%20codes%20how%20to%20do%20this%20(like%20a%20public%20github%20repo%2C%20I%20namely%20could%20not%20find%20it)%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EAre%20there%20known%20NCS%20v3.2.0%20%2F%20Zephyr%204.2.99%20I2C%2FTWIM%20behaviors%20that%20can%20cause%20-EIO%20on%20probing%2Ffirst%20writes%20that%20I%20should%20handle%20differently%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%3EIf%20you%20have%20any%20other%20handy%20comments%20that%20would%20help%2C%20I%E2%80%99d%20appreciate%20them.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20in%20advance%20for%20your%20help!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E