pn532 uart

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hello,

I am using pn532 nfc controller for a project on rfid and it was working well. I use uart to communicate with it(pn532). but for a reason I haven't figured out yet its uart stops working; it stops to respond to the commands I send to it using uart. I know the nfc controller (pn532) is not dead/damaged totally because it working when connected through SPI.

 

so please help me on figuring out what makes its uart to stop working.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tell us more about the circuit it is in, how is it powered? 

Line or battery?  What avr are you using to talk to it?

Can you post a pic of the project?

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What command(s) did you send that caused it to no longer respond? Perhaps an accidental change in baud rate?

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

currently I am using pc terminal (realterm) to send commands to it. the baud rate I am using is it default 115200; it think it doesn't have a memory to save configurations if I accidentally changed its baud rate. a new power on reset should send it to its default mode, doesn't it?

the commands I use  are the common ones: 

SAM start up .... putting pn532 to normal mode : 0x55 0x55 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0x03 0xfd 0xd4 0x14 0x01 0x17 0x00

inlistpassivetarget : 0x00 0x00 0xff 0x04 0xfc 0xd4 0x4a 0x01 0x00 0xe1 0x00

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not intimately familiar with your unit so am simply using the obvious fault-finding questions. Do you have a second unit. Does it behave the same. If yes that might suggest something wrong with your realterm configuration (changes).

 

Break the problem down into clear bites. Disconnect your unit and provide a loopback wire on your realterm's output and confirm that what you send is what is expected (content, timing, parity, etc). Read it out aloud. You may be surprised how easy it is to read (silently) what you expect to read when out aloud it is actually different.

 

I am off  to bed. I hope you work it out.

 

Cheers,

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hi meriam,

 

I was beating my head against the wall yesterday with the same problem.  The PN532 has a not very well documented sleep and wake up behavior.  The key was putting a scope on the 27MHz oscillator.  After 5 transitions on the UART RX, the processor wakes up and you can see the oscillator start up, which takes about 1 or 2 milliseconds and depends on the particular crystal used on your hardware.  This is explained in the documentation.  What isn't explained is that if you don't send another command, it goes back to sleep in 6ms!

 

So, if think the number of dummy zeros you are sending might be marginal and not allowing enough time for the oscillator to start up.  Try adding a few more zeros.  If you have access to an oscilloscope, set it to trigger on the falling edge of the RX signal (pin 27) and view the oscillator output, (pin 15) with the second trace.  You can see when the oscillator starts up and then goes back to sleep.

 

Hope this helps!

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow, what are the chances that someone with direct experience with the only-indirectly-related-AVR-connection would happen to come across the post?

 

Nice one, Dave.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch,

 

It's the miracle of Google.  When I was beating my head against a wall yesterday I think I googled "PN532 uart", and this post was maybe second or third on the list.  I have never actually programmed an AVR.  Most of my experience is with Microchip or 8051's.

 

Thanks for the kind words.

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even though I'm using a Particle Photon, I signed up for this board just to thank goodgusto for this post!  I was also beating my head against the wall as to why communication was so inconsistent.  I now send 10 zeros, wait 3ms, and send my preamble and command and it works every time!  Thanks!!!!

 

 

Last Edited: Wed. Sep 13, 2017 - 12:01 AM