cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I write to the tag?

TimLong
Associate III

Hi all. I'm coding an app in C# that uses the ST25R3916DISCOComm.dll native methods to access a ST25DV04 tag. I have got many things working, including bing able to read the tag memory passively, and some complex protocols using the Mailbox mode. However, the one thing I can't get working is passive write to tag memory.

Below is a debug log of my process.

  1. wait for a tag in the field and get its UID. [lines 1..3]
  2. Read the entire tag memory using iso15693ReadBlock() in a for loop [lines 5..7]
  3. Present the password to unlock user area 1 [lines 9..13]. This appears to work and doesn't return an error.
  4. Attempt to write a single block of memory to block 79 (0x004f) with value [x12,x34,x56,x78] [lines 15..19]. This is using the iso15693TxRxNBytes() method.

The command packet looks correct to me based on the data sheet and other commands in a similar format in the log, but I'm getting back no received data and a "No Memory" error code. Any ideas what I'm missing?

Debug log:

21/05/2025 15:30:04 [Info] Waiting for tag...

21/05/2025 15:30:06 [Info] Got tag UID=[E0,02,24,02,DA,28,8B,FA] BlockSize=4 Blocks=128 TotalMemory=512 Flags=00001111b 0x0F 15

21/05/2025 15:30:06 [Info] Reading tage memory 128 blocks x 4 bytes

21/05/2025 15:30:07 [Info] Read 512 bytes

21/05/2025 15:30:07 [Trace] Transceive 20 bytes, timeout 1, Normal mode

21/05/2025 15:30:07 [Trace] Transceive error code: NoError

21/05/2025 15:30:07 [Debug] NFC Transceive [20]: 22 b3 02 fa 8b 28 da 02 24 02 e0 01 30 63 65 61 6e 53 31 67 <=> [3]: 00 78 f0

21/05/2025 15:30:12 [Trace] Transceive 17 bytes, timeout 5000, Normal mode

21/05/2025 15:30:13 [Trace] Transceive error code: NoMemory

21/05/2025 15:30:13 [Debug] NFC Transceive [17]: 22 21 02 fa 8b 28 da 02 24 02 e0 4f 00 78 56 34 12 <=> [0]:

 

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi,

iso15693WriteBlock() internally applies default timeouts for NFCV write commands. I believe 20ms.

Getting first No Memory and now Timeout may mean that you may have overdone with going to 1K of bytes. Not sure if some layers in between can handle 1K buffers. Better if you try with e.g. 20 bytes.

Fast mode may only speed up the sending of the write command. I expect a not so big effect.

BR, Ulysses

View solution in original post

4 REPLIES 4
Ulysses HERNIOSUS
ST Employee

Hi,

No Memory typically happens if the provided reception buffer is too small. One peculiarity of ST25R39xx devices is that NFC-V framing happens inside MCU. So also CRC needs to be checked in MCU. For this purpose the provided reception buffer needs to be large enough to also hold the 2 bytes CRC (even if not requested).

BR, Ulysses

Understood - I set my rx buffer to a fixed size of 1024 bytes. When I do that and use iso15693WriteBlock to perform my write operation then I get a TIMEOUT error. Here's a screen shot of my debug session showing the actual code I'm using:

TimLong_0-1747904758341.png

 

Questions:

Why would I get a timeout when there's nowhere to specify a timeout in that method?

I have assumed that writing a block is a slow mode command and have therefore not selected fast mode. Is that a correct assumption?

Ulysses HERNIOSUS
ST Employee

Hi,

iso15693WriteBlock() internally applies default timeouts for NFCV write commands. I believe 20ms.

Getting first No Memory and now Timeout may mean that you may have overdone with going to 1K of bytes. Not sure if some layers in between can handle 1K buffers. Better if you try with e.g. 20 bytes.

Fast mode may only speed up the sending of the write command. I expect a not so big effect.

BR, Ulysses

TimLong
Associate III

I have it working now. I used a brand new tag that was not password-protected to get it working without the added complication of having to unlock the tag, and then added back the unlocking code, and everything is working now.

I used the iso15693WriteBlock command, and that did actually appear to work with a 1024 byte rx buffer, nevertheless I trimmed the Rx buffer down to 32-bytes per your suggestion.

Thank you again for your help.