0

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,
                };
Michael Roland
  • 39,663
  • 10
  • 99
  • 206

1 Answers1

2

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();
Michael Roland
  • 39,663
  • 10
  • 99
  • 206
  • I'm really new to coding, sorry about the trivial doubts. It says that "nfcV" symbol cannot be resolved. Also, could you elaborate on the addressed commands? Could you also explain the "0,0,0,0,0,0,0,0" part of the code? – Cyndhia Varshni Jan 31 '19 at 04:59
  • @CyndhiaVarshni I've updated my answer. Since you did not reveal more details about your current implementation in your question, you'll need to adapt the code to what you already have. nfcV is the instance of the NfcV handler that you probably already used when you transceived your cmd array. – Michael Roland Jan 31 '19 at 09:00
  • Alright. I'll try the updated code out. So, basically, I am trying to retrieve all the 8KB of data from the sensor(which has an RF430FRL 15xH IC) which will amount up to 14 days of data. Currently, the NFC of the phone only allows to retrieve 2KB of data which gives only about 3 days of data. – Cyndhia Varshni Jan 31 '19 at 10:27
  • You saved my life. Literally. – Leonardo Dec 16 '21 at 19:00