cancel
Showing results for 
Search instead for 
Did you mean: 

How to read more than 255 blocks ( ST25DV04KC)

rerdo.1
Associate II

I am building a mobile application with react native using ST25DV04KC. I am trying to read 900 blocks with ISO15693 technology, but the readmultipleblocks method does not read more than 255 blocks. Which function can I use related to the subject or how ca

var count = Math.floor((endBlock - beginBlock) / 62);

console.log('/62');

for (let i = 0; i < count; i++) {

var _tmp;

var deger;

_tmp = await NfcManager.iso15693HandlerIOS.readMultipleBlocks({

flags: Nfc15693RequestFlagIOS.HighDataRate,

blockNumber: i * 62 + beginBlock + i,

blockCount: 62,

});

Here are the codes I use. Can you help with the subject?

1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

Hello,

A explained before, the ST25DV04K has a 4kbits memory, which is 512 Bytes, which is 128 blocks of 4Bytes.

It is not possible to read 900 Blocks in a memory that contains only 128 Blocks.

Another possible issue: the Extended Read Multiple Blocks command requires the start address nd the number of blocks to be coded on 2 Bytes each. Not sure what type are the data inside the customRequestParameters, but if this is byte, then start address and number of blocks are not good.

Best regards.

View solution in original post

9 REPLIES 9
Brian TIDAL
ST Employee

Hi,

the Read Multiple Blocks command (23h) supports up to 256 blocks (the number of blocks is encoded minus 1 thus value 255 means 256 blocks). The ST25DV04KC has a 4Kbit memory and thus the number of blocks is limited to128 (00h-7Fh).

The ST25DV supports Extended Read Multiple Blocks command (33h) for products having bigger memory layout (ST25DV16KC and ST25DV64KC). See the ST25DV04KC ST25DV16KC ST25DV64KC datasheet.

I would personally recommend to implement a reading loop with several (Extended) Read Multiple Blocks (e.g. reading 16 blocks by 16 blocks) rather than having a single monolithic multiple blocks read of the full memory.

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.
rerdo.1
Associate II

First of all, thank you very much for your answer. Unfortunately, the library I use here does not have the extended read mutltiple blocks function. There are only single functions extendedReadSingleBlock and extendedWriteSingleBlock. When I use these functions, NFC reading and writing takes a long time. I don't know what to do about the issue.

JL. Lebon
ST Employee

Hello,

What is the library you are using ?

Most of libraries also propose a transceive kind of function where you can build your own command. You can check if you have something like this and then use this command to build the ExtentedReadMultipleBlocks command (for exemple, in Android you have the transceive() and in iOS you have the customCommand() function)

What is the tag you are using? Is it ST25DV04K or a version with more memory ? because in any way, you will not be able to read 900 blocks out of a St25DV04K since it has only 128 blocks...

Best regards.

rerdo.1
Associate II

hello,

I am using the "react-native-nfc-manager" library in React native.

I use the transceive part for the android part and it works.

but I can't get any results when using customcommand on ios.

my code is as follows:

 for (let i = 0; i < count; i++) {

     var _tmp;

     var value;

     let beginBlockBytes = Convert.UInt16ToBytes(i * 62 + beginBlock + i);

     _tmp = await NfcManager.iso15693HandlerIOS.customCommand({

      flags: Nfc15693RequestFlagIOS.HighDataRate,

      customCommandCode: 0xac,

      customRequestParameters: [

       0x20,

       0x33,

       ...idBytes,

       ...beginBlockBytes,

       62,

       0,

      ],

     });

rerdo.1
Associate II

Sorry . English answer

I am using the "react-native-nfc-manager" library in React native.

I use the transceive part for the android part and it works.

but I can't get any results when using customcommand on ios.

my code is as follows:

 for (let i = 0; i < count; i++) {

     var _tmp;

     var value;

     let beginBlockBytes = Convert.UInt16ToBytes(i * 62 + beginBlock + i);

     _tmp = await NfcManager.iso15693HandlerIOS.customCommand({

      flags: Nfc15693RequestFlagIOS.HighDataRate,

      customCommandCode: 0xac,

      customRequestParameters: [

       0x20,

       0x33,

       ...idBytes,

       ...beginBlockBytes,

       62,

       0,

      ],

     });

JL. Lebon
ST Employee

I think the parameters you put in customcomand() function are not right.

Command code of ExtReadMultipleBlocks is 0x33, so customCommandCode: should be 0x33, not 0xac.

customCommandParameters: should only contains the start block address (2 bytes) and the number of blocks to read (2bytes) and that's all I think.

Not sure if you need to also have the address flag set or not in flags:

Best regards.

rerdo.1
Associate II

_tmp = await NfcManager.iso15693HandlerIOS.customCommand({

flags: Nfc15693RequestFlagIOS.HighDataRate,

customCommandCode: 0x33,

customRequestParameters: [0, 1110000100],

});

0 = start block

1110000100 = number of blocks to read (900 decimal)

I made the edits like this but it still doesn't work unfortunately

JL. Lebon
ST Employee

Hello,

A explained before, the ST25DV04K has a 4kbits memory, which is 512 Bytes, which is 128 blocks of 4Bytes.

It is not possible to read 900 Blocks in a memory that contains only 128 Blocks.

Another possible issue: the Extended Read Multiple Blocks command requires the start address nd the number of blocks to be coded on 2 Bytes each. Not sure what type are the data inside the customRequestParameters, but if this is byte, then start address and number of blocks are not good.

Best regards.

rerdo.1
Associate II

Hello,

The nfc kit I use is: ST25DV04KC ST25DV16KC ST25DV64KC.

My doc : https://www.st.com/en/nfc/st25dv04kc.html#tools-software

I'm actually reading the data between 0 and 218 blocks, not 900 blocks, but I think there is a conflict because I use it in bytes.