LCRC663 只能获得ATQA

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

LCRC663 只能获得ATQA

Jump to solution
4,605 Views
臣柱宣
Contributor I

你好,我使用了贵公司的lcrc663芯片作为mifare1卡的读卡器,开发了针对imx6q平台的spi设备驱动

当前我的驱动已经能够实现发送REQA(0x26)后,获得ATQA(0x04 0x00),但是我继续发送

Anticollision命令也就是0x93 0x20,却没有收到picc的回应,请问这是什么原因导致的

几个主要寄存器的设置如下

[ 35.056201] lcrc663-get addr= 0x00 ,reg =0x00
[ 35.056274] lcrc663-get addr= 0x01 ,reg =0x40
[ 35.056348] lcrc663-get addr= 0x02 ,reg =0xA0
[ 35.056421] lcrc663-get addr= 0x03 ,reg =0x1F
[ 35.056494] lcrc663-get addr= 0x04 ,reg =0x00
[ 35.056567] lcrc663-get addr= 0x05 ,reg =0x00
[ 35.056639] lcrc663-get addr= 0x06 ,reg =0x3C
[ 35.056712] lcrc663-get addr= 0x07 ,reg =0x40
[ 35.056785] lcrc663-get addr= 0x08 ,reg =0x07
[ 35.056858] lcrc663-get addr= 0x09 ,reg =0x7F
[ 35.056932] lcrc663-get addr= 0x0A ,reg =0x00
[ 35.057005] lcrc663-get addr= 0x0B ,reg =0x00
[ 35.057078] lcrc663-get addr= 0x0C ,reg =0x80
[ 35.057152] lcrc663-get addr= 0x0D ,reg =0x00

剩下的寄存器都通过loadreg和loadprotocol命令获取到了

发送REQA和Anticollision的唯一区别就是

TxDataNum 寄存器 (address 2Eh 这个寄存器从0x0f 改为0x08

请问寄存器设置是否有什么问题,非常感谢

0 Kudos
1 Solution
4,074 Views
Kan_Li
NXP TechSupport
NXP TechSupport

能描述下你实现的单次读写的具体过程吗?谢谢!

View solution in original post

0 Kudos
9 Replies
4,074 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

Mifare1卡是什么?Mifare classic?


Have a great day,
Kan

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

0 Kudos
4,074 Views
臣柱宣
Contributor I

hi

NXP Mifare1 S50卡,符合ISO 14443A协议

0 Kudos
4,074 Views
Kan_Li
NXP TechSupport
NXP TechSupport

我这有个CLRC663读mifare S50卡的脚本,你看看和你代码实现是否一致。

0 Kudos
4,075 Views
臣柱宣
Contributor I

hi

这么说来我的寄存器设置并没有问题?问题可能出在读写的流程上?

0 Kudos
4,075 Views
Kan_Li
NXP TechSupport
NXP TechSupport

是的,基本没问题,不过很奇怪, addr= 0x06 ,reg =0x3C,说明有ErrIrq,不过看addr= 0x0A ,reg =0x00,说明没有error,建议检查一下代码,看看有没有处理ErrIrq的语句被执行。

0 Kudos
4,075 Views
臣柱宣
Contributor I

hi,我检测到卡号了,是因为中间的延时问题

但是有个疑问,你给我的文件中,三次验证的做法是

//> Authenticate:
//> -------------

SR 0a 80 // flush FIFO
SR 09 60 // Auth. Command
SR 09 02 // Block Number
SR 09 FF // Key 0
SR 09 FF // Key 1
SR 09 FF // Key 2
SR 09 FF // Key 3
SR 09 FF // Key 4
SR 09 FF // Key 5 
SR 09 ML0 // Write SNR 0
SR 09 ML1 // Write SNR 1
SR 09 ML2 // Write SNR 2
SR 09 ML3 // Write SNR 3

后面写的这几个是CID,但是我看 MFAUTHENT 命令 并不需要后面的CID,请问这个流程有问题么?

还有一个问题

Crypto1On 指定 MIFARE 加密是否启动。清除此位将关闭 MIFARE 加密。此位
只能被
MFAuthent 命令设置

这个bit是否在发送认证命令前应该clean,发送命令后如果成功认证则自动变成1?

我发送命令后,出现了IDLE irq,

MFAuthent command 里介绍

This command does not terminate automatically, when the card does not answer,
therefore the timer should be initialized to automatic mode. In this case, beside the bit
IdleIRQ the bit TimerIRQ can be used as termination criteria.

那我这里出现了idle irq是否就是说明我的秘钥认证失败了?

而且你给的参考脚本中没有先用 Load key command ,而是直接用MFAuthent command,这样做合理么?

0 Kudos
4,075 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Authentication的流程没问题啊,你看数据手册上的内容:

pastedImage_1.png

Crypto1On不用代码去控制,硬件会自动根据情况设置的,而且IdleIrq不能说明Authentication失败与否,应该去看CryptoOn这个bit。你应该能在数据手册中看到这段话:

pastedImage_2.png

另外默认keyFFFFFF无需调用loadkey command。

Hope that helps,


Have a great day,
Kan

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

0 Kudos
4,075 Views
臣柱宣
Contributor I

你好,我已经完成了单次读写过程,但是我发现如果我读完卡片后,将卡片远离lcrc663等待1分钟后再次贴近lcrc663的话,再次调用读写,发送REQA,卡片就无响应了,而我只要重启设备,再发REQA的话,就可以正常收到picc的响应,请问lcrc663读写完以后还要设置什么状态才能再次重新读写吗?谢谢

0 Kudos
4,075 Views
Kan_Li
NXP TechSupport
NXP TechSupport

能描述下你实现的单次读写的具体过程吗?谢谢!

0 Kudos