ST25DV64K - iSO15693tag - extendedReadSingleBlock failure on reading entire memory block from iOS mobile
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
}
}
}
