2024-12-16 07:32 PM
Hello,I have a question need your help!
About :MCU L431(80MHz),SPI 5M,IC ST25R3916. NFC06A1
I use "rfalNfcvPollerReadMultipleBlocks()" read two blocks at a time,but I found that it takes 9 ms to read successfully. How can I shorten this time?
2024-12-17 01:50 AM
Hi,
I think most of the time is consumed in the air:
NFCV typically works at 26kbps. The request to read is either 6 bytes or 14 bytes (if addressed mode is used). Then after ~300us the tag will answer: 2 blocks: 8 bytes + flags + CRC without security status: 11bytes.
So in case you are using addressed this would be 25bytes * 8 / 26 = ~8ms
You can try optimizing this by:
BR, Ulysses
2024-12-17 05:45 PM
Thank you very much for your reply.
The function I use is "err = rfalNfcvPollerReadMultipleBlocks(reqFlag, NULL, block_addr+i, 1, &rfid_data.buff[(modbus.rfid_block_size+2) * i], (modbus.rfid_block_size*2+3), &rcvLen);"
The tag I use can read up to 2 block at a time.The reqFlag is DEFAULT.And I directly set the read uid to null.So it takes 9ms to execute once.
According to your suggestion ,I added the selection mode before reading the data:
#if DEMO_NFCV_USE_SELECT_MODE
err = rfalNfcvPollerSelect( reqFlag, nfcDevice->dev.nfcv.InvRes.UID );
if( err == RFAL_ERR_NONE )
{
reqFlag = (RFAL_NFCV_REQ_FLAG_DEFAULT | RFAL_NFCV_REQ_FLAG_SELECT);
uid = NULL;
}
#endif /* DEMO_NFCV_USE_SELECT_MODE */
But,The time is longer now than before. Is there something wrong with my program?
And,I want to know how long it takes for ST25R3916 to discover NFCV.I'm 6ms now.
And,What is the shortest time to read two blocks (a block = 8 bytes) with this common tag?
Hope to get your reply.
2024-12-18 12:00 AM - edited 2024-12-18 12:40 AM
Hi,
in your timings: Are you including the time for the Select itself? If so then it is clear to me - I had recommended this as I was assuming that you will call the read multiple more than once.
Otherwise there will be also the option to use the read multiple in broadcasted mode: Default flags + uid=NULL: The command will be sent to all tags in the field and will be answered by all of them simultaneously.
I am seeing that there are also commands for Fast Read Multiple which should give you a benefit as well. Please beware that the rfal_nfcv layer only uses the fast mode for well-known commands, for the Fast Read Multiple Blocks Unlimited you may need to perform changes in the driver.
One correction on my previous calculation: It was for 4 byte blocks. For 8byte blocks you need to further adapt.
Similar calculations you can do for Inventory commands: Calculate the sent and received bytes, calculate the duration and add 300us. For inventory you need to add some 5ms more, because this is the time you have to give the tag to power-up after enabling the field.
Regards, Ulysses
2024-12-18 12:53 AM
2024-12-18 02:23 AM
Hi,
see https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/decrease-the-time-to-write-read-a-block-fro-a-nfc-tag/td-p/601357 for a similar question.
When using the Read Multiple Blocks command in non-addressed mode to read 2 blocks of 8 bytes, the request contains 6 bytes and the response contains19 bytes. When using 26 kbps bit rate:
6 bytes transmission | 1.92ms |
t1 | 0.320ms |
19 bytes reception | 6.04ms |
t2 to next command | 0.309ms |
Total duration is 8.59ms for a Read Multiple Blocks command/ response with 2 blocks of 8 bytes. This is inline with your 9ms measurement.
As 100 bytes is not a multiple of 16 bytes, I assume 7 command/response pairs are needed, so the duration for reading 112 bytes is ~63ms. What is your starting point for your 80ms measurement?
If using the Fast Read Multiple Blocks, the request contains 7 bytes and the response contains19 bytes.
7 bytes transmission | 2.22ms |
t1 | 0.320ms |
19 bytes reception | 3.02ms |
t2 to next command | 0.309ms |
Total duration is 5.87 to read 2 blocks of 8 bytes with fast mode, so about 35.2ms for 96 bytes
If using the Read Multiple Blocks Unlimited proprietary command to read for example 6 blocks:
7 bytes transmission | 1.92ms |
t1 | 0.320ms |
51 bytes reception | 15.7ms |
t2 to next command | 0.309ms |
Total duration is 18.6ms to read 6 blocks of 8 bytes, so about 37,2 ms for 96 bytes
I would personally use this Read Multiple Blocks Unlimited proprietary command and read 4 or 6 blocks per requests.
Rgds
BT