Unable to write more than 4 blocks of data to St25 NFC type 5 tags in iOS
I'm working on an iOS app that can read and write to st25 type 5 tags . While writing, i am able to write only 4 blocks at a time using writeMultipleBlocks() method. NFCError occurs if I write more than that.
mISO16593Tag.writeMultipleBlocks(requestFlags: [.address,.highDataRate], blockRange: blockRange, dataBlocks: dataBlock){error in
if let error = error as? NFCReaderError {
print("\(error.localizedDescription)")
}
else{
print("write successfull")
}
self.semaphoreFunctionSignal()
}
I tried using stm's NFCTap App, it is also giving me an 'invalid response error' if I write more than 4 blocks of data.
Can someone help to me to understand why this is happening in iOS. The writing works perfectly fine on android.
I am using ST25DV04K NFC tag and have tested on iPhone11 and iPhone8
Edit:
I also tried splitting data and write it as a single block in a loop . But sometimes the write fails overwriting some of the blocks with 00 00 00 00 which leads to corrupted information.
func writeSingleBlock(blockNumber:UInt8,dataBlock:Data){
self.semaphoreFunctionWait()
mISO16593Tag.writeSingleBlock(requestFlags:[.address,.highDataRate] , blockNumber: blockNumber, dataBlock: dataBlock){ error in
if let error = error as? NFCReaderError {
print("(error.localizedDescription)")
}
else{
print(“write successful�?)
}
self.semaphoreFunctionSignal()
}
}My use case is to write minimum 6 blocks of data without causing any data corruption.
Does anyone have any suggestions to handle this case?
