AnsweredAssumed Answered

pn532 using spi not response, host always get 0x00

Question asked by SHULIANG Wang on Jan 4, 2018
Latest reply on Feb 12, 2018 by SHULIANG Wang

Hi there,

 

I am currently using PN532 to read mifare card. PN532 is connected to host using SPI with baudrate of 392000Hz. I manage to use PN532 to read mifare card but I find it not stable. After around 100000 times(I want to say many times) reading, PN532 does not response any more. Host is polling using InListPassiveTarget command but I can read all bytes of 0x00 from SPI. Below is the functions and flow of the host application.

 

One scenario is presenting with no card

1. power on

2. host firmware wake up PN532 from LowVbat mode by sending a lot of dummy byte

3. immediatelly host send SAMConfiguration command to configure PN532 to normal mode, PN532 reply ACK, then reply status ok

4. host send InListPassiveTarget command to detect card, PN532 reply with ACK, then stop replying(not present card)

5. host send RFConfiguration to turn RF off, PN532 reply with ACK, then reply status ok.

6. repeat step 4 and keep in loop of step 4->5->4->5....

 

Another scenario is presenting with one card but removing it quickly:

1. 2. 3 same as above

4. host send InListPassiveTarget to detect card, PN532 reply with ACK, then reply with card UID(present card)

5. host send InDataExchange to read card content, PN532 reply with ACK, then stop replying(card removed)

6. host send RFConfiguration to turn RF off, PN532 reply with ACK, then reply status ok.

7. repeat step 4.

 

As I have gone through document UM0701-02, I understand that I have not use RFConfiguration to set various timing(CfgItem = 0x02) and MaxRetries(CfgItem = 0x05), so PN532 is using a default setting. In step 4(scenario 1) and step 5(scenario), after PN532 send back ACK, PN532 is reading card with a default timeout(51.2ms) and retry endless times, thus PN532 not reply status back to host.

 

Since PN532 support one way to abort previous task which is by host's new command, so I assume that the above 2 scenarios should work perfectly because in step 5(scenario 1) and step 6(scenario 2), host sends a new command to abort PN532 previous task.

 

At first everything is ok. I can read card using this way. But issue comes after I try many many times by tapping card, PN532 suddenly hangs. After PN532 hangs, I find RF is always on, PN532 does not response to any command. Only 0x00 can be read from SPI. The only way to solve this is by reset PN532.

 

I guess the way to force PN532 to abort task by sending new command cannot be used too many times. This may cause PN532 hang issues. Am I guessing correctly?

 

Many thanks.

 

Regards,

Shuliang 

Outcomes