pn532 using spi not response, host always get 0x00

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

pn532 using spi not response, host always get 0x00

1,852 次查看
shuliangwang
Contributor I

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 

0 项奖励
4 回复数

1,139 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi SHULIANG,

It is not clear which scenario is for the hang issue, would you please clarify?

Thanks for your patience!

Have a great day!

Kan

0 项奖励

1,139 次查看
shuliangwang
Contributor I

Hi Kan_Li,

We came across PN532 hang  issue in the case such that we cannot get any reply from spi, all reading back bytes of 0x00 regardless of what command sent to pn532. Seems PN532 just does not reply anything. When this happen, we cannot do anything about it but have to reset the chip before it get recovered.

Thanks.

Regards

Shuliang

0 项奖励

1,139 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Shuliang,

Thanks for the information! and you listed two scenarios before, would you please tell me which one lead to the hang issue?Thanks for your patience!


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励

1,139 次查看
shuliangwang
Contributor I

Hi Kan_Li,

The second scenario (presenting with one card but removing it quickly ) leads to hang issue. 

Please note that I never configure PN532 before reading card. According to PN532 UM0701-02, PN532 will try to detect with infinite timeout and retry infinite times. So when I send another command to PN532, PN532 will abort previous command. I guess too many such tries will lead PN523 a hang.

Regards,
Shuliang

0 项奖励