Hi,
I'm using the Workabout Pro 3 with the CAENA528 UHF Module.
I have allready used different power levels between 50 - 500 mW.
I split the 30 byte EPC to shorter 6 byte arrays and try to write them
with the WriteTagData_EPC_C1G2 command, 3 retrys per partial array.
After this process I try to set the PC.
The success rate is below 50% even with the CAEN Demo Application:
"RFID CAEN Demo v 3.00".
used Code:
public bool WriteTag(byte[] epc) { bool tagWritten = false; if (source0 != null) { CAENRFIDTag readTag = GetStrongestTag(); if (readTag != null) { try { byte[] pc = new byte[2]; GetPC(epc.Length / 2, out pc[0]);
List<byte[]> totalEPC = new List<byte[]>();
for (int i = 0; i < epc.Length; i+=6) { if (epc.Length - i >= 6) { byte[] partialEPC = new byte; Array.Copy(epc, i, partialEPC, 0, 6); totalEPC.Add(partialEPC); }
else { byte[] partialEPC = new byte[epc.Length - i]; Array.Copy(epc, i, partialEPC, 0, epc.Length - i); if (partialEPC.Length%2 != 0) { byte[] makeEvenHelper = partialEPC; partialEPC = new byte[makeEvenHelper.Length +1]; Array.Copy(makeEvenHelper, partialEPC, makeEvenHelper.Length); } totalEPC.Add(partialEPC); } }
source0.WriteTagData_EPC_C1G2(readTag, 0x01, 0x02, 0x02, pc); Thread.Sleep(100);
int counter = 0; bool writeSuccess = false; foreach (byte[] item in totalEPC) { writeSuccess = false; for (int i = 0; i < 3; i++) { if (InternalWriteTag(readTag, (short)(counter*6 + 4), item)) { CAENRFIDTag[] tags = source0.InventoryTag(); byte[] read = new byte[item.Length]; byte[] source = tags[0].GetId(); Array.Copy(source, counter * 6, read, 0, item.Length); if (CompareByteArrays(item, read)) { writeSuccess = true; break; } } }
if (!writeSuccess) { return false; } Thread.Sleep(100);
readTag = GetStrongestTag(); counter++; }
tagWritten = true; } catch (Exception ex) { tagWritten = false; } } }
return tagWritten; }
private CAENRFIDTag GetStrongestTag() { CAENRFIDTag readTag = null; if (source0 != null) { CAENRFIDTag[] tags = null; byte[] tempMask = new byte[16];
try { tags = source0.InventoryTag(tempMask, 0, 0, 1); } catch (Exception ex) { throw new RFIDReaderException("Error executing Inventory.", ex); }
if (tags != null) { short rssi = 0; foreach (CAENRFIDTag tag in tags) { if (tag.GetRSSI() > rssi) { readTag = tag; } } } }
return readTag; }
private bool InternalWriteTag(CAENRFIDTag readTag, short address, byte[] writeBytes) { try { source0.WriteTagData_EPC_C1G2(readTag, 0x01, address, (short)writeBytes.Length, writeBytes); return true; } catch (Exception) { return false; } }
private static void GetPC(int wordCount, out byte pc) { pc = Convert.ToByte(string.Format("{0}000", Convert.ToString(wordCount, 2).PadLeft(5, '0')), 2); }
private bool CompareByteArrays(byte[] data1, byte[] data2) { // If both are null, they're equal if (data1 == null && data2 == null) { return true; } // If either but not both are null, they're not equal if (data1 == null || data2 == null) { return false; } if (data1.Length != data2.Length) { return false; } for (int i = 0; i < data1.Length; i++) { if (data1 != data2) { return false; } } return true; }
For writing process it is recommended to decrease the power (for example 50mW). So, to reduice physically the distance between reader and tag.
Then, you can determinate the best bitrate for your tag, some tags are dedicated to a specific bitrate.
http://community.psion.com/knowledge/w/knowledgebase/1204.rfid-plug-in-bitrates-tester.aspx
Regards,
In addition,
The latest CAEN Tools is version 3.31.
http://community.psion.com/downloads/developer_sdkhdk/m/rfid_sdk/1135.aspx
And the latest FW is 2.6.0
http://community.psion.com/knowledge/w/knowledgebase/how-to-upgrade-the-firmware-of-caen-reader.aspx
I've updated Firmware, Drivers, CAEN Demo Tool and I'm
using the best bit rate from the test plugin, but the success
rate ist still quite low (<50%).
We are using the NXP G2XL Tag.
You may introduce a retry mechanism into your algorithm.
If the tag is surrounded by metal, the write conditions may be more difficult.
Pierre
Hi
there are 3 retrys for each partial byte Array.
I'm using wet inlays, no metal near this tags.
There is a possibility that the tag is detuned due to the environment.
Please try the same write operation with the wet inlay on a carton layer.
I'm allready using the wet inlay on a carton layer, no performance increase.
Not even the RFID CAEN Demo v3.31 is working good enough for us.