Unknown error trying to read a Mifare Classic block

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

Unknown error trying to read a Mifare Classic block

Jump to solution
2,499 Views
Tøm
Contributor I

Hi,

I'm working on a Mifare Classic R/W device involving a PN5190 and I've been facing an unknown error lately.

The project uses the NXP's NFC lib and I managed to read and write data on a Mifare Classic tag's sector weeks ago on another project. 

I successfully identified the type of tag used, got the UID...

But when I try to read data on a block (after field and card re-activation), calling phalMfc_Read() returns a 0x782 error and I can figure out what this means. I tried to run step-by-step really deep in the library but it becomes really hard to understand...

Tm_0-1660898657336.png

Any idea?

Thanks in advance for your help.

0 Kudos
Reply
1 Solution
2,473 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello,

For MIFARE Classic, after authentication Read/Write block operations may be performed, so you should call phalMfc_Authenticate() to authenticate any block of the sector that you want to access, once authenticated successfully, you can access to all blocks of the same sector.

Hope my reply help to you, thanks!

Best regards,
Kelly
Technical Support
NXP Semiconductor

View solution in original post

0 Kudos
Reply
3 Replies
2,474 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello,

For MIFARE Classic, after authentication Read/Write block operations may be performed, so you should call phalMfc_Authenticate() to authenticate any block of the sector that you want to access, once authenticated successfully, you can access to all blocks of the same sector.

Hope my reply help to you, thanks!

Best regards,
Kelly
Technical Support
NXP Semiconductor

0 Kudos
Reply
2,468 Views
Tøm
Contributor I

Hello,

Thanks for your answer!

That's right, the problem was that the mecanism set to avoid reauthentication when not required was not synchronized with the upper layer of the software to reset this mecanism when the tag is reactivated.

So yes, it definitely was due to a missing of authentication...

I just don't understand why I didn't manage to understand the error code But the problem is now solved anyway.

Thank you for your help!

 

0 Kudos
Reply
2,456 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello,

I checked the related code, the errorcode=0x0782 should be occurred in phpalMifare_Sw_ExchangeL3() -> phhalHw_Exchange() status = PHPAL_MIFARE_ERR_NAK4(line 144) and then finally return PH_ADD_COMPCODE(status, PH_COMP_PAL_MIFARE) = 0x0782(line 205). This is MIFARE product NAK4 response code, its detail mean may be related your application, so you could double check your application parts.

Hope my reply help to you, thanks!

Best regards,

Kelly

Technical SupportNXP Semiconductor

0 Kudos
Reply