as3993 ST25RU3993 Firmware
|
Go to the source code of this file.
Macros | |
#define | GEN2_LF_40 0 |
#define | GEN2_LF_160 6 |
#define | GEN2_LF_213 8 |
#define | GEN2_LF_256 9 |
#define | GEN2_LF_320 12 |
#define | GEN2_LF_640 15 |
#define | GEN2_COD_FM0 0 |
#define | GEN2_COD_MILLER2 1 |
#define | GEN2_COD_MILLER4 2 |
#define | GEN2_COD_MILLER8 3 |
#define | TREXT_OFF 0 |
#define | TREXT_ON 1 |
#define | TARI_625 0 |
#define | TARI_125 1 |
#define | TARI_25 2 |
#define | MEM_RES 0x00 |
#define | MEM_EPC 0x01 |
#define | MEM_TID 0x02 |
#define | MEM_USER 0x03 |
#define | MEMADR_CRC 0x00 |
#define | MEMADR_PC 0x01 |
#define | MEMADR_EPC 0x02 |
#define | MEMADR_KILLPWD 0x00 |
#define | MEMADR_ACCESSPWD 0x02 |
#define | MEMADR_TID 0x00 |
#define | GEN2_IINV_S0 0x00 /*Inventoried (S0) */ |
#define | GEN2_IINV_S1 0x01 /*001: Inventoried (S1) */ |
#define | GEN2_IINV_S2 0x02 /*010: Inventoried (S2) */ |
#define | GEN2_IINV_S3 0x03 /*011: Inventoried (S3) */ |
#define | GEN2_IINV_SL 0x04 /*100: SL */ |
#define | GEN2_OK ERR_NONE |
#define | GEN2_ERR_REQRN ERR_GEN2_REQRN |
#define | GEN2_ERR_ACCESS ERR_GEN2_ACCESS |
#define | GEN2_ERR_SELECT ERR_GEN2_SELECT |
#define | GEN2_ERR_CHANNEL_TIMEOUT ERR_GEN2_CHANNEL_TIMEOUT |
Functions | |
unsigned | gen2SearchForTags (Tag *tags, u8 maxtags, u8 q, u8 addRounds, u8 queryAdjustUpTh, u8 queryAdjustDownTh, BOOL(*cbContinueScanning)(void), BOOL singulate, BOOL toggleSession, s8(*followTagCommand)(Tag *tag)) |
unsigned | gen2SearchForTagsAutoAck (Tag *tags_, u8 maxtags, u8 q, BOOL(*cbContinueScanning)(void), BOOL singulate, BOOL toggleSession, s8(*followTagCommand)(Tag *tag)) |
s8 | gen2AccessTag (Tag const *tag, u8 const *password) |
s8 | gen2LockTag (Tag *tag, const u8 *mask_action, u8 *tag_reply) |
s8 | gen2KillTag (Tag const *tag, u8 const *password, u8 rfu, u8 recom, u8 *tag_error) |
s8 | gen2WriteWordToTag (Tag const *tag, u8 memBank, u32 wordPtr, u8 const *databuf, u8 *tag_error) |
s8 | gen2ReadFromTag (Tag *tag, u8 memBank, u32 wordPtr, u8 wordCount, u8 *destbuf) |
void | gen2Select (struct gen2SelectParams *p) |
void | gen2PrintTagInfo (Tag *tag, u8 epclen, u8 tagNr) |
void | gen2Configure (const struct gen2Config *config) |
void | gen2Open (const struct gen2Config *config) |
void | gen2Close (void) |
s8 | gen2QueryMeasureRSSI (u8 *agc, u8 *log_rssis, s8 *irssi, s8 *qrssi) |
struct gen2Config * | getGen2IntConfig () |
This file provides declarations for functions for the GEN2 aka ISO6c protocol.
Before calling any of the functions herein the AS3993 chip needs to be initialized using as3993Initialize(). Thereafter the function gen2Open() needs to be called for opening a session. gen2SearchForTags() should be called to identify the tags in reach. Usually the the user then wants to select one of the found tags. For doing this gen2Select() can be used. If gen2Config and gen2SelectParams provide a matching configuration the next call to gen2SearchForTags() will only return 1 tag. If singulate parameter of gen2SearchForTags() is set to true the found tag will be in the Open state and can then be accessed using the other functions , gen2WriteWordToTag(), gen2ReadFromTag()... When finished with gen2 operations this session should be closed using gen2Close().
The tag state diagram looks as follows using the provided functions. For exact details please refer to the standard document provided by EPCglobal under uhfc1g2_1_2_0-standard-20080511.pdf
If the tag in question does have a password set:
If the tag in question does not have a password set:
So a typical use case may look like this:
Definition in file gen2.h.
#define GEN2_ERR_ACCESS ERR_GEN2_ACCESS |
#define GEN2_ERR_CHANNEL_TIMEOUT ERR_GEN2_CHANNEL_TIMEOUT |
#define GEN2_ERR_SELECT ERR_GEN2_SELECT |
#define GEN2_IINV_S0 0x00 /*Inventoried (S0) */ |
#define GEN2_IINV_S1 0x01 /*001: Inventoried (S1) */ |
#define GEN2_IINV_S2 0x02 /*010: Inventoried (S2) */ |
#define GEN2_IINV_S3 0x03 /*011: Inventoried (S3) */ |
#define GEN2_IINV_SL 0x04 /*100: SL */ |
#define GEN2_OK ERR_NONE |
#define MEM_EPC 0x01 |
#define MEM_RES 0x00 |
#define MEM_USER 0x03 |
#define MEMADR_ACCESSPWD 0x02 |
#define MEMADR_CRC 0x00 |
#define MEMADR_EPC 0x02 |
#define MEMADR_KILLPWD 0x00 |
#define MEMADR_PC 0x01 |
#define MEMADR_TID 0x00 |
s8 gen2AccessTag | ( | Tag const * | tag, |
u8 const * | password | ||
) |
EPC ACCESS command send to the Tag. This function is used to bring a tag with set access password from the Open state to the Secured state.
*tag | Pointer to the Tag structure. |
*password | Pointer to first byte of the access password |
void gen2Close | ( | void | ) |
void gen2Configure | ( | const struct gen2Config * | config | ) |
s8 gen2KillTag | ( | Tag const * | tag, |
u8 const * | password, | ||
u8 | rfu, | ||
u8 | recom, | ||
u8 * | tag_error | ||
) |
EPC KILL command send to the Tag. This function is used to permanently kill a tag. After that the tag will never ever respond again.
*tag | Pointer to the Tag structure. |
*password | Pointer to first byte of the kill password |
rfu | 3 bits used as rfu content for first half of kill, should be zero |
recom | 3 bits used as recom content for second half of kill, zero for real kill, !=0 for recommisioning |
*tag_error,: | in case header bit is set this will be the return code from the tag |
s8 gen2LockTag | ( | Tag * | tag, |
const u8 * | mask_action, | ||
u8 * | tag_reply | ||
) |
EPC LOCK command send to the Tag. This function is used to lock some data region in the tag.
*tag | Pointer to the Tag structure. |
*mask_action | Pointer to the first byte of the mask and action array. |
*tag_reply | In case ERR_HEADER is returned this variable will contain the 8-bit error code from the tag. |
void gen2Open | ( | const struct gen2Config * | config | ) |
void gen2PrintTagInfo | ( | Tag * | tag, |
u8 | epclen, | ||
u8 | tagNr | ||
) |
s8 gen2ReadFromTag | ( | Tag * | tag, |
u8 | memBank, | ||
u32 | wordPtr, | ||
u8 | wordCount, | ||
u8 * | destbuf | ||
) |
EPC READ command send to the Tag.
*tag | Pointer to the Tag structure. |
memBank | Memory Bank to which the data should be written. |
wordPtr | Word Pointer Address to which the data should be written. |
wordCount | Number of bytes to read from the tag. |
*destbuf | Pointer to the first byte of the data array. |
unsigned gen2SearchForTags | ( | Tag * | tags, |
u8 | maxtags, | ||
u8 | q, | ||
u8 | addRounds, | ||
u8 | queryAdjustUpTh, | ||
u8 | queryAdjustDownTh, | ||
BOOL(*)(void) | cbContinueScanning, | ||
BOOL | singulate, | ||
BOOL | toggleSession, | ||
s8(*)(Tag *tag) | followTagCommand | ||
) |
Search for tags (aka do an inventory round). Before calling any other gen2 functions this routine has to be called. It first selects using the given mask a set of tags and then does an inventory round issuing query commands. All tags are stored in then tags array for examination by the user.
*tags | an array for the found tags to be stored to |
maxtags | the size of the tags array |
q | 2^q slots will be done first, additional 2 round with increased or decreased q may be performed |
addRounds | additional Rounds with Query Adjust |
queryAdjustUpTh | Threshold for the additional round with Query Adjust to increase Q; slots * (queryAdjustUpTh/100) |
queryAdjustDownTh | Threshold for the additional round with Query Adjust to decrease Q; slots * (queryAdjustDownTh/100) |
cbContinueScanning | callback is called after each slot to inquire if we should continue scanning (e.g. for allowing a timeout) |
singulate | If set to true Req_RN command will be sent to get tag into Open state otherwise it will end up in arbitrate |
toggleSession | If set to true, QueryRep commands will be sent immediately after receiving tag reply to toggle session flag on tag. |
followTagCommand | callback function is called after a tag is inventoried. If function will be called, no fast mode is possible. |
unsigned gen2SearchForTagsAutoAck | ( | Tag * | tags_, |
u8 | maxtags, | ||
u8 | q, | ||
BOOL(*)(void) | cbContinueScanning, | ||
BOOL | singulate, | ||
BOOL | toggleSession, | ||
s8(*)(Tag *tag) | followTagCommand | ||
) |
For reference see gen2SearchForTags(). The main difference is that it uses the autoACK mode of the reader.
void gen2Select | ( | struct gen2SelectParams * | p | ) |
s8 gen2WriteWordToTag | ( | Tag const * | tag, |
u8 | memBank, | ||
u32 | wordPtr, | ||
u8 const * | databuf, | ||
u8 * | tag_error | ||
) |
EPC WRITE command send to the Tag. This function writes one word (16 bit) to the tag. It first requests a new handle. The handle is then exored with the data.
*tag | Pointer to the Tag structure. |
memBank | Memory Bank to which the data should be written. |
wordPtr | Word Pointer Address to which the data should be written. |
*databuf | Pointer to the first byte of the data array. The data buffer has to be 2 bytes long. |
*tag_error | In case tag returns an error (header bit set), this functions returns ERR_HEADER and inside tag_error the actual code |