3

I am trying to discover why my Pi 3 is not able to communicate with PN532 NFC module.

I'm using a couple of libraries to do it (libnfc and NPM PN532), but it's not working.

I followed the steps of the folowing answer and other sites, but I still having problems.

link: How do I make serial work on the Raspberry Pi3

The only difference that I have to the answers I've consulted are in my file /boot/cmdline.txt:

My:

dwc_otg.lpm_enable=0  console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

Answers:

dwc_otg.lpm_enable=0  console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

Does anyone had this error in your new Raspberry Pi 3? Thak's for your attention to my question.

Note:

Error in libnfc:

pn53x_check_communication: Success
error   libnfc.driver.pn532_uart    Unable to transmit data. (TX)
lt-nfc-poll: ERROR: Unable to open NFC device.

NPM PN532: Keeps idling in this message:

debug: [frame-emitter] listening to data
debug: [hsu] Initializing serial port...
debug: [hsu] Serial port initialized.
info: [pn532] Configuring secure access module (SAM)...
debug: [pn532] Sending buffer: <Buffer xx xx xx xx xx xx xx xx xx xx>
debug: [hsu] Waking up PN532...
  • Can you share dmesg output while running your nfc-poll ? – vaha Oct 18 '16 at 18:38
3

Steps to install NFC PN532

  • The Raspberry pi 3 has changed things around a bit: ttyAMA0 now refers to the serial port that is connected to the bluetooth. The old serial port is now called ttyS0. So if you have an RPI3, everywhere you see ttyAMA0 below, you should read ttyS0

    So:

    • The /dev/ttyAMA0 previously used to access the UART now connects to Bluetooth.

    • The miniUART is now available on /dev/ttyS0.


  • There is one killer feature "Baudrate derived from system clock" which makes the miniUART useless as the this clock can change dynamically. ** Modifying the /boot/config.txt removes this dependency by adding the following line at the end:
    core_freq=250
    This fixes the problem and appears to have little impact. The SPI clock frequency and ARM Timer are also dependent on the system clock.

  • For some bizarre reason the default for Pi3 using the latest 4.4.9 kernel is to DISABLE UART. To enable it you need to change enable_uart=1 in /boot/config.txt.

    This also fixes the core_freq so that's no longer necessary.


  • The kernel will use the port as controlled by kernel command line contained in /boot/cmdline.txt. The file will look something like this:
    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
  • The console keyword outputs messages during boot, and the kgdboc keyword enables kernel debugging. You will need to remove all references to ttyAMA0. So, for the example above /boot/cmdline.txt, should contain:
    dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

  • Disable console on UART
    raspi-config -> Advanced Options -> Serial

You must be root on PI to edit this (e.g. use sudo nano /boot/cmdline.txt or sudo raspi-config). Be careful doing this, because a faulty command line can prevent the system booting.

1

I cannot say anything about the changes you have done according to the link you shared (How do I make serial work on the Raspberry Pi3).

In Rassperry Pi 3, /dev/ttyAMA0 points to the serial point connected to bluetooth. UART is moved to /dev/ttyS0.

I suggest you to

  • rollback what you have already done, because those changes might have broken some standard configurations.
  • disable console on UART (raspi-config -> Advanced Options -> Serial).
  • set enable_uart=1 in /boot/config.txt, because the previous step sets enable_uart=0 which causes /dev/ttyS0 to disappear.
  • set pn532_uart:/dev/ttyS0 instead /dev/ttyAMA0 in /etc/nfc/libnfc.conf. libnfc may not be updated to know and work with the new serial port (ttyS0).
  • set pn532_uart:/dev/ttyS0 instead /dev/ttyAMA0 in /etc/nfc/libnfc.conf. libnfc may not be updated to know and work with the new serial port (ttyS0). – Bruno A. Klein Oct 18 '16 at 19:55
  • Doing this, it started again. Thanks for the great help. – Bruno A. Klein Oct 18 '16 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.