Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

GPIO configuration #1

Open
ryanjdillon opened this issue Jan 6, 2018 · 11 comments
Open

GPIO configuration #1

ryanjdillon opened this issue Jan 6, 2018 · 11 comments

Comments

@ryanjdillon
Copy link

ryanjdillon commented Jan 6, 2018

Does this depend upon a particular pin configuration?

According to a diagram I found for the RasberryPi 3 I am using, it seems like the following would be right

GPIO 8 > Tx (SDA)
GPIO 10 > Rx (SCL)

Thanks!!!

@mfdogalindo
Copy link
Owner

mfdogalindo commented Jan 6, 2018

No my friend, On RPi GPIO 10 is RX0 -> Connect to Tx(SDA), GPIO 8 (TX0) -> Rx(SCL). Maybe you need a need a shift level adapter if you use PN532 with 5V because RPi works with 3.3V logic levels.

Regards,

Manuel

img_8548r

image

@ryanjdillon
Copy link
Author

Thanks for the feedback! I'll report back here once I get things working :)

@ryanjdillon
Copy link
Author

ryanjdillon commented Jan 11, 2018

With the following I can confirm that the serial device ttyAMA0 (alias serial0) is enabled:

dmesg | grep ttyAMA0

Now I don't get an error when trying to open the port, but things hang when trying to send the SAM_CONFIGURATION command. I've tried wiring the PN532 TX to RasPi GPIO 10 and RX to GPIO8, as well as the other way around, and it still hangs.

Any ideas?

Just for reference, I have the following PN532 device:
https://goo.gl/q5okUF

@ryanjdillon
Copy link
Author

In looking into the SAM_CONFIGURATION values (which seem correct; though perhaps the timeout should be 0xFF as suggested here , it now seems like it is hanging on the call_function() method.

@SaikCaskey
Copy link

SaikCaskey commented Jan 17, 2018

I don't know if you got sorted, but when I used the pins suggested by others, it wouldn't work.
I'm able to use UART and this pin configuration on my Rpi3 B:

  • 2(5v power),
  • 8(BCM14/TXD),
  • 10(BCM15/RXD),
  • 39(ground)

(numbers as appear on board here: https://pinout.xyz/)

You also need to disable Bluetooth (on pi3) as it uses a slot you would otherwise use for this
(sorry can't find the thing that told me to do it, but it seemed to be common advice)

@ryanjdillon
Copy link
Author

I have things hooked up on

  • 4 (5v power),
  • 6 (ground),
  • 8 (BCM14/TXD),
  • 10 (BCM15/RXD),

Which I imagine should be the same. I'll have time to get back to this later today or next week, and I'll let you know any details once I figure things out. Thanks a ton for the help!

@ryanjdillon
Copy link
Author

So I tried the other pin layout (bluetooth disabled), and I am connected as I was before.

As things were hanging on sending the SAM_configuration command, I manually constructed the frame to write to the device and sent it via an instance of the Serial class, rather than the PN532 class, so I could get the response, then I call the next line that would be called in _ack_wait where it is hanging...

ser.write(frame)
rx_info = ''
rx_info += ser.read(ser.inWaiting())

Which yields an empty string, thus it continually looping through with ack=False.

It SEEMS like I'm communicating ok with the device when I send the wakeup command:

msg = '\x55\x55\x00\x00\x00'
hex(ser.write(msg))

Which yields '0x5', so it seems like my TX/RX is setup OK? Could it be that the data/frame aren't being constructed correctly?

Any ideas? Thanks!!!

@ryanjdillon
Copy link
Author

Well... I have mysteriously fixed things.

After installing libnfc and unsuccessfully trying the ncf-poll command as described in this Adafruit tutorial:
https://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi/testing-it-out

I unplugged and re-plugged the Tx/Rx connections on the PN532, and then it started working. My solder connections seems solid, so it must have been a crappy connection with the supplied cable from my PN532.

Thanks for all of the help everybody!

@SaikCaskey
Copy link

Sometimes you need to cycle the power on the PN532
I find that when I crash out of a python program (etc.) without closing the connection that I need to restart the board.

Also, you weren't doing ncf-poll right? it's *nfc-poll :P

@mfdogalindo
Copy link
Owner

Hello friends,

I regret not being able to help you soon, at this moment I do not have a PN532 to evaluate your problems. I suggest using a level adapter for UART, this library is evaluated with a Linux hardware with 5V logic level and RPi uses 3.3V levels.

image

@ryanjdillon
Copy link
Author

Yes nfc-poll @SaikCaskey ;) and thanks for the suggestion @mfdogalindo! Things are now working well for me at the moments, so I think this one can be closed (at least for my sake).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants