2020-10-27 11:55 AM
Hi,
I’m trying to use the CR95HF in what I think should be the simplest mode. Reading a 14443a tag.
I am controlling it from a pic micro. I have detailed exactly what I have done. Clearly the SPI is working but I am also missing something. Really appreciate it if somebody could have a look and suggest where I may have been going wrong. I know I have not been poling but I have been leaving quite a long time ( several seconds) between sending and attempting to receive. The board is bespoke but built according to ST recommendations. I have checked and there is a strong signal in the antenna.
1. Reset
Asserting Chip Select
Send 0x01
De asserting Chip Select
2. Next I cyc le the /irq_in while SSI_0=1 and SSI_1=0 to select SPI mode
3. To check the comms are working I do and IDN command
Assert Chip Select
Send 0x00 Select direction from micro to CR95HF
Send 0x01 Select IDN command
Send 0x00 No additional bytes sent
De-assert Chip Select
Wait 1s
Assert Chip Select
Send 0x02
Get Data Length byte =0x0d
Get Data (13 times)
De-assert Chip Select
Result is correct “NFC FS2JAST4�?
4. Next I need to select a protocol
Assert Chip Select
Send 0x00 direction from micro tom CR95HF
Send 0x02 set protocol command
Send 0x02 send 2 bytes
Send 0x02 select 14443A
Send 0x00 other parameter
De-assert chip select
Wait 1s
Assert chip select
Send 0x02 select direction from CR95HF to micro
Get byte error code (0x00 as expected)
Get byte No of bytes (0x00 as expected)
De assert chip select
5. I programmed a 14443a tag using my phone with a string
6. Next I tried to read it. It was placed on top of the loop
Assert the chip select
Send byte 0x00 set direction from micro to CR95HF
Send byte 0x04 send SENDRECEIVE command
Send byte 0x00 no additional parameters
De-assert chip select
Wait 1s
Assert chip select.
Send byte 0x02 set direction from CR95HF to micro
Read byte comes back with 0x00 so no error
Read Byte comes back with zero so no bytes were read
De-assert chip select.
Solved! Go to Solution.
2020-10-29 04:32 AM
Hi,
ST provides the X-CUBE-NFC3 firmware package for the CR95HF/ST25R95 device. It can be ported to many MCU including non ST MCU (as long as a ST reader device is used: see the licence agreement). The porting on other MCU can be achieved through the macros in platfom.h (only little effort needed). i would recommend to use this package rather than developing from scratch.
I see different issues in your trace
Rgds
BT
2020-10-29 04:32 AM
Hi,
ST provides the X-CUBE-NFC3 firmware package for the CR95HF/ST25R95 device. It can be ported to many MCU including non ST MCU (as long as a ST reader device is used: see the licence agreement). The porting on other MCU can be achieved through the macros in platfom.h (only little effort needed). i would recommend to use this package rather than developing from scratch.
I see different issues in your trace
Rgds
BT
2020-10-29 05:50 AM
I will have a look at the X CUBE.
I take your point regarding polling, I had assumed that by waiting long enough I could ignore polling because and leave a time so long that regardless the micro would have done all it was going to. I will implement polling but have no confidence it will help.
Am I correct in thinking that the memory on the device is static so once I have requested data in will be held until I read it or otherwise interrogate the device?
There is information which does not appear to be on the data sheet, like, for example, what do the numbers 2607 in your suggested command mean and where can I find this information?
2020-10-29 05:53 AM
I've had a look at the X Cube, and while I don't discount it, I'd really appreciate sufficient data to allow me to create a minimal interface. Adding such a library would really be quite a challenge for me.
2020-10-29 06:19 AM
Hi,
2607: 0x26 is the ISO/IEC 14443-3 REQA command (see §6.4.1 in ISO/IEC 14443-3) sent in a short frame (7 data bits, thus the transmission flags is 0x07).
"Am I correct in thinking that the memory on the device is static so once I have requested data in will be held until I read it or otherwise interrogate the device?" I am not sure to understand your statement. The SendRecv is not a command to read the content of a tag but to exchange data with a tag in a command/response way.
If you want to create a minimal interface, you will have to implement the technology detection and anti-collision from the ISO/IEC 14443-3 standard. Then depending of your tag, you will have to implement READ/WRITE/SELECT SECTOR for Type 2 tags or ISO/IEC 7816-4 commands for Type 4 tags. In my opinion, porting the X-CUBE-NFC3 is probably simpler.
Rgds
BT
2020-10-29 08:33 AM
2020-10-29 12:35 PM
Hi David,
I assume you will use a Type 2 Tag with a 7 bytes UID.
Before exchanging data with an ISO/IEC 14443 A tag, the reader has to set the tag in ACTIVE state:
PCD PICC
(Reader) (Tag)
---------------------------------------
REQA-->
<--ATQA
AC
CASCADE L1-->
<-- CT, UID0, UID1,UID2, BCC
SELECT
CASCADE L1-->
<--SAK
AC
CASCADE L2-->
<-- UID3, UID4,UID5, UID6,BCC
SELECT
CASCADE L2-->
<--SAK
Once SAK indicates that UID is complete, you can send Type 2 tag command such as Read or Write or Sector Select
Rgds
BT
2020-11-05 11:23 AM
2020-11-05 01:20 PM
Hi David,
I was assuming your tag would have a 7 bytes UID. In such a case, the 7 bytes UID is segmented in Anticol1 response (CT, UID0, UID1,UID2) and Anticol2 response (UID3, UID4,UID5, UID6) with a specific CT marker in Anticol1 response.
It appears that your tag is a 4 bytes UID. In that case the 4 bytes are contained in the Anticol1 response (UID0, UID1,UID2, UID3 see line 9 below) and there is no need of a second level of anti-collision. After the Select1, the SAK response is 0x08 (see line 13) which means UID complete :
Interaction with tag
REQA
26 ---->
<---- ATQA
0400
ANTICOL1
9320 ---->
<---- CB BA 6B 75 6F
Select 1:
9370CBBA6B756F(5351)---->
<---- SAK
08(B6DD)
UID complete
So basically, you have succeeded. You can now issue Type 2 command to the tag.
Rgds
BT
2020-11-06 01:41 AM