Writing in user memory using ST25 framework on iOS inserts undesired 0x02 bytes (STS5DV04KC-I)
Hello, I am writing a mobile application to interact with a STS25DV04KC-I chip. I am encountering problems when trying to write to to user memory on this chip from iOS using the ST25 framework.
I want to write a byte array into area 2, and to modify the NDEF records stored in area 1.
I have successfully integrated the ST25 SDK on Android to fulfill these needs. When using the Android version of the SDK, I could successfully read and write bytes transparently with no issue (using the methods writeBytes and writeNdefMessage on the discovered tags).
My problem with the iOS SDK is the following: when writing data, there are extra, undesired bytes with the value 0x02 that are inserted into the data written to the chip. Example: I want to send the values [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10], but the values written to memory are [0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x02, 0x0c, 0x0d, 0x0e, 0x0f, 0x10].
- There is a 0x02 byte inserted before my byte array, offsetting every written byte by one byte address.
- Every 2-3 blocks (8-12 bytes, depending on the size of the written byte array), a byte is lost and replaced with this same value 0x02.
This happens both when calling the methods writeBytes and writeNdefMessage. One possible workaround for this is to split up calls to writeBytes into smaller chunks: for example, there are not extra 0x02 bytes added when using the iOS SDK to write 4 bytes at a time. This workaround also allows me to modify the NDEF message stored in area 1.
However, this solution is not satisfactory as I cannot risk corrupting the content of my chip's NDEF message, lest I have to manually intervene to rectify the EEPROM. I would prefer to do as much writing as possible in one message, while not getting these undesired 0x02 bytes.
Could someone please explain or link to resources explaining how to prevent these 0x02 bytes from being inserted into the STS5DV04KC-I's memory when writing user memory with the ST25 SDK on iOS?
I am unsure which other relevant information I could provide:
- ST25 framework (iOS) - 1.6.0 downloaded from https://www.st.com/en/embedded-software/stsw-st25ios001.html
- iOS 18.5
- iPhone 12 Pro
