Why does a frame arrive from the PN532 without its previous ACK? (RS232)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why does a frame arrive from the PN532 without its previous ACK? (RS232)

Jump to solution
1,368 Views
dominusdrr
Contributor IV

Hi

I have managed to manage a PN532 with a microcontroller via RS232. (ISO14443 tag)

It works on a regular basis, but there are times when it takes a long time to respond.

Investigating a bit I have discovered that for the command GetGeneralStatus, the module responds but without a previous ACK.

I have used a logic analyzer and a sniffer connected to the RS232 bus to determine that this is happening and it is not an error on the part of the microcontroller that loses the frame with the ACK.
I attach an image explaining what happens:

 

trama withou ack.png


On the left is the frame that the MCU sends and on the right the frame that the MCU receives.

You can see (on the right) that it is the answer, but there was never a previous ACK.


The microcontroller interprets it as an error and resends the frame several times, up to 10 times maximum, and restarts the entire process.

That's why I initially mentioned that reading a tag sometimes takes time to respond.

Is it normal? Should I assume that an ACK may not arrive on certain frames?

0 Kudos
1 Solution
1,318 Views
dominusdrr
Contributor IV

Hi.

I discovered the problem.

The PN532 has errors in its firmware and under certain circumstances when sending something wrong at a certain moment it can behave in a wrong way.

For example in another thread:

https://community.nxp.com/t5/NFC/PN532-corrupt-data-in-RS232-mode/m-p/1207289#M8026


A few extra bytes in the frame cause it to send corrupted data.

This case is a bit far-fetched.

 

The microcontroller is on an infinite loop constantly sending the frame every 3 seconds to read an ISO14443 tag.

Not having an answer, I sent it again.

There is a point, which was very difficult to find, it was when the PN532 detected a tag and started to send the tag information to the MCU and at that moment the 3 seconds had overflowed and the microcontroller sent the frame to read the tag, the PN532 begins to send all its frames starting its frames first with the information and at the end the ACK, as the image indicated at the beginning.

The microcontroller, interpreted this as an error, tried up to ten times to resend the frame to read the tag and then restarted the whole process.

When restarting, it did not pass GetGeneralStatus (because all frames send the information first and then the ACK).

I solved it this way:

1. After the 3 seconds have elapsed, I send an ACK to the PN532 to cancel any reading process.

2. If information arrives from the PN532 just after 3 seconds, that information is discarded.

I was looking for information on how to update the firmware of the PN532, but from what I understand, it has a ROM memory, so it is not possible to update it.

View solution in original post

0 Kudos
3 Replies
1,322 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hello @dominusdrr ,

 

Referring to UM, ACK should come before the response, would you please share the whole log of commands & responses?  it is something like below.

// RFConfiguration
PC -> IFD : RF CONFIGURATION
00 00 FF 04 FC D4 32 01 00 F9 00
IFD -> PC : ACK
00 00 FF 00 FF 00
IFD -> PC : RF CONFIGURATION EXECUTED
00 00 FF 02 FE D5 33 F8 00

 

BTW, looks like the ACK frame from your side lack of "00: in the end.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,319 Views
dominusdrr
Contributor IV

Hi.

I discovered the problem.

The PN532 has errors in its firmware and under certain circumstances when sending something wrong at a certain moment it can behave in a wrong way.

For example in another thread:

https://community.nxp.com/t5/NFC/PN532-corrupt-data-in-RS232-mode/m-p/1207289#M8026


A few extra bytes in the frame cause it to send corrupted data.

This case is a bit far-fetched.

 

The microcontroller is on an infinite loop constantly sending the frame every 3 seconds to read an ISO14443 tag.

Not having an answer, I sent it again.

There is a point, which was very difficult to find, it was when the PN532 detected a tag and started to send the tag information to the MCU and at that moment the 3 seconds had overflowed and the microcontroller sent the frame to read the tag, the PN532 begins to send all its frames starting its frames first with the information and at the end the ACK, as the image indicated at the beginning.

The microcontroller, interpreted this as an error, tried up to ten times to resend the frame to read the tag and then restarted the whole process.

When restarting, it did not pass GetGeneralStatus (because all frames send the information first and then the ACK).

I solved it this way:

1. After the 3 seconds have elapsed, I send an ACK to the PN532 to cancel any reading process.

2. If information arrives from the PN532 just after 3 seconds, that information is discarded.

I was looking for information on how to update the firmware of the PN532, but from what I understand, it has a ROM memory, so it is not possible to update it.

0 Kudos
1,361 Views
dominusdrr
Contributor IV

I just noticed that ACK is present, it is at the end of the frame.

 

Is that normal?

0 Kudos