nfc-tools / libnfc

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

Unable to read ACK PN532 breakout board USB to UART #500

Closed GRBaset closed 6 years ago

GRBaset commented 6 years ago

Hello, I have a problem with my PN532 breakout board. I've already checked with Arduino and both I2C and HSU (UART) work correctly. Unfortunately, when I connect it to USB - UART converter and use nfc-list or nfc-poll, the following error appears:

debug   libnfc.config   key: [allow_autoscan], value: [true]
debug   libnfc.config   Parse error on line #5:

debug   libnfc.config   key: [allow_intrusive_scan], value: [false]
debug   libnfc.config   Parse error on line #10:

debug   libnfc.config   key: [log_level], value: [2]
debug   libnfc.config   Parse error on line #15:

debug   libnfc.config   key: [device.name], value: [PN532 NFC Board on Arduino]
debug   libnfc.config   key: [device.connstring], value: [pn532_uart:/dev/cu.usbmodem14321:230400]
debug   libnfc.general  log_level is set to 3
debug   libnfc.general  allow_autoscan is set to true
debug   libnfc.general  allow_intrusive_scan is set to false
debug   libnfc.general  1 device(s) defined by user
debug   libnfc.general    #0 name: "PN532 NFC Board on Arduino", connstring: "pn532_uart:/dev/cu.usbmodem14321:230400"
/Users/gabrielroca/libnfc/utils/.libs/nfc-list uses libnfc libnfc-1.7.0
debug   libnfc.general  0 device(s) found using acr122_usb driver
debug   libnfc.general  0 device(s) found using pn53x_usb driver
debug   libnfc.driver.pn532_uart    Attempt to open: /dev/cu.usbmodem14321 at 230400 bauds.
debug   libnfc.bus.uart Serial port speed requested to be set to 230400 bauds.
debug   libnfc.chip.pn53x   Diagnose
debug   libnfc.chip.pn53x   Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x   SAMConfiguration
debug   libnfc.chip.pn53x   Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart    Unable to read ACK
pn53x_check_communication: Timeout
debug   libnfc.chip.pn53x   InRelease
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 52 00 da 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart    Unable to read ACK
debug   libnfc.general  Unable to open "pn532_uart:/dev/cu.usbmodem14321:230400".
nfc-list: ERROR: Unable to open NFC device: pn532_uart:/dev/cu.usbmodem14321:230400

I've tried Arduino UNO with blank program, directly to the RX and TX pins, FTDI (the board has an FTDI pin header connector) and Arduino DUE Serial1 - Serial passthrough (Serial1 at 115200 baud and Serial at 230400 baud). I've tried swapping TX and RX and nothing as well. I'm on macOS High Sierra 10.13.6. I've tried the latest commit, version 1.7.1 and version 1.7.0. I've also tried the patch from http://nfc-tools.org/index.php/Libnfc:Arduino, and nothing.

GRBaset commented 6 years ago

I've solved it. I shouldn't have used 230400 baud for the Serial. The two Serials had to be the same speed (115200 baud)! However, I have no idea about why it didn't work with the Arduino UNO or the FTDI board.