nfc-tools / libnfc

Platform independent Near Field Communication (NFC) library
http://nfc-tools.org
GNU Lesser General Public License v3.0
1.71k stars 442 forks source link

nfc-emulate-tag crash pn532 #477

Open edmundhei opened 6 years ago

edmundhei commented 6 years ago

When I use nfc-emulate-tag to emulate a tag and read the tag with my galaxy note 3, the note3 did able to read the tag successfully but the programme exit with error and crash the pn532 which is really confused me.

pi@raspberrypi:~/libnfc-1.7.1 $ nfc-emulate-tag 
nfc-emulate-tag uses libnfc 1.7.1
NFC device: pn532_i2c:/dev/i2c-1 opened
nfc-emulate-tag will emulate this ISO14443-A tag:
ISO/IEC 14443A (undefined baud rate) target:
    ATQA (SENS_RES): 00  04  
* UID size: single
* bit frame anticollision supported
       UID (NFCID3): 08  ab  cd  ef  
* Random UID
      SAK (SEL_RES): 09  
* Not compliant with ISO/IEC 14443-4
* Not compliant with ISO/IEC 18092

Fingerprinting based on MIFARE type Identification Procedure:
* MIFARE Mini 0.3K
* SmartMX with MIFARE 1K emulation
Other possible matches based on ATQA & SAK values:
NFC device (configured as target) is now emulating the tag, please touch it with a second NFC device (initiator)
nfc_target_init: Success
nfc_target_emulate_tag: Success
error   libnfc.bus.i2c  Error: wrote only -1 bytes (10 expected).
error   libnfc.driver.pn532_i2c Unable to transmit data. (TX)

Unless i unplug it otherwise it is not useable

.

pi@raspberrypi:~/libnfc-1.7.1 $ nfc-emulate-tag 
nfc-emulate-tag uses libnfc 1.7.1
error   libnfc.bus.i2c  Error: wrote only -1 bytes (10 expected).
error   libnfc.driver.pn532_i2c Unable to transmit data. (TX)
pn53x_check_communication: Input / Output Error
error   libnfc.bus.i2c  Error: wrote only -1 bytes (10 expected).
error   libnfc.driver.pn532_i2c Unable to transmit data. (TX)
nfc-emulate-tag: ERROR: Unable to open NFC device
chelinho139 commented 6 years ago

@edmundhei +1 any updates on this? thanks

Norbz commented 5 years ago

Same thing here...

lmckoko-ericsson commented 5 years ago

Same error, does anyone have an update?

actually, the error also happens when running command nfc-list, at the end of the printout we see

error libnfc.bus.i2c Error: wrote only -1 bytes (19 expected).

Thanks!

Jupiops commented 4 years ago

Same error here on Raspi 4 connecting the pn532 board using I2C. Connecting the board over SPI solved the problem for me, but if I read the emulated Tag with my Android phone the tag has allways the UID 00::00 Screenshot_20191221-215425_NFC Tools PRO

andresmihkelson commented 2 years ago

I also ran into this using PN532 over I2C on a Raspberry Pi Zero W. If there is any information how one should approach this, I could do a bit of debugging.