Is there a way to use custom NFC-V commands?

774 views Asked by At

I am using a sensor with RF430FRL 15xH IC from which I plan to obtain the data through NFC. Is there a way to write and activate the custom NFC codes?

I have tried custom 16-bit commands for SINGLE READ (0xC0) and MULTIPLE READ (0xC3). The NFC data retrieval still is not extended. I have tried the following code:

cmd = new byte[]{
                 (byte)0x00,  //Protocol_Extension_flag=1 // 
                 (byte)0xC0,  //READ multiple blocks
                 (byte)0x07,
                 (byte)0xE0,  // First block (offset)
                 (byte)0x00,  // Number of blocks
                 (byte)0x06,
                };
1

There are 1 answers

4
Michael Roland On

Your command seems to be completely messed up. 0xC0 is the code for CUSTOM READ SINGLE BLOCK, but the parameters that you use suggest that you would want to read multiple blocks. Moreover, the user manual suggests that the valid range for the block number is 0x600 - 0xA00, so your block number 0x0E0 seems to be out-of-range. Also, the number of blocks may only be in the range of 0-2/0-5 depending on the tag configuration. Finally, you would probably want to use an addressed command on Android (since some devices seem to have issues with the unaddressed form). A CUSTOM READ MULTIPLE BLOCKS command could look like this:

NfcV nfcV = NfcV.get(tag);
nfcV.connect();
byte[] tagUid = tag.getId();  // store tag UID for use in addressed commands

int blockAddress = 0x0600;
int numberOfBlocks = 2;
byte[] cmd = new byte[] {
    (byte)0x20,  // FLAGS (addressed)
    (byte)0xC3,  // CUSTOM_READ_MULTIPLE_BLOCKS
    (byte)0x07,  // MANUFACTURER CODE (TI)
    0, 0, 0, 0, 0, 0, 0, 0,  // Placeholder for UID (address), filled by arraycopy below
    (byte)(blockAddress & 0x0ff),
    (byte)((blockAddress >>> 8) & 0x0ff),
    (byte)(numberOfBlocks & 0x0ff),
};
System.arraycopy(tagUid, 0, cmd, 3, 8);

byte[] response = nfcV.transceive(cmd);

nfcV.close();