cancel
Showing results for 
Search instead for 
Did you mean: 

ST25R3916 I want to improve the speed of reading block. How can I debug it?

hanzigg
Associate

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?

5 REPLIES 5
Ulysses HERNIOSUS
ST Employee

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:

  • Using rfalNfcvSelect() and using the select flag
  • Reading more blocks at once
  • Going towards ST25TV/DV and its fast mode where you can receive at 52kbps.

BR, Ulysses

hanzigg
Associate

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.

hanzigg_0-1734486168826.png

 

And,What is the shortest time to read two blocks (a block = 8 bytes) with this common tag?

Hope to get your reply.

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

hanzigg
Associate
========================================================
#if DEMO_NFCV_USE_SELECT_MODE
/*
* Activate selected state
*/
  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 */
 
if(modbus.rfid_block_size==8)
{
   for(i=0;i<blocks+1;i=i+2) 
  {
  err = rfalNfcvPollerReadMultipleBlocks(reqFlag, NULL, block_addr+i, 1, &rfid_data.buff[(modbus.rfid_block_size+2) * i], (modbus.rfid_block_size*2+3), &rcvLen);
  if (err != ERR_NONE) break;
 }
}
=========================================================
Does not include the selected time,Without using the fast read command, it takes 9ms to execute "err = rfalnfcvpollerreademploblocks" once. Is there any other way to shorten this time? Reading 100 bytes with other people's products is more than 70 ms, and mine is more than 80 ms. So this is the technical point I want to overcome.
Is there any corresponding information o or demo or case for reference?
Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.