cancel
Showing results for 
Search instead for 
Did you mean: 

ST25DV64K - iSO15693tag - extendedReadSingleBlock failure on reading entire memory block from iOS mobile

RJaya.2
Associate II

The NFC hardware chosen is the ST25DV64K. From iOS mobile app, I am trying to read the entire memory block from 0 to 2047. Because of iOS limitation on extendedReadMultipleBlocks, as suggested in your workaround, I am using for loop to run extendedReadSingleBlock by iterating through the address blocks. But it does not read the entire block, and I could see Code=102 "Tag response error / no response" or Code=100 "Tag connection lost" after reading around 1000 blocks. Is there a way to read the entire memory of 2048 blocks.

var tmpBuffer:Data = Data.init(repeating: 0x00,count: 1)

              var blockNumber:Int = Int(startAddress)

               

              for index in 0...numberOfItems-1 {

                var addr = UInt16(blockNumber) + index

                DispatchQueue.global().async {

                  tag.extendedReadSingleBlock(requestFlags: [.highDataRate, .address], blockNumber: Int(addr)) { (response:

                                                                Data, error: Error?) in

                    if let error = error as? NFCReaderError {

                      //print("\(#function)-\(#line)" + error.localizedDescription)

                       

                    } else {

                      var foo = response

                      foo.insert(0x00, at: 0)

                      let newResponse = Data(foo)

                      if newResponse[0] == 0 {

                        tmpBuffer.append(contentsOf: newResponse[1...newResponse.count-1])

                        print("Final Block: \((tmpBuffer.count - 1)/4)")

                      } else {

                        //error in cmd response

                      }

                    }

}

1 ACCEPTED SOLUTION

Accepted Solutions
victor laraison
ST Employee

Hi Rjaya,

Here attached a new version of Read memory including retry mechanism (ref to line 402) + short delay between every read commands.

I observed that by approaching the phone more or less close to the tag, there was an impact on the reading.

Hope it helps.

View solution in original post

4 REPLIES 4
victor laraison
ST Employee

Hi Rjaya2,

I suggest you to use the command extendedReadMultipleblocks" with a number of block burst = 32 blocks.

It will be faster and will decrease the number of error during reading.

In addition, I strongly suggest you to implement a system of retry in case of error.

Here attached an example.

Hope it helps.

Br,

RJaya.2
Associate II

Thanks Victor for getting back! I did try the extendedReadMultipleBlocks with block bursts of 32, 16, 4, etc just to try and minimize the number of blocks lost because of this error. But still there is going to be data loss in any case with this intermittent connection loss.

Any specific reason on why we are seeing this Tag Connection Lost intermittent errors even though the session is established and range is well in place?

Also, I have already seen the attached file from your sample codebase as well. It doesn't include any retry mechanism. If you have any suitable implementation, please do let us know.

victor laraison
ST Employee

hi Rjaya,

No idea why do we get "connection lost" in normal condition. I will use a RF spy for analysis RF Traces.

You're right : the code sent does not contains any retry mechanism. It was a suggestion .

I will update it with a retry mechanism then will send you again.

Stay tuned

victor laraison
ST Employee

Hi Rjaya,

Here attached a new version of Read memory including retry mechanism (ref to line 402) + short delay between every read commands.

I observed that by approaching the phone more or less close to the tag, there was an impact on the reading.

Hope it helps.