2020-10-13 05:20 AM
Hi all,
how can I read a complete memory bank of a tag with the ST25RU3993 ?
The problem is that I don't know the number of received bytes.
Thanks in advance
Michael
Solved! Go to Solution.
2020-10-13 08:12 AM
Hi Michael,
The read API (STUHFL_T_RET_CODE Gen2_Read(STUHFL_T_Read *readData);) can only read 16 bytes (MAX_READ_DATA_LEN) at a time.
The parameter readData.bytes2Read is provided to specify how much bytes have to be read
and it returns how much where duly read.
So with the following piece of code you can read the full area content (here assuming you read User bank and pwd is 00000000):
STUHFL_T_RET_CODE ret;
STUHFL_T_Read readData;
readData.memBank = GEN2_MEMORY_BANK_USER;
readData.bytes2Read = MAX_READ_DATA_LEN;
readData.wordPtr = 0;
memset(readData.pwd, 0, 4);
do {
ret = Gen2_Read(&readData);
// do whatever needed with readData.data
readData.wordPtr += MAX_READ_DATA_LEN/2;
} while ((ret==ERR_NONE) && (readData.bytes2Read == MAX_READ_DATA_LEN));
I assumed you wanted to read Gen2 tags, procedure is equivalent for Gb29768 (using Gb29768_Read())
Best regards,
Cedric.
2020-10-13 08:12 AM
Hi Michael,
The read API (STUHFL_T_RET_CODE Gen2_Read(STUHFL_T_Read *readData);) can only read 16 bytes (MAX_READ_DATA_LEN) at a time.
The parameter readData.bytes2Read is provided to specify how much bytes have to be read
and it returns how much where duly read.
So with the following piece of code you can read the full area content (here assuming you read User bank and pwd is 00000000):
STUHFL_T_RET_CODE ret;
STUHFL_T_Read readData;
readData.memBank = GEN2_MEMORY_BANK_USER;
readData.bytes2Read = MAX_READ_DATA_LEN;
readData.wordPtr = 0;
memset(readData.pwd, 0, 4);
do {
ret = Gen2_Read(&readData);
// do whatever needed with readData.data
readData.wordPtr += MAX_READ_DATA_LEN/2;
} while ((ret==ERR_NONE) && (readData.bytes2Read == MAX_READ_DATA_LEN));
I assumed you wanted to read Gen2 tags, procedure is equivalent for Gb29768 (using Gb29768_Read())
Best regards,
Cedric.
2020-10-14 01:28 AM
2020-10-14 01:58 AM
Hi Michael,
which release version do you use ?
With release v2.2.0 and as mentioned above, if you don't know the size, you just have to set bytes2read to the max size (MAX_READ_DATA_LEN)
and Gen2_Read() will update this parameter to the data really read.
Another option I did not mention, you can even set bytes2read to 0, here again Gen2_Read() will update this parameter to the data really read.
The error you get with tag1 is probably not linked to the length, could you check the returned error code value ?
To be sure could you reduce the size from 12 to 4 (or even 2) bytes ?
Hoping this helps,
regards,
Cedric
2020-10-14 02:08 AM
Hi again Michael,
if you only want to read the tag TID, you can set, during the inventory settings phase, the parameter readTID from structure STUHFL_T_ST25RU3993_Gen2Inventory_Cfg to true,
The inventory will report tag TIDs of all found tags in parameter tagList[<index>].tid of structure STUHFL_T_Inventory_Data.
best regards,
Cedric.