Frequently Asked Questions / How do I read or write to a UHF tag using IDBLUE.UHF?

In order to use our IDBLUE.UHF device, each UHF tag has to conform to the EPC Gen2 Class1 specification . Tag memory is logically separated into four distinct banks, each of which may comprise zero or more memory words. Memory within each memory bank is divided into 2-byte blocks.

  • Bank 00: Reserved – This memory bank stores the kill password and the access password (each are 32 bits). Most users do not use this memory area unless their applications contain sensitive data. It cannot store information besides the two codes.
  • Bank 01: EPC – This memory bank stores the EPC code, or the Electronic Product Code. It has a minimum of 96 bits of writable memory. The EPC memory is what is typically used in most applications if they only need 96 bits of memory. There are some tags that have the capability of allocating more bits to the EPC memory from the user memory. EPC memory is your first writable memory bank.
  • Bank 10: TID – This memory is used only to store the unique tag ID number by the manufacturer when the IC is manufactured and also has read and write capabilities.
  • Bank 11: User Memory – If the user needs more memory than the EPC section has available, certain ICs have extended user memory which can store more information. When it comes to user memory, there is no standard in how many bits of memory are writable on each tag.

To write to an EPC Gen2 Class1 UHF tag, you need 4 requirements:

  • EPC Bank
  • Bank Address (Index)
  • Number of words
  • Data to write

Once you have the information, you can use our epcRead and epcWrite commands in our IDBLUE SDK API’s.

//Setup the uhfResponseHandler as needed
IUhfResponseHandler _uhfResponseHandler = new UhfResponseHandler() {		
	@Override
	public void epcWriteTagResponse(IDBlueCommand command, EpcWriteTagResponse response) {			
		Log.i(TAG, "Write Bank Succeeded");
	}
	
	@Override
	public void epcWriteTagFailed(IDBlueCommand command, NackResponse response) {
		Log.i(TAG, "Write Bank Failed");
	}

	@Override
	public void epcReadTagResponse(IDBlueCommand command, EpcReadTagResponse response) {			
		Log.i(TAG, "Read Bank Succeeded");
		string epcHexData = HexConverter.toHexString(response.tagData().data());
	}
	
	@Override
	public void epcReadTagFailed(IDBlueCommand command, NackResponse response) {
		Log.i(TAG, "Read Bank Failed");
	}
};

com.idblue.core.IDBlueCoreApi api = new com.idblue.core.IDBlueUhfApi(new com.idblue.android.AndroidSession(getApplicationContext()));
short bank = 2;
short addr = 0;
short numWords = 1;
com.idblue.utilities.CByteArray data = new CByteArray("0000");

// Sample EPC Tag Read
com.idblue.core.SendStatus status = api.epcRead(bank, addr, numWords, _uhfResponseHandler);

// Sample EPC Tag Write
com.idblue.core.SendStatus status = api.epcWrite(bank, addr, numWords, data, _uhfResponseHandler);

Posted in: Software and Development