2024-08-30 03:43 AM
Hello,
I am trying to use RF with iOS and Android to write into the memory of the ST25DV04KC. Reading is not a problem, but the difficulty is the protection. There are two areas: Area 1 is only used for the NDEF message and is locked with Password 1. Area 2 is the data area, which is also protected with Password 1. So, reading does not require a password, but writing with RF into the area does.
I studied the datasheet, and it looks very confusing. I can't figure out how to handle writing multiple blocks into an area that is password-protected.
Here is more information: I initially used the Req_Flag, which is 0x62 or 0x22, with the ID of the chip. The command for multiple block writes is 0x24, and the starting block is 0x0A (which is Block 11). To write two blocks, I use 0x01 (because the number of blocks is -1). I also saw that the maximum number of blocks is 4, so the maximum number of blocks to write in the data area is 0x03. When I issue these commands with the NFC Tag app, it says that the area is password-protected.
So, I understand that the area is protected by a password, which is Password 1 (0x01). The current password is actually 0, but I should change it later. The password format is (0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00).
Could someone explain an example of the commands to write over RF into the memory with this data I provided?
2024-09-24 02:07 AM
Hello,
If the area is protected, you should first present the password (password 1 in your case).
This is done using the Present Password command (command code 0xB3).
Once the Present password command is done, you should be able to write into the area.
The write multiple blocks shall not "cross" the end of an area. For example, if area2 starts at address 0x0010, and you write at starting address 0x000E, you can't write more than 2 blocks (@0x000E and 0x000F), any write longer will fail.
Concerning request flags: if you are using 0x62, then you must send an additional EOF before getting the answer from the ST25DV. I don't recommend this as it is not useful. So keep the "option_flag" to 0 is better.
If you set the "Address_flag" is set, then you must insert the UID of the ST25DV in the command. You may try without this flag, just to try with less "variables".
So I suggest to first try with request flag = 0x02 and to present the password 1 before writing.
Best regards.