cancel
Showing results for 
Search instead for 
Did you mean: 

When attempting to write to the mailbox, by calling getReaderInterface() vs writeMailboxMessage() TAG_NOT_IN_THE_FIELD is returned (even though it definitely is)

DNye.1
Associate

We have a problem, we are trying to upload a new firmware version over NFC, using the mailbox. Our bootloader is tight on space, so we came up with a simple protocol for it; When attempting to write to the mailbox by calling mNfcTag.writeMailboxMessage(data) we notice that 4 bytes are prepended to the packet in the mIso15693CustomCommand class writeMsg() method:

public byte writeMsg(byte sizeInBytes, byte[] buffer, byte flag, byte[] uid) throws STException {
        int msgSize = Helper.convertByteToUnsignedInt(sizeInBytes);
        if (buffer != null && buffer.length != 0 && buffer.length >= msgSize + 1) {
            int headerSize = this.getIso15693CustomHeaderSize(flag);
            byte[] frame = new byte[headerSize + 1 + msgSize + 1];
            frame[0] = flag;
            frame[1] = -86;
            frame[2] = 2;
            if (this.uidNeeded(flag)) {
                this.addUidToFrame(frame, 3, uid);
            }
 
            frame[headerSize] = sizeInBytes;
            System.arraycopy(buffer, 0, frame, headerSize + 1, msgSize + 1);
            byte[] response = this.transceive("writeMsg", frame);
            return response[0];
        } else {
            throw new STException(STExceptionCode.BAD_PARAMETER);
        }
    }

However, we don't want these bytes in our implementation, looking through the class, I worked out how the code flowed through ultimately to the transceive() method call, and noticed that I could obtain direct access by calling mNfcTag.getReaderInterface().transceive().

The problem is, that when I do this a TAG_NOT_IN_THE_FIELD is returned from the transceive() call, even though the tag is definitely in the field, and indeed the test for Tag.Connected() passes Why is this? What, if anything am I doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi DNye.1,

I think these 3 header bytes are part of the protocol and cannot be omitted. They are the flag byte (ISO15693 protocol), Command Byte (-86=AAh= Write Message) and IC Mfg Code (0x02).

Please refer to the data sheet of ST25DV, documentation of "Write Message" command.

Regards, Ulysses

View solution in original post

1 REPLY 1
Ulysses HERNIOSUS
ST Employee

Hi DNye.1,

I think these 3 header bytes are part of the protocol and cannot be omitted. They are the flag byte (ISO15693 protocol), Command Byte (-86=AAh= Write Message) and IC Mfg Code (0x02).

Please refer to the data sheet of ST25DV, documentation of "Write Message" command.

Regards, Ulysses