NFC PN7160A1 select() not working as expected

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

NFC PN7160A1 select() not working as expected

289 Views
loadit
Contributor I

Hello everyone,


I am currently working on a simple piece of software that uses a PN7160A1 to detect Mifare NFC tags. I am using the Linux kernel driver for this. It works for now. I can use the device /def/nxpnfc to communicate with the chip. I am also already able to read the tags. So the setup seems to be working. But I noticed that the call to select(), which is made before the actual reading, returns immediately. Regardless of whether data is available or not. I got this combination of select() and read() from several examples, such as NfcFacrotyTest, but linux_libnfc-nci also uses it. And it makes sense, because I want to check if the device has data before reading, but it doesn't work. Select returns immediately and then reading blocks until a message arrives. Am I doing something wrong? I also checked the Linux driver, which currently does not support poll. Will this be added at some point, or is there a better way that I am not currently seeing? Does anyone have any advice?

Labels (2)
0 Kudos
Reply
1 Reply

215 Views
jimmychan
NXP TechSupport
NXP TechSupport

FYI.

i.MX6ULL EVK running Yocto Linux + PN7160 - NXP Community

There is the nfcDemoApp. The above link show you how to build it in Yocto. You could take it for reference.

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2175172%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ENFC%20PN7160A1%20select()%20not%20working%20as%20expected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2175172%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20everyone%2C%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20am%20currently%20working%20on%20a%20simple%20piece%20of%20software%20that%20uses%20a%20PN7160A1%20to%20detect%20Mifare%20NFC%20tags.%20I%20am%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FNXPNFCLinux%2Fnxpnfc%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ELinux%20kernel%20driver%3C%2FA%3E%20for%20this.%20It%20works%20for%20now.%20I%20can%20use%20the%20device%20%2Fdef%2Fnxpnfc%20to%20communicate%20with%20the%20chip.%20I%20am%20also%20already%20able%20to%20read%20the%20tags.%20So%20the%20setup%20seems%20to%20be%20working.%20But%20I%20noticed%20that%20the%20call%20to%20select()%2C%20which%20is%20made%20before%20the%20actual%20reading%2C%20returns%20immediately.%20Regardless%20of%20whether%20data%20is%20available%20or%20not.%20I%20got%20this%20combination%20of%20select()%20and%20read()%20from%20several%20examples%2C%20such%20as%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FNXPNFCLinux%2Flinux_NfcFactoryTestApp%2Fblob%2F22348a85d5fcb825bbb2c03581e417d0b933e473%2Ftml_drv.c%23L68%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ENfcFacrotyTest%3C%2FA%3E%2C%20but%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FNXPNFCLinux%2Flinux_libnfc-nci%2Fblob%2F449538e5e106666e5263afeaddacc5836fc23d3f%2Fsrc%2Fhalimpl%2Fpn54x%2Ftml%2Fi2c%2FphTmlNfc_i2c.c%23L367%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Elinux_libnfc-nci%3C%2FA%3E%20also%20uses%20it.%20And%20it%20makes%20sense%2C%20because%20I%20want%20to%20check%20if%20the%20device%20has%20data%20before%20reading%2C%20but%20it%20doesn't%20work.%20Select%20returns%20immediately%20and%20then%20reading%20blocks%20until%20a%20message%20arrives.%20Am%20I%20doing%20something%20wrong%3F%20I%20also%20checked%20the%20Linux%20driver%2C%20which%20currently%20does%20not%20support%20poll.%20Will%20this%20be%20added%20at%20some%20point%2C%20or%20is%20there%20a%20better%20way%20that%20I%20am%20not%20currently%20seeing%3F%20Does%20anyone%20have%20any%20advice%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2175172%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ENFC%20Controller%20Solutions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENFC%20Reader%20Library%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2178643%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20NFC%20PN7160A1%20select()%20not%20working%20as%20expected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2178643%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EFYI.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FNFC-Knowledge-Base%2Fi-MX6ULL-EVK-running-Yocto-Linux-PN7160%2Fta-p%2F1994337%22%20target%3D%22_blank%22%3Ei.MX6ULL%20EVK%20running%20Yocto%20Linux%20%2B%20PN7160%20-%20NXP%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThere%20is%26nbsp%3Bthe%20nfcDemoApp.%20The%20above%20link%20show%20you%20how%20to%20build%20it%20in%20Yocto.%20You%20could%20take%20it%20for%20reference.%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E