NFC

Материал из Wiren Board
Это утверждённая версия страницы. Она же — наиболее свежая версия.
Другие языки:


Hardware

NXP chip is used PN532/en. The chip is connected via SPI. GPIO is used as chip select.

Software

The chip is supported by the library libnfc, starting with release 1.7.0. Backport to Debian Wheezy: [1], by default in a standard way.

Work is done in userspace using spidev. By default when using the default dts file using device /dev/spidev1.4. Default config: [2].


Examples

The list of cards in the scope area

root@wirenboard:~# nfc-list 
nfc-list uses libnfc 1.7.0
NFC device: pn532_spi:/dev/spidev1.4 opened
1 ISO14443A passive target(s) found:
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  44  
       UID (NFCID1): 04  f7  04  1a  0d  28  86  
      SAK (SEL_RES): 00  

Reading Mifare Ultralight

One-time tickets of the Moscow metro -Mifare UL cards.

root@wirenboard:~# nfc-mfultralight r dump.mfd
NFC device: pn532_spi:/dev/spidev1.4 opened
Found MIFARE Ultralight card with UID: 04f7041a0d2886
Reading 16 pages |................|
Done, 16 of 16 pages readed.
Writing data to file: dump.mfd ... Done.

Python

To work with NFC from Python, you need to use bindings for libnfc. See example https://github.com/contactless/wirenboard/tree/master/examples/nfc/python on github.

C/C++

Examples of working with libnfc in utilities provided with libnfc: http://code.google.com/p/libnfc/source/browse/#git%2Fexamples