Part Number Hot Search : 
34012 ST662A04 MAX15 TLMD3101 250VDC LRS1380J LTM8021 2SC3324
Product Description
Full Text Search
 

To Download AN3224 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  september 2011 doc id 17559 rev 2 1/49 AN3224 application note developing an application allo wing pr101-usb and mr101-usb feig readers to communicat e with m24lrxx transponders introduction this application note explains how to develop a visual basic or c/c++ application code to drive iso 15693 feig readers from a host computer. feig readers are contactless readers which can communicate with transponders based on the stmicroelectronics m24lrxx dual interface eeprom. the readers are delivered within st demonstration kit demokit-m24lr-a and development kit devkit-m24lr-a: pr101-usb feig reader is delivered within the demokit-m24lr-a (see figure 1 ) mr101-usb feig reader is delivered within the devkit-m24lr-a (see figure 1 ). this application note helps software engineers using and including the software delivered within the demokit-m24lr-a and the devkit-m2 4lr-a in their own application. code examples are also provided to illustrate how to send visual basic and c/c++ rf commands. note: 1 for details on feig readers go to http://www.feig.de. 2 this application note complements feig development tool documentation and examples. figure 1. pr101-usb and mr101-usb rf reader with integrated rf antenna www.st.com
contents AN3224 2/49 doc id 17559 rev 2 contents 1 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1 m24lrxx dual interface eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2 pr101-usb and mr101-usb feig contactless readers . . . . . . . . . . . . . 7 1.2.1 pr101-usb feig reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2.2 mr101-usb feig reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3 feig development toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 rf iso 15693 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 installation requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 installing the .dll files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4 pr101-usb and mr101-usb reader detection . . . . . . . . . . . . . . . . . . . 12 4.1 overview of reader detection and connection functions . . . . . . . . . . . . . . 12 4.1.1 feusb_clearscanlist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1.2 feusb_scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.1.3 feusb_getscanlistsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.4 feusb_getscanlistpara . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.1.5 feusb_opendevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.1.6 feisc_newreader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.2 detection and connection sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.3 visual basic source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.4 c/c++ source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5 rf iso 15693 high-level commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.1 feisc_0xb0_isocmd general description . . . . . . . . . . . . . . . . . . . . . . . 26 5.2 rf iso 15693 high-level inventory command . . . . . . . . . . . . . . . . . . . . . 28 5.2.1 example of high-level inventory command visual basic source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.2.2 example of high-level inventory command c/c++ source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.3 rf iso 15693 high-level reset to ready command . . . . . . . . . . . . . 31 5.3.1 reset to ready command visual basic source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
AN3224 contents doc id 17559 rev 2 3/49 6 rf iso 15693 transparent comm ands . . . . . . . . . . . . . . . . . . . . . . . . . 32 6.1 feisc_0xbf_isotranspcmd general description . . . . . . . . . . . . . . . . . . 33 6.2 issuing a read single block request with a transparent command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.2.1 transparent read single block command visual basic source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 6.2.2 transparent read single block command c/c++ source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.3 issuing a write single block request with a transparent command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.3.1 transparent write single block command visual basic source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 6.3.2 transparent write single block command c/c++ source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 appendix a feig reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 appendix b useful source code zip files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 appendix c list of error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1 feusb error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1.1 common errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1.2 scanning errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1.3 handle errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1.4 communication errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1.5 open/close device errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 c.1.6 parameter errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 c.1.7 identification errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 c.2 feisc error codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 c.2.1 common errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 c.2.2 query errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 c.2.3 handle errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 c.2.4 communication errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 c.2.5 parameter errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 c.2.6 plug-in errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 c.2.7 communication data flow errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 c.2.8 task errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
contents AN3224 4/49 doc id 17559 rev 2 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
AN3224 list of tables doc id 17559 rev 2 5/49 list of tables table 1. feusb_clearscanlist visual basic function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 table 2. feusb_clearscanlist c/c++ function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 table 3. feusb_scan visual basic function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 4. feusb_scan c/c++ function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 table 5. feusb_getscanlistsize visual basic function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 table 6. feusb_getscanlistsize c/c++ function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 table 7. feusb_getscanlistpara visual basic function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 table 8. feusb_getscanlistpara c/c++ function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 table 9. feusb_opendevice visual basic function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 10. feusb_opendevice c/c++ function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 11. feisc_newreader visual basic function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 table 12. feisc_newreader c/c++ function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 table 13. feisc_0xb0_isocmd visual basic prototype. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 table 14. feisc_0xb0_isocmd c/c++ prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 table 15. feisc_0xbf_isotranspcmd visual basic prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 16. feisc_0xbf_isotranspcmd c/c++ prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 17. example of read single block command in visual basic . . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 18. example of read single block command in c/c++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 table 19. example of write single block command in visual basic . . . . . . . . . . . . . . . . . . . . . . . . . . 39 table 20. example of write single block command in c/c++. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 table 21. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
list of figures AN3224 6/49 doc id 17559 rev 2 list of figures figure 1. pr101-usb and mr101-usb rf reader with integrated rf antenna. . . . . . . . . . . . . . . . . 1 figure 2. demokit-m24lr-a application schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 3. devkit-m24lr-a applicat ion schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
AN3224 description doc id 17559 rev 2 7/49 1 description 1.1 m24lrxx dual interface eeprom the m24lrxx is a dual interface eeprom which can be accessed either through an i 2 c serial bus or a contactless interfac e using the iso 15693 rfid protocol. to easily access the m24lrxx content through its rf interface, st offers several evaluation kits, among which are the demokit-m24lr-a and the devkit-m24lr-a. refer to the product datasheet and to application note an3163 ?configuring your iso 15693 reader to support the m24lrxx? for more in-depth information on the m24lrxx and for explanations on the rf and i 2 c communication protocols. both documents are available from http://www.st.com. 1.2 pr101-usb and mr101-usb feig contactless readers 1.2.1 pr101-usb feig reader the pr101-usb rf reader is delivered within st demokit-m24lr-a. it supports the iso 15693 protocol with high datarate transfers and one subcarrier to communicate with m24lrxx-based transponders by sending rf iso 15693 commands. the reader is connected to the host-computer usb port (see figure 2 ). figure 2. demokit-m24lr-a application schematics 2&antenna board $ual)nterface%%02/- -,2 2 53"cable #omputersends2&requests throughthe53"port 02 53"&%)'53" 2&readerwith integratedantenna "*
description AN3224 8/49 doc id 17559 rev 2 1.2.2 mr101-usb feig reader the mr101-usb is connected to the host-computer usb port. it features an external antenna and is powered from an external power supply to increase the rf read range (see figure 3 ). the reader supports the iso 15693 protocol with high datarate transfers and one subcarrier. the mr101-usb rf reader is delivered within the devkit-m24lr-a. it communicates with m24lrxx-based transponders using rf iso 15693 commands. figure 3. devkit-m24lr-a application schematics 1.3 feig development toolchain the pr101-usb and mr101-usb feig readers are driven by the same software. usb driver libraries, software development kits (free windows sdk and other platform sdks with charge) and obid drivers can be downloaded from http:// www.feig.de . to download feig software, go to http://www.feig.de and click download . you can use stmicroelectronics customers? account: user: stm_customer password: 01032010france refer to for appendix a the list of feig reference document. #omputersends2&requests throughthe53"port $ual)nterface%%02/- -,2 2 53"cable 2&antenna board 2&external antenna -2 53"&%)'53" 2&readerwith externalantenna power supply !)
AN3224 rf iso 15693 commands doc id 17559 rev 2 9/49 2 rf iso 15693 commands rf iso 15693 commands are sent by the host computer to the m24lrxx transponders via the pr101-usb or mr101-usb reader rf interface. two types of commands are available: high-level commands (see section 5 ) the host sends an already formatted request sent to the transponders via the reader rf interface. as an example, the high-level inventory request launches an anticollision sequence to identify all the transponders present in the rf field and sends back the uid information to the host. refer to http://www.feig.de for a description of the full set of high- level commands supported by the readers. transparent commands (see section 6 ). rf transparent commands are sent by the host to the transponders via the reader rf interface. the transparent commands transmit single or multiple frames compliant with the iso 15693 protocol. refer to the mr101-usb datasheet for a detailed description of the available dual interface eeprom command. the transponders answers are sent back to the computer. examples are included to allow you using, modifying the rf requests sent to the transponders, and decoding rf answers from the transponders. both visual basic and c/c++ examples are provided.
installation requirements AN3224 10/49 doc id 17559 rev 2 3 installation requirements feig windows sdk includes several .dll files wh ich allow to drive all the feig usb readers in visual basic and c/c++ languages. they support all rf iso 15693 commands. the .dll files required to drive feig drivers are the following: low level functions to drive usb readers ? feusb.dll contains all the functions required for the pc to communicate through a usb interface. ? feusb.bas : declaration file for visual basic project (vb6) ? feusb.h : header file for c/c++ project ? feusb.lib: declaration file for c/c++ project medium level functions to driver any readers ? feisc.dll contains the functions required to perform basic communications through any communication interfaces ? feisc.bas : declaration file for visual basic project (vb6) ? feisc.h : header file for c/c++ project ? feisc.lib: declaration file for c/c++ project refer to section 4.1: overview of reader detection and connection functions for a detailed description of feusb.dll and feisc.dll function. dll documentation and programming exampl es are available on the feig website http://www.feig.de. 3.1 installing the .dll files follow the steps below to install the .dll files on your computer: 1. copy the .dll files in c:/windows/system32/: if you have installed the m24lrxx_application_software , then the dll files are already present in your windows system folder. 2. add the library files and header files to your software project: before using the functions included in the .d ll files, reference th e .dll files in your software project. .h, .lib and .bas files are available for visual basic and c/c++ software development. a) visual basic project requirements: insert feusb.bas and feisc.bas in your visual basic project. these files contain all the high-level or transparent commands with their declaration and their description. below is are examples of the command that needs to be declared in your visual basic header file. usb management command for feig reader detection public declare function feusb_opendevice lib "feusb.dll"(byval dwdeviceid as long) as long
AN3224 installation requirements doc id 17559 rev 2 11/49 high-level command declaration public declare function feisc_0xb0_isocmd lib "feisc.dll" (byval ireaderhnd as long, byval cbusadr as byte, byval creqdata as string, byval ireqlen as long, byval crspdata as string, irsplen as long, byval idatatype as long) as long transparent mode command declaration public declare function feisc_0xbf_isotranspcmd lib "feisc.dll" (byval ireaderhnd as long, byval cbusadr as byte, byval imode as long, byval irsplength as long, byval creqdata as string, byval ireqlen as long, byval crspdata as string, irsplen as long, byval idatatype as long) as long byval dwdeviceid as long) as long b) c/c++ project requirements when working in c/c++, insert feusb.h, feusb.lib, feisc.h, feisc.lib in your c/c++ project, and declare them in your source code header file: #include "feusb.h" #include "feisc.h" below are examples of command declaration in c/c++. usb management command for feig reader detection int dll_ext_func feusb_opendevice( long ndeviceid ); high-level command declaration int dll_ext_func feisc_0xb0_isocmd( int ireaderhnd, unsigned char cbusadr, unsigned char* creqdata, int ireqlen, unsigned char* crspdata, int* irsplen, int idataformat ); transparent mode command declaration int dll_ext_func feisc_0xbf_isotranspcmd( int ireaderhnd, unsigned char cbusadr, int imode, int irsplength, unsigned char* creqdata, int ireqlen, unsigned char* crspdata, int* irsplen, int idataformat );
pr101-usb and mr101-usb reader detection AN3224 12/49 doc id 17559 rev 2 4 pr101-usb and mr101-usb reader detection prior to sending any rf command to a pr101-usb or an mr101-usb rf readers, the host computer must detect the reader. once detected, a handle is randomly assigned to the reader. this section presents all the available functions for performing reader detection. visual basic and c/c++ source code examples are also provided. the readers are driven by the feusb and feisc functions delivered in the feusb.dll and feisc.dll files (see section 3: installation requirements ). refer to appendix c.1 for the full list of error codes returned by the feusb functions. 4.1 overview of reader dete ction and connection functions feusb.dll and feisc.dll include several functions allowing to detect or connect to a reader: feusb_clearscanlist this function re-initializes the usb detect ion process by clearing the list of scanned readers. refer to section 4.1.1 for a detailed description of the function. feusb_scan this function searches for all the usb feig readers connected to the usb ports of the host computer. refer to section 4.1.2 for a detailed description of the function. feusb_getscanlistsize this function retrieves the number of detected readers. refer to section 4.1.3 for a detailed description of the function. feusb_getscanlistpara this function gives access to all the detected reader information. refer to section 4.1.4 for a detailed description of the function. feusb_opendevice this function opens a communication channel between a usb feig reader and the feusb dll , and assigns a handle to this channel. refer to section 4.1.5 for a detailed description of the function. feisc_newreader this function opens a communication channel between a usb feig reader and the feisc dll . the reader must have been previously detected by the feusb_opendevice function.refer to section 4.1.6 for a detailed description of the function.
AN3224 pr101-usb and mr101-usb reader detection doc id 17559 rev 2 13/49 4.1.1 feusb_clearscanlist feusb_clearscanlist visual basic prototype ta bl e 1 illustrates the feusb _clearscanlist visual basic function. feusb_clearscanlist c/c++ prototype ta bl e 2 illustrates the feusb _clearscanlist c/c++ function. table 1. feusb_clearscanlist visual basic function function description declaration public declare sub feusb_clearscanlist lib "feusb.dll"() prototype call feusb_clearscanlist parameters none returned value none table 2. feusb_clearscanlist c/c++ function function description declaration void dll_ext_func feusb_clearscanlist(); prototype feusb_clearscanlist(); parameters none returned value none
pr101-usb and mr101-usb reader detection AN3224 14/49 doc id 17559 rev 2 4.1.2 feusb_scan feusb_scan visual basic prototype ta bl e 3 illustrates the feusb _scan visual basic function. table 3. feusb_scan visual basic function function description declaration public declare function feusb_scan lib "feusb.dll" (byval iscanopt as long, osearchopt as feusb_scansearch) as long prototype dim searchopt as feusb_scansearch lngscanvalue = feusb_scan(feusb_scan_all, searchopt) parameters iscanopt : feusb_scan_first: performs a search for the first device registered by the pc feusb_scan_next: performs a search for the next device registered by the pc fesub_scan_new : performs a search for a new connected device feusb_scan_all: performs a search for all devices connected to the usb port. feusb_scan_search: this parameter can be added to feusb_scan_all to perform a search for a specific device. osearchopt : this parameter contains t he parameters of all the usb devices detected on the pc usb port. returned value 0: for feusb_scan_first or feusb_scan_all if at least one usb device have been detected index of the detected device if any: for feusb_scan_next and feusb_scan_new otherwise feusb error code example ingscanvalue = feusb_scan (feusb_scan_all, feusb_scan_search, osearchopt) with osearchopt containing the indentifier of a specific device to be searched for.
AN3224 pr101-usb and mr101-usb reader detection doc id 17559 rev 2 15/49 feusb_scan c/c++ prototype ta bl e 4 illustrates the feusb _scan c/c++ function. table 4. feusb_scan c/c++ function function description declaration public declare function feusb_scan lib "feusb.dll" (byval iscanopt as long, searchopt as feusb_scansearch) as long prototype feusb_scansearch searchopt; iscanvalue = feusb_scan(feusb_scan_ all, &searchopt); parameters iscanopt : feusb_scan_first: performs a search for the first device registered by the pc feusb_scan_next: performs a search for the next device registered by the pc fesub_scan_new: performs a search for a new connected device feusb_scan_all: performs a search for all devices connected to the usb port. feusb_scan_search: this parameter can be added to feusb_scan_all to perform a search for a specific device. searchopt : this parameter contains the parameters of all the usb devices detected on the pc usb port. returned value 0: for feusb_scan_first or feusb_scan_all if at least one usb device have been detected index of the detected device if any: for feusb_scan_next and feusb_scan_new otherwise feusb error code
pr101-usb and mr101-usb reader detection AN3224 16/49 doc id 17559 rev 2 4.1.3 feusb_getscanlistsize feusb_getscanlistsize visual basic prototype ta bl e 5 illustrates the feusb _getscanlistsize visual basic function. feusb_getscanlistsize c/c++ prototype ta bl e 6 illustrates the feusb _getscanlistsize c/c++ function. table 5. feusb_getscanlistsize visual basic function function description declaration public declare function feusb_getscanlistsize lib "feusb.dll" () as long prototype lngreadernumber = feusb_getscanlistsize parameters none returned value number of readers connected to the computer usb port and detected by the feusb_scan function otherwise feusb error code. table 6. feusb_getscanlistsize c/c++ function function description declaration int dll_ext_func feusb_getscanlistsize(); prototype intreadernumber = feusb_getscanlistsize(); parameters none returned value number of readers connected to the computer usb port and detected by the feusb_scan function otherwise feusb error code.
AN3224 pr101-usb and mr101-usb reader detection doc id 17559 rev 2 17/49 4.1.4 feusb_getscanlistpara feusb_getscanlistpara visual basic prototype ta bl e 7 illustrates the feusb _getscanlistpara visual basic function. feusb_getscanlistpara c/c++ prototype ta bl e 8 illustrates the feusb _getscanlistpara c/c++ function. table 7. feusb_getscanlistpara visual basic function function description declaration public declare function feusb_getscanlistpara lib "feusb.dll" (byval iindex as long, byval cpara as string, byval cvalue as string) as long prototype error = feusb_getscanlistpara(iindex, cpara, cvalue) parameters iindex : device index number when several usb readers are connected to the computer usb port. cpara : character string containing device-id: usb device serial number devicehnd: usb channel device handle familyname: name of the device fa mily corresponding to the device connected to the usb channel devicename: name of the device connected to the usb channel present: usb device if connected (cvalue=1) or disconnected (cvalue =0) cvalue : value returned by the reader depending on cpara. returned value 0: no error otherwise feusb error code table 8. feusb_getscanlistpara c/c++ function function description declaration int dll_ext_func feusb_getscanlistpara( int iindex, char* cparaid, char* cvalue ); prototype error = feusb_getscanlistpara(iindex, cpara, cvalue); parameters iindex : device index number when several usb readers are connected to the computer usb port. cpara : character string containing device-id: usb device serial number devicehnd: usb channel device handle familyname: name of the device fa mily corresponding to the device connected to the usb channel devicename: name of the device connected to the usb channel present: usb device if connected (cvalue=1) or disconnected (cvalue =0) cvalue : value returned by the reader depending on cpara. returned value 0: no error otherwise feusb error code
pr101-usb and mr101-usb reader detection AN3224 18/49 doc id 17559 rev 2 4.1.5 feusb_opendevice feusb_opendevice visual basic prototype ta bl e 9 illustrates the feusb _opendevice visual basic function. feusb_opendevice c/c++ prototype ta bl e 1 0 illustrates the feusb _opendevice c/c++ function. table 9. feusb_opendevice visual basic function function description declaration public declare function feusb_opendevice lib "feusb.dll" (byval dwdeviceid as long) as long prototype ihandle = feusb_opendevice(lngdeviceid(i)) parameters dwdeviceid : the reader is detected by calling feusb_scan. the feusb_getscanlistpara allows retrieving the value of the strdevicehnd parameter that is converted in long to obtain dwdeviceid. returned value ihandle : usb reader handle for feusb functions otherwise feusb error code table 10. feusb_opendevice c/c++ function function description declaration int dll_ext_func feusb_opendevice( long ndeviceid ); prototype idevicehandle = feusb_opendevice(dwdeviceserialnumber); parameters dwdeviceid : the reader is detected by calling feusb_scan. the feusb_getscanlistpara allows retrieving the value of the strdevicehnd parameter that is converted in long to obtain dwdeviceid. returned value ihandle : usb reader handle for feusb functions otherwise feusb error code
AN3224 pr101-usb and mr101-usb reader detection doc id 17559 rev 2 19/49 4.1.6 feisc_newreader feisc_newreader visual basic prototype ta bl e 1 1 illustrates the feisc _newreader visual basic function. feisc_newreader c/c++ prototype ta bl e 1 2 illustrates the feisc _newreader c/c++ function. table 11. feisc_newreader visual basic function function description declaration public declare function feisc_newreader lib "feisc.dll" (byval iporthnd as long) as long prototype lngattacheddevicehandle(1) = feisc_newreader(ihandle) parameters ihandle : usb reader handle which has been filled in after the reader detection process for feusb functions (feusb_opendevice) returned value lngattacheddevicehandle(1) : usb reader handle for feisc functions otherwise feisc error code table 12. feisc_newreader c/c++ function function description declaration int dll_ext_func feisc_newreader( int iporthnd ); prototype ifeischandle = feisc_newreader(idevicehandle) parameters ihandle : usb reader handle which has been filled in after the reader detection process for feusb functions (feusb_opendevice) returned value lngattacheddevicehandle(1) : usb reader handle for feisc functions otherwise feisc error code
pr101-usb and mr101-usb reader detection AN3224 20/49 doc id 17559 rev 2 4.2 detection and connection sequence the sequence required to perform reader detection and connection is the following: 1. call the feusb_clearscanlist function to re-initialize the usb detection process. 2. call the feusb_scan function to create the list of usb readers connected to the host ports. the list is stored in the osearch variable. an error code is sent back if no reader have been detected. 3. call the feusb_getscanlistsize function to obtain the number of detected readers. 4. call the feusb_getscanlistpara function to retrieve the data related to the detected readers, together with the identifiers (device-id) assigned to each detected reader. 5. call the feusb_opendevice function to open a communication channel between an usb reader, identified by device-id, and the feusb dll. the function sends back the usb handle that will be used to manage fu rther feusb communication with the reader. 6. call the feisc_newreader function to open a communication channel between an usb reader, identified by its usb handle , and the feisc dll. the function sends back the attached device handle ( lngattacheddevicehandle vari able) that will be used to manage further feisc communication with the reader. the detect_feig_usb_reader () function returns true if a feig usb reader is detected and false otherwise. 7. when data transmissions and receptions have completed, call the feusb_closedevice function to close usb communication. hereafter are source code examples of reader detection and connection examples in visual basic and c/c++. 4.3 visual basic source code example ?--- global variable to manage feusb handle public glngfeusbhandle as long ?--- global variable to manage feisc handle public lngattacheddevicehandle() as long '--- detect feig usb readers (detected=true, non-detected=false) --- private function detect_usb_feig_reader() as boolean dim back as long dim i as long dim cnt as integer dim char as string dim charcnt as integer dim osearch as feusb_scansearch dim lngreadernumber as long dim error as long dim devicehnd as long dim lngdeviceid(0 to 15) as long dim strfamilyname(0 to 15) as string dim strdevicename(0 to 15) as string dim lngpresent(0 to 15) as long
AN3224 pr101-usb and mr101-usb reader detection doc id 17559 rev 2 21/49 dim strdevicehnd(0 to 15) as string * 8 dim strpresent(0 to 15) as string * 25 dim strdeviceid(0 to 15) as string * 8 dim dwhandle as long dim ihandle as long 'init display ?txtdetectresult.text = "" osearch.imask = 0 '--- clear scan list (dll function) feusb_clearscanlist ' should be called before every scan process '--- scan and open in one process (dll function) devicehnd = feusb_scan(feusb_scan_all, osearch) if (devicehnd = feusb_err_no_device_found) then '--- txtscannedreaders.text = "no reader detected" else '---number of usb device connected lngreadernumber = feusb_getscanlistsize for i = 1 to lngreadernumber '--- get system parameters of all detected usb devices error = feusb_getscanlistpara(0, "devicehnd", strdevicehnd(i)) error = feusb_getscanlistpara(0, "familyname", strfamilyname(i)) error = feusb_getscanlistpara(0, "devicename", strdevicename(i)) error = feusb_getscanlistpara(0, "present", strpresent(i)) error = feusb_getscanlistpara(0, "device-id", strdeviceid(i)) '--- decode lngdevicehnd(i) value charcnt = 0 lngdevicehnd(i) = 0 for cnt = 1 to 8 char = ucase(mid(strdevicehnd(i), 9 - cnt, 1)) if ((char >= "0") and (char <= "9")) then lngdevicehnd(i) = lngdevicehnd(i) + (asc(char) - 48) * _ (16 ^ charcnt) charcnt = charcnt + 1 end if if ((char >= "a") and (char <= "f")) then lngdevicehnd(i) = lngdevicehnd(i) + (asc(char) - 55) * _ (16 ^ charcnt) charcnt = charcnt + 1 end if next cnt '--- decode strfamilyname(i) value strfamilyname(i) = "" for cnt = 1 to 25 char = ucase(mid(strfamilyname(i), cnt, 1)) if (((char >= "0") and (char <= "9")) or _ ((char >= "a") and (char <= "z")) or _
pr101-usb and mr101-usb reader detection AN3224 22/49 doc id 17559 rev 2 (char = "-") or (char = ".") or (char = " ")) then strfamilyname(i) = strfamilyname(i) & char end if next cnt '--- decode strdevicename(i) value strdevicename(i) = "" for cnt = 1 to 25 char = ucase(mid(strdevicename(i), cnt, 1)) if (((char >= "0") and (char <= "9")) or ((char >= "a") _ and (char <= "z")) or (char = "-") or (char = ".") or _ (char = " ")) then strdevicename(i) = strdevicename(i) & char end if next cnt '-- decode strdeviceid value charcnt = 0 lngdeviceid(i) = 0 for cnt = 1 to 8 char = ucase(mid(strdeviceid(i), 9 - cnt, 1)) if ((char >= "0") and (char <= "9")) then lngdeviceid(i) = lngdeviceid(i) + (asc(char) - 48) * _ (16 ^ charcnt) charcnt = charcnt + 1 end if if ((char >= "a") and (char <= "f")) then lngdeviceid(i) = lngdeviceid(i) + (asc(char) - 55) * _ (16 ^ charcnt) charcnt = charcnt + 1 end if next cnt '-- decode strpresent value charcnt = 0 lngpresent(i) = 0 for cnt = 1 to 8 char = ucase(mid(strpresent(i), 9 - cnt, 1)) if ((char >= "0") and (char <= "9")) then lngpresent(i) = lngpresent(i) + (asc(char) - 48) * _ (16 ^ charcnt) charcnt = charcnt + 1 end if if ((char >= "a") and (char <= "f")) then lngpresent(i) = lngpresent(i) + (asc(char) - 55) * _ (16 ^ charcnt) charcnt = charcnt + 1 end if next cnt '--- summary of detected device parameters for one usb device '- txtdevicehandle.text = "devicehnd : " & lngdevicehnd(i) '- txtfamilyname.text = "familyname : " & strfamilyname(i) '- txtdevicename.text = "devicename : " & strdevicename(i) '- txtpresent.text = "present : " & clng("&h" & lngpresent(i))
AN3224 pr101-usb and mr101-usb reader detection doc id 17559 rev 2 23/49 '- txtdeviceid.text = "device-id : " & lngdeviceid(i) next i end if '--- analysis if feig usb readers are connected and how much if (lngreadernumber = 0) then '--- no feig usb device detected ?txtdetectresult.text = "no feig usb reader detected" detect_usb_feig_reader = false elseif (lngreadernumber > 1) then '--- too much detected feig usb readers ?txtdetectresult.text = "too much feig usb reader detected" detect_usb_feig_reader = false elseif (lngreadernumber = 1) then '--- only one feig usb device detected ok glngfeusbhandle = feusb_opendevice(lngdeviceid(1)) if (glngfeusbhandle < 0) then error = feusb_closedevice(glngfeusbhandle) detect_usb_feig_reader = false else lngattacheddevicehandle(0) = feisc_newreader(glngfeusbhandle) detect_usb_feig_reader = true end if end if end function 4.4 c/c++ source code example /* global variables */ int idevicehandle; int ifeischandle; int main () { char sdevicehandle[32]; char sdevicename[32]; char sdeviceserialnumber[32]; char sdevicefamilyname[32]; char sdevicepresence[2]; dword dwdeviceserialnumber = 0; feusb_clearscanlist();/* check usb device connected */ while (feusb_scan(feusb_scan_first,null) < 0) { /* time out to be added toexit while loop if no reader connected */ /*return 0; } /* getscanlistpara : get detected feig usb device parameters */ feusb_getscanlistpara( 0, "devicename", sdevicename ) ; feusb_getscanlistpara( 0, "device-id", sdeviceserialnumber ) ; feusb_getscanlistpara( 0, "devicehnd", sdevicehandle ) ;
pr101-usb and mr101-usb reader detection AN3224 24/49 doc id 17559 rev 2 feusb_getscanlistpara( 0, "familyname", sdevicefamilyname ) ; feusb_getscanlistpara( 0, "present", sdevicepresence ) ; /* convert receive data in hexa format */ sscanf((const char*)sdeviceserialnumber, "%lx", &dwdeviceserialnumber); /* open communciation with one feig usb device */ /* and get usb hanle for feusb functions */ idevicehandle = feusb_opendevice(dwdeviceserialnumber); if (idevicehandle < 0) { /* error : usb connection problem */ /* close usb connection */ ierr = feusb_closedevice(idevicehandle); return 0; } /* link feig usb device with feisc functions */ /* and get usb hanle */ ifeischandle = feisc_newreader( idevicehandle ); if (ifeischandle < 0) { /* error : usb connection problem */ /* close usb connection */ ierr = feisc_deletereader( ifeischandle ); return 0; } else { /* usb connection ok */ /* idevicehandle is handle for feusb functions */ /* ifeischandle is handle for feisc functions */ return 1; } }
AN3224 rf iso 15693 high-level commands doc id 17559 rev 2 25/49 5 rf iso 15693 high-level commands the feisc_0xb0_isocmd function is part of the feisc.dll. it allows sending predefined rf iso 15693 commands to rf transponders via the feig readers, and retrieving the transponder answers. the reader is identified by its attached device handle contained in the lngattacheddevicehandle(1) variable which mu st have been previously filled in with the correct feig usb reader handle by calling the feisc_newreader function (see section 4.2: detection and connection sequence ). among the iso 15693 commands that can be used by feig readers to communicate with m24lrxx transponders are: inventory: command code is ?0x01 00? reset to ready: command code is ?0x26 00? refer to the m24lrxx datasheet and to user manuals available from http://www.feig.de for the full list of rf iso 15693 requests supported by the feig readers and st m24lrxx dual interface eeprom. refer to section 5.1 for a general description of the feisc_0xb0_isocmd function, and to section 5.2 and section 5.3 for details on the high-level inventory and ready to ready functions. refer to appendix c.2 for the full list of error codes returned by the feisc functions.
rf iso 15693 high-level commands AN3224 26/49 doc id 17559 rev 2 5.1 feisc_0xb0_isocmd general description ta bl e 1 3 and ta bl e 1 4 give the description of the feis c_0xb0_isocmd function in visual basic and c/c++. table 13. feisc_0xb0_isocmd visual basic prototype function description prototype ingstatus = feisc_0xb0_isocmd(lngattacheddevicehandle(1), &hff,strreqdata,lngreqdatalen,strrespdata, lngrespdatalen,n) parameters ingattacheddevicehandle(1) : usb reader handle which has been filled in after the reader detection process ( feisc_newreader function). &hff : communication address. strreqdata : high-level command to be sent to the reader. lngreqdatalen : high-level command length. strrespdata : transponder answer (if any). this variable is filled after the usb request is issued. before sending any usb request, strrespdata must be formatted as follows: dim strrespdata as string * 512 lngrespdatalen : size of the rf answer (length of strrespdata ). n : format of all the parameters passed to the function 0: ascii. example: ?2356? corresponds to the string ?#v? composed of 2 ascii codes. 1: characters. example: ?2356? corresponds to 4 characters (2, 3, 5, 6) 2: hexadecimal. example: ?2356? corresponds to 2 bytes (&h23 and &h56) returned value lngstatus : error code 0: usb request transmission successful 1: usb request transmission failed
AN3224 rf iso 15693 high-level commands doc id 17559 rev 2 27/49 table 14. feisc_0xb0_isocmd c/c++ prototype function description prototype result = feisc_0xb0_isocmd(ifeischandle, 0xff, sreqdata, ireqlen, srspdata,&irsplen, n); parameters ifeischandle : usb reader handle which has been filled in after the reader detection process ( feisc_newreader function). 0xff : communication address. sreqdata : high-level command to be sent to the reader. ireqlen : high-level command length. srspdata : transponder answer (if any). this variable is filled after the usb request is issued. before sending any usb request, strrespdata must be formatted as follows: char srspdata[64]={0} &irsplen : size of the rf answer (length of srspdata ). n : format of all the parameters passed to the function 0: ascii. example: ?2356? corresponds to the string ?#v? composed of 2 ascii codes. 1: characters. example: ?2356? corresponds to 4 characters (2, 3, 5, 6) 2: hexadecimal. example: ?2356? corresponds to 2 bytes (0x23 and 0x56) returned value result : error code 0: usb request transmission successful 1: usb request transmission failed
rf iso 15693 high-level commands AN3224 28/49 doc id 17559 rev 2 5.2 rf iso 15693 high-level inventory command to issue an rf iso 15693 high-level inventory command, send the feisc_0xb0_isocmd function with the strreqdata set to ?0100? (inventory request). at the end of an inventory request, all the transponders are put in quiet mode (iso 15693 ?stay quiet?). to be able to communicate with the detected transponder. a ?reset to ready? rf request must be issued. below are code examples in visual basic and c/c++. 5.2.1 example of high- level inventory command visual basic source code private function cmd_inventory_feig() as boolean dim strreqdata as string dim lngreqdatalen as long dim lngrsplength as long dim strrespdata as string * 512 dim lngrespdatalen as long dim lngstatus as long dim i as long dim lngtranspnumber as long dim strtransponder as string 'init display ?txtinventoryrf_answer.text = "" ?for i = 0 to 2 ? txttransponderuid(i).text = "" ? txttransponderdsfid(i).text = "" ?next i ' inventory request host mode : 0x0100 strreqdata = "0100" lngreqdatalen = len(strreqdata) ' feig usb inventory request in host mode lngstatus = feisc_0xb0_isocmd(lngattacheddevicehandle(0), &hff, _ strreqdata, lngreqdatalen, strrespdata, _ lngrespdatalen, 1) ' rf inventory request result ' if(lngstatus = 0) then pass else fail ' if (lngrespdatalen = 0) then no transponder answer ' else strrespdata contains the transponder(s) answer(s) if (lngrespdatalen = 0) then cmd_inventory_feig = false ?txtinventoryrf_answer.text = "no tag answer detected" else lngtranspnumber = clng("&h" & mid(strrespdata, 1, 2)) if (lngrespdatalen > 1 and lngtranspnumber > 3) then cmd_inventory_feig = false ?too much tags detected :
AN3224 rf iso 15693 high-level commands doc id 17559 rev 2 29/49 else cmd_inventory_feig = true ?lngtranspnumber & " tags detected" for i = 0 to lngtranspnumber - 1 strtransponder = mid(strrespdata, 3 + (20 * (i)), 20) next i end if end if ' after inventory request, all transponders are in quiet mode ' reset to ready request is sent to wake up transponders call cmd_resettoreadyrf_feig end function 5.2.2 example of high- level inventory command c/c++ source code int cmd_inventory_feig (void) { int entry3; int i; uchar sreqdata[64]={0}; uchar srspdata[64]={0}; int ireqlen,irsplen; int iresult, iresult2; int irsplength=56; /* inventory request host mode command : b0 + 0100 */ sreqdata[0] = (uchar)0x01; sreqdata[1] = (uchar)0x00; ireqlen = 2; /* (number of bytes :param=2 in request) */ printf("\n\n\n\n"); printf("\n>>> inventory request in iso mode : "); printf("\n --> request : "); for (i=0; i answer : "); if (irsplen == 0) printf("no tag answer received"); else for (i=0; i rf iso 15693 high-level commands AN3224 30/49 doc id 17559 rev 2 printf("\n"); scanf("%x", &entry3); /* rf inventory request result */ /* if(iresult == 0) pass else fail */ /* if (irsplen == 0) no transponder answer */ /* else srspdata contains the transponder(s) answer(s) */ if (iresult != 0) { /* no tag detected in the antenna field */ } else { /* 1 or more transponders are in antenna field */ } /* after inventory request, all transponders are in quiet mode */ /* reset to ready request is sent to wake up transponders */ /* reset to ready [0xb0] request */ sreqdata[0] = (uchar)0x26; sreqdata[1] = (uchar)0x00; ireqlen = 2; /* (number of bytes :param=2 in request) */ iresult2 = feisc_0xb0_isocmd(ifeischandle,0xff, sreqdata, ireqlen, /* request */ &srspdata[0], &irsplen,/* answer */ 2);/* length format 2 */ if (iresult2 != 0) { /* reset to ready request problem */ } else { /* reset to ready request ok */ } return iresult; }
AN3224 rf iso 15693 high-level commands doc id 17559 rev 2 31/49 5.3 rf iso 15693 high-level reset to ready command to issue an rf iso 15693 high-level reset to ready command, send the feisc_0xb0_isocmd function with the strreqdata set to ?0026? (reset to ready request). below is an example of code in visual basic and c/c++. 5.3.1 reset to ready command visual basic source code example private function cmd_resettoreadyrf_feig() as boolean dim strreqdata as string dim lngreqdatalen as long dim lngrsplength as long dim strrespdata as string * 512 dim lngrespdatalen as long dim lngstatus as long ' reset to ready request host mode : 0x2600 strreqdata = "2600" lngreqdatalen = len(strreqdata) ' feig usb inventory request in host mode lngstatus = feisc_0xb0_isocmd(lngattacheddevicehandle(0), &hff, _ strreqdata, lngreqdatalen, _ strrespdata, lngrespdatalen, _ 1) ' rf inventory request result ' if(lngstatus = 0) then pass else fail ' if (lngrespdatalen = 0) then no transponder answer ' else strrespdata contains the transponder(s) answer(s) if (lngrespdatalen = 0) then cmd_resettoreadyrf_feig = false else cmd_resettoreadyrf_feig = true end if end function
rf iso 15693 transparent commands AN3224 32/49 doc id 17559 rev 2 6 rf iso 15693 transparent commands the feisc_0xbf_isotranspcmd function is part of the feisc.dll. it allows sending any rf iso 15693 request to rf transponders via the feig readers. the reader is identified by its attached device handle contained in the lngattacheddevicehandle(1) variable which mu st have been previously filled in with the correct feig usb reader handle by calling the feisc_newreader function (see section 4.2: detection and connection sequence ). several parameters must be passed to the feisc_0xbf_isotranspcmd function to indicate to the reader the type of rf request, and the type of transponder answer expected. refer to section 6.1 for a general description of the feisc_0xb0_isocmd function. all the requests described in the m24lrxx datasheet can be issued by using this method. section 6.2 and section 6.3 illustrate two examples of reque sts, the read single block and write single block request, which allow to read and write a single block of dual interface memory. for more informations about how to use transparent commands, please refers to feig documentation available from http://www.feig.de.
AN3224 rf iso 15693 transparent commands doc id 17559 rev 2 33/49 6.1 feisc_0xbf_isotranspcmd general description ta bl e 1 5 and ta bl e 1 6 give the description of the feisc_0xbf_isotranspcmd function in visual basic and c/c++. table 15. feisc_0xbf_isotranspcmd visual basic prototype function description prototype ingstatus = feisc_0xbf_isotranspcmd(lngattacheddevicehandle(1),&hff, m, lngrsplength, strreqdata, lngreqdatalen,strrespdata,lngrespdatalen,n) parameters ingattacheddevicehandle(1) : usb reader handle which has been filled in after the reader detection process ( feisc_newreader function). &hff : communication address. m: mode. the method used by the transparent command to detect the transponder answer depends on the mode. 1: answer detected after reception of a read request 2: answer detected after reception of a write request with option_flag = 0. 3: answer detected after reception of a write request with option_flag = 1. 4: answer detected after reception of an inventory request lngrsplength: expected rf answer size (bit number) strreqdata : rf request frame to be sent to the reader lngreqdatalen : rf request frame length (strreqdata) strrespdata : transponder answer (if any). this variable is filled after the usb request is issued. before sending any usb request, strrespdata must be formatted as follows: dim strrespdata as string * 512 lngrespdatalen : strrespdata length (0 if no answer) n : format of all the parameters passed to the function 0: ascii. example: ?2356? corresponds to the string ?#v? composed of 2 ascii codes. 1: characters. example: ?2356? corresponds to 4 characters (2, 3, 5, 6) 2: hexadecimal. example: ?2356? corresponds to 2 bytes (&h23 and &h56) returned value lngstatus : error code 0: usb request transmission successful 1: usb request transmission failed
rf iso 15693 transparent commands AN3224 34/49 doc id 17559 rev 2 table 16. feisc_0xbf_isotranspcmd c/c++ prototype function description prototype iresult = feisc_0xbf_isotranspcmd(ifeischandle, 0xff, m, irsplength, &sreqdata[0], ireqlen, &srspdata[0],&irsplen, n); parameters ifeischandle : usb reader handle which has been filled in after the reader detection process ( feisc_newreader function). 0xff : communication address. m: mode. the method used by the transparent command to detect the transponder answer depends on the mode. 1: answer detected after reception of a read request 2: answer detected after reception of a write request with option_flag = 0. 3: answer detected after reception of a write request with option_flag = 1. 4: answer detected after reception of an inventory request &irsplength : expected rf answer size (bit number) &sreqdata : rf request frame to be sent to the reader. ireqlen : rf request frame length (sreqdata) &srspdata : transponder answer (if any). this variable is filled after the usb request is issued. before sending any usb request, srspdata must be formatted as follows: char srspdata[64]={0} &isrsplen : srspdata length (0 if no answer) n : format of all the parameters passed to the function 0: ascii. example: ?2356? corresponds to the string ?#v? composed of 2 ascii codes. 1: characters. example: ?2356? corresponds to 4 characters (2, 3, 5, 6) 2: hexadecimal. example: ?2356? corresponds to 2 bytes (0x23 and 0x56) returned value iresult : error code 0: usb request transmission successful 1: usb request transmission failed
AN3224 rf iso 15693 transparent commands doc id 17559 rev 2 35/49 6.2 issuing a read single block request with a transparent command ta bl e 1 7 and ta bl e 1 8 give an example of parameters to be passed to the feisc_0xbf_isotranspcmd function to issue a transparent read single block command. section 6.2.1 and section 6.2.2 describe code examples in visual basic and c/c++. table 17. example of read single block command in visual basic feisc_0xbf_isotranspcmd parameters parameters lngattacheddevicehandle(0) : usb handle &hff : communication address m: 1: read mode lngrsplength : 0x38 strreqdata : 021f: reader parameter 0a: rf protocol flag request 20: rf iso 15693 read single block command fa01: address &h01fa lngreqdatalen : 12 strrespdata : answer from transponder (if any) lngrespdatalen : size of strrespdata n: 1 (data expressed in characters) returned value error code example feisc_0xbf_isotranspcmd(lngattacheddevicehandle(0),&hff , 1, &h38, ?021f0a20fa01?, lngreqdatalen, strrespdata, lngrespdatalen, 1)
rf iso 15693 transparent commands AN3224 36/49 doc id 17559 rev 2 6.2.1 transparent read single block command visual basic source code example private function rfreadsingleblock() as boolean dim strreqdata as string dim lngreqdatalen as long dim lngrsplength as long dim strrespdata as string * 512 ' has to be formatted dim lngrespdatalen as long dim lngstatus as long 'init display ?txtreadrf_answer.text = "" ?txtreaddata.text = "" lngrsplength = &h38 'response length (feig usb reader) ' rf read single block request ' feig reader parameters 0x021f ' flag 0x0a ' rf read command 0x20 ' address 0x01fa : send fa01 strreqdata = "021f0a20fa01" lngreqdatalen = len(strreqdata) ' send command in transparent mode lngstatus = _ feisc_0xbf_isotranspcmd(lngattacheddevicehandle(0), &hff, _ &h1, lngrsplength, _ strreqdata, lngreqdatalen, _ strrespdata, lngrespdatalen, _ table 18. example of read single block command in c/c++ feisc_0xbf_isotranspcmd parameters parameters ifeischandle : usb handle 0xff : communication address m: 1: read mode irsplength : 0x38 srqdata : 021f: reader parameter 0a: rf protocol flag request 20: rf iso 15693 read single block command fa01: address 0x01fa ireqlen : 6 srspdata : answer from transponder (if any) lrsplen : size of srspdata n : 2 (data expressed in hexadecimal bytes) returned value error code example iresult = feisc_0xbf_isotranspcmd(ifeischandle, 0xff, 1, irsplength,?021f0a20fa01?, ireqlen, &srspdata[0],&irsplen, 2);
AN3224 rf iso 15693 transparent commands doc id 17559 rev 2 37/49 1) ' rf read request result ' if(lngstatus = 0) then pass else fail ' if (lngrespdatalen = 0) then no transponder answer ' else strrespdata contains the transponder answer if (lngrespdatalen = 0) then rfreadsingleblock = false ?txtreadrf_answer.text = "no detected tag answer" else if (mid(strrespdata, 1, 2) = "00") then rfreadsingleblock = true ?txtreadrf_answer.text = strrespdata & " = read single block ok" ?txtreaddata.text = mid(strrespdata, 3, 8) else rfreadsingleblock = false ?txtreadrf_answer.text = strrespdata & " = error code" end if end if end function 6.2.2 transparent read single block command c/c++ source code example int rfreadsingleblock (void) { int entry3; int i; int irsplength=56; int ireqlen,irsplen,iresult; unsigned char sreqdata[32]={0}; unsigned char srspdata[32]={0}; /* rf read single block request format */ /* feig reader parameters : 021f*/ /* flag : 0a */ /* rf read single block command : 20*/ /* address :01fa (note : send fa01 = lsb byte first)*/ /* request = 021f + 0a20fa01*/ sreqdata[0] = (uchar)0x02; sreqdata[1] = (uchar)0x1f; sreqdata[2] = (uchar)0x0a; sreqdata[3] = (uchar)0x20; sreqdata[4] = 0xfa sreqdata[5] = 0x01 ireqlen = 6; /* (number of characters :param=2 in request) */ printf("\n\n\n\n"); printf("\n>>> rf read at adress %.2x%.2x : ",address_parameter[0], address_parameter[1]); printf("\n --> request : {021f} "); for (i=2; i rf iso 15693 transparent commands AN3224 38/49 doc id 17559 rev 2 iresult = feisc_0xbf_isotranspcmd (ifeischandle, 0xff, 1, /* mode 1 : read answer */ irsplength, sreqdata,/* request */ ireqlen,/* usb request length */ &srspdata[0], &irsplen,/* answer */ 2 ); /* length format 2 : number of bytes */ printf("\n --> answer : "); if (irsplen == 0) printf("no tag answer received"); else for (i=0; i AN3224 rf iso 15693 transparent commands doc id 17559 rev 2 39/49 6.3 issuing a write single block request with a transparent command ta bl e 1 9 and ta bl e 2 0 gives an example of parameters to be passed to the feisc_0xbf_isotranspcmd function to issue a transparent write single block command. section 6.3.1 and section 6.3.2 describe code examples in visual basic and c/c++. table 19. example of write single block command in visual basic feisc_0xbf_isotranspcmd parameters parameters lngattacheddevicehandle(0) : usb handle &hff : communication address= 0xff m: 2: write mode lngrsplength : &h18 strreqdata : 021f: reader parameter 0a: rf protocol flag request 21: rf iso 15693 write single block command fa01: address 0x01fa 01020304: data to be written lngreqdatalen : 20 strrespdata : answer from transponder (if any) lngrespdatalen : size of strrespdata n: 1 (data expressed in characters) returned value error code example feisc_0xbf_isotranspcmd(lngattacheddevicehandle(0),&hff ,2, 1, &h18, ?021f0a21fa01 01020304?, lngreqdatalen, strrespdata, lngrespdatalen, 1)
rf iso 15693 transparent commands AN3224 40/49 doc id 17559 rev 2 6.3.1 transparent write single block command visual basic source code example private function writesingleblockrf() as boolean dim strreqdata as string dim lngreqdatalen as long dim lngrsplength as long dim strrespdata as string * 512 ' has to be formatted dim lngrespdatalen as long dim lngstatus as long 'init display ?txtwriterf_answer.text = "" lngrsplength = &h18 'feig response length ' rf write single block request ' feig reader parameters 0x021f ' flag 0x0a ' rf write single block command 0x21 ' address 0x01fa : send fa01 ' data 0x01020304 strreqdata = "021f0a21fa0101020304" lngreqdatalen = len(strreqdata) lngstatus = _ feisc_0xbf_isotranspcmd(lngattacheddevicehandle(0), &hff, _ &h2, lngrsplength, _ strreqdata, lngreqdatalen, _ strrespdata, lngrespdatalen, _ 1) table 20. example of write single block command in c/c++ feisc_0xbf_isotranspcmd parameters parameters ifeischandle : usb handle 0xff : communication address m: 2 (write mode) lrsplength : 0x18 strreqdata : 021f: reader parameter 0a: rf protocol flag request 21: rf iso 15693 write single block command fa01: address 0x01fa 01020304: data to be written lreqlen : 10 &srspdata : answer from transponder (if any) &lrsplen : size of srspdata n: 2 (data expressed in hexadecimal bytes) returned value error code example iresult = feisc_0xbf_isotranspcmd(ifeischandle, 0xff, 2, irsplength,?021f0a20fa01?, ireqlen, &srspdata[0],&irsplen, 2);
AN3224 rf iso 15693 transparent commands doc id 17559 rev 2 41/49 ' rf write request result ' if(lngstatus = 0) then pass else fail ' if (lngrespdatalen = 0) then no transponder answer ' else strrespdata contains the transponder answer if (lngrespdatalen = 0) then writesingleblockrf = false ?txtwriterf_answer.text = "no detected tag answer" else if (mid(strrespdata, 1, 2) = "00") then writesingleblockrf = true ?txtwriterf_answer.text = strrespdata & " = write single block ok" else writesingleblockrf = false ?txtwriterf_answer.text = strrespdata & " = error code" end if end if end function 6.3.2 transparent write single block command c/c++ source code example int writesingleblockrf (void) { int entry3; int i; int irsplength=0x18; int ireqlen,irsplen,iresult; unsigned char sreqdata[32]={0}; unsigned char srspdata[32]={0}; /* rf write single block request format*/ /* feig reader parameters : 021f*/ /* flag : 0a */ /* rf write command : 21*/ /* address : 01fa (note: send fa01 = lsb byte first) */ /* data : 01020304*/ /* request = 021f + 0a21fa0101020304*/ sreqdata[0] = (uchar)0x02; sreqdata[1] = (uchar)0x1f; sreqdata[2] = (uchar)0x0a; sreqdata[3] = (uchar)0x21; sreqdata[4] = address_parameter[1];/* ex: 0x01fa -> fa 01 to be sent */ sreqdata[5] = address_parameter[0]; sreqdata[6] = data_parameter[0]; sreqdata[7] = data_parameter[1]; sreqdata[8] = data_parameter[2]; sreqdata[9] = data_parameter[3]; ireqlen = 10; /* (number of characters :param=2 in request) */ printf("\n\n\n\n");
rf iso 15693 transparent commands AN3224 42/49 doc id 17559 rev 2 printf("\n>>> rf write at adress %.2x%.2x data %.2x%.2x%.2x%.2x : ",address_parameter[0], address_parameter[1],data_parameter[0],data_parameter[1],data_param eter[2], data_parameter[3]); printf("\n --> request : {021f} "); for (i=2; i answer : "); if (irsplen == 0) printf("no tag answer received"); else for (i=0; i AN3224 feig reference documents doc id 17559 rev 2 43/49 appendix a feig reference documents installation manual: m30100-3de-id-b.pdf feusb manual: h00501-7e-id-b.pdf feisc manual: h9391-27e-id-b.pdf standard readers manual: h60700-2e-id-b.pdf standard readers manual: h60301-1e-id-b.pdf
useful source code zip files AN3224 44/49 doc id 17559 rev 2 appendix b useful source code zip files the AN3224.zip package contains two simple projects to test the rf iso 15693 high-level and transparent commands. these projects can be used to understand how to develop an application to communicate with the feig rf usb readers: AN3224_vb_sourcecode folder contains the visual basic project AN3224_c_sourcecode folder contains the c/c++ project, the AN3224.zip package can be downloaded from http://www.st.com/dualeeprom.
AN3224 list of error codes doc id 17559 rev 2 45/49 appendix c list of error codes c.1 feusb error codes the error codes which are returned by the feusb iso 15693 and i 2 c commands are the following: c.1.1 common errors #define feusb_err_empty_devicelist -1100 #define feusb_err_empty_scanlist -1101 #define feusb_err_pointer_is_null -1102 #define feusb_err_no_more_mem -1103 #define feusb_err_set_configuration -1104 #define feusb_err_kernel -1105 #define feusb_err_unsupported_option -1106 #define feusb_err_unsupported_method -1107 c.1.2 scanning errors #define feusb_err_no_feig_device -1110 #define feusb_err_no_feig_device -1110 #define feusb_err_search_mismatch -1111 #define feusb_err_no_device_found -1112 #define feusb_err_device_is_scanned -1113 #define feusb_err_scanlist_overflow -1114 c.1.3 handle errors #define feusb_err_unknown_hnd -1120 #define feusb_err_hnd_is_null -1121 #define feusb_err_hnd_is_negative -1122 #define feusb_err_no_hnd_found -1123 c.1.4 communication errors #define ? feusb_err_timeout \ 1130 #definefeusb_err_timeout \ 1130 #define feusb_err_n o_senddata \ 1131 #define feusb_err_unknown_interface \ 1132 #define feusb_err_unknown_direction \ 1133 #define feusb_err_recbuf_too_small \ 1134 #define feusb_err_senddata_len \ 1135 #define feusb_err_unknown_ descriptor_type \ 1136 #define feusb_err_device_not_present \ 1137 c.1.5 open/close device errors #define feusb_err_device_not_scanned -1140 #define feusb_err_devhnd_not_in_scanlist -1141 #define feusb_err_driverlist -1142
list of error codes AN3224 46/49 doc id 17559 rev 2 c.1.6 parameter errors #define feusb_err_unknown_parameter -1150 #define feusb_err_parameter_out_of_range -1151 #define feusb_err_odd_parameterstring -1152 #define feusb_err_index_out_of_range -1153 #define feusb_err_unknown_scanoption -1154 #define feusb_err_unknown_errorcode -1155 c.1.7 identification errors #define feusb_err_dev_desc_length -1160 #define feusb_err_cfg_desc_length -1161 #define feusb_err_intf_desc_length -1162 #define feusb_err_endp_desc_length -1163 #define feusb_err_hid_desc_length -1164 #define feusb_err_strg_desc_length -1165 #define feusb_err_read_dev_descriptor -1166 #define feusb_err_read_cfg_descriptor -1167 #define feusb_err_read_strg_descriptor -1168 #define feusb_err_max_interfaces -1170 #define feusb_err_max_endpoints -1171 #define feusb_err_max_strings -1172 c.2 feisc error codes c.2.1 common errors #define feisc_err_newreader_failure -4000 #define feisc_err_empty_list -4001 #define feisc_err_pointer_is_null -4002 #define feisc_err_no_more_mem -4003 #define feisc_err_unknown_comm_port -4004 #define feisc_err_unsupported_function -4005 #define feisc_err_no_usb_support -4006 #define feisc_err_old_fecom -4007 c.2.2 query errors #define feisc_err_no_value -4010 c.2.3 handle errors #define feisc_err_unknown_hnd -4020 #define feisc_err_hnd_is_null -4021 #define feisc_err_hnd_is_negative -4022 #define feisc_err_no_hnd_found -4023 #define feisc_err_porthnd_is_negative -4024 #define feisc_err_hnd_unvalid -4025
AN3224 list of error codes doc id 17559 rev 2 47/49 c.2.4 communication errors #define feisc_err_protlen -4030 #define feisc_err_checksum -4031 #define feisc_err_busy_timeout -4032 #define feisc_err_unknown_status -4033 #define feisc_err_no_recprotocol -4034 #define feisc_err_cmd_byte -4035 #define feisc_err_transceive -4036 #define feisc_err_rec_bus_adr -4037 c.2.5 parameter errors #define feisc_err_unknown_parameter -4050 #define feisc_err_parameter_out_of_range -4051 #define feisc_err_odd_parameterstring -4052 #define feisc_err_unknown_errorcode -4053 #define feisc_err_unsupported_option -4054 #define feisc_err_unknown_epc_type -4055 c.2.6 plug-in errors #define feisc_err_no_plugin -4060 #define feisc_err_plugin_present -4061 #define feisc_err_unknown_plugin_id -4062 #define feisc_err_pi_build_data -4063 #define feisc_err_pi_build_frame -4064 #define feisc_err_pi_split_frame -4065 #define feisc_err_pi_split_data -4066 c.2.7 communication data flow errors #define feisc_err_buffer_overflow -4070 c.2.8 task errors #define feisc_err_task_still_running -4080 #define feisc_err_task_not_started -4081 #define feisc_err_task_timeout -4082 #define feisc_err_task_socket_init -4083 #define feisc_err_task_busy -4084 #define feisc_err_thread_cancel_error -4085
revision history AN3224 48/49 doc id 17559 rev 2 revision history table 21. document revision history date revision changes 15-oct-2010 1 initial release. 19-sep-2011 2 replaced part number ?m24lr64-r? with ?m24lrxx? throughout the document. updated value of lngrsplength in table 19: example of write single block command in visual basic and table 20: example of write single block command in c/c++ .
AN3224 doc id 17559 rev 2 49/49 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a parti cular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. unless expressly approved in writing by two authorized st representatives, st products are not recommended, authorized or warranted for use in milita ry, air craft, space, life saving, or life sustaining applications, nor in products or systems where failure or malfunction may result in personal injury, death, or severe property or environmental damage. st products which are not specified as "automotive grade" may only be used in automotive applications at user?s own risk. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2011 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN3224

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X