Skip to main content
Visitor II
February 16, 2023
Solved

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

  • February 16, 2023
  • 4 replies
  • 1350 views

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

                      }

                    }

}

    This topic has been closed for replies.
    Best answer by victor laraison

    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.

    4 replies

    ST Employee
    March 9, 2023

    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.2Author
    Visitor II
    March 9, 2023

    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.

    ST Employee
    March 14, 2023

    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

    ST Employee
    March 21, 2023

    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.