Unknown error trying to read a Mifare Classic block

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

Unknown error trying to read a Mifare Classic block

跳至解决方案
1,919 次查看
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.

标记 (4)
0 项奖励
1 解答
1,893 次查看
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 项奖励
3 回复数
1,894 次查看
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 项奖励
1,888 次查看
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 项奖励
1,876 次查看
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 项奖励