TI NFC Write Single Block with Android NfcV (ISO 15693) -


i writing , android app communicate rf430frl152h devices via iso15693. app attempts duplicate existing qt c++ executable uses trf7970a communicate devices.

i consistently unable write single block if option flag set, resulting in android.nfc.taglostexception.

the trf7970a executable follows trf7960 evaluation mode document, states write single block (0x21) must have option flag set (0x40).

i have observed behavior in own app example android apps ti forums: https://e2e.ti.com/support/wireless_connectivity/nfc_rfid/f/667/p/469938/1688321#1688321

a 2011 post in android issue tracker mentions problems android's nfcv , write blocks on common chips, including ti: https://code.google.com/p/android/issues/detail?id=15608

in app prevent android.nfc.taglostexception , no error flag returned. not observing expected behavior later when enabling , setting interrupt field in firmware general control register, not sure complete solution.

to complicate matters further, removing option flag write commands in trf7970a executable continues work correctly.

is correct way write single block? there known problems between android , ti devices, rf430frl152h?

public class mainactivity extends appcompatactivity {     static final string log_tag = mainactivity.class.getsimplename();      nfcadapter mnfcadapter;     nfcv mnfcv;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          mnfcadapter = nfcadapter.getdefaultadapter(this);     }      private void enableforegrounddispatch() {         pendingintent pendingintent = pendingintent.getactivity(this, 0, new intent(this, getclass()).addflags(intent.flag_activity_single_top), 0);          final intentfilter intentfilter = new intentfilter(nfcadapter.action_tech_discovered);          intentfilter[] intentfilters = new intentfilter[] { intentfilter };          string[][] techlistarray = new string[][] { new string[] { nfcv.class.getname() }};          mnfcadapter.enableforegrounddispatch(this, pendingintent, intentfilters, techlistarray);     }      @override     public void onpause() {         super.onpause();         mnfcadapter.disableforegrounddispatch(this);     }      @override     public void onresume() {         super.onresume();         enableforegrounddispatch();     }      @override     protected void onnewintent(intent intent) {         switch(intent.getaction())         {             case nfcadapter.action_tech_discovered:                 onnfctagdiscoveredaction(intent);                 break;              default:                 break;         }     }      private void onnfctagdiscoveredaction(intent intent) {         if(mnfcv != null) {             return;         }          tag tag = intent.getparcelableextra(nfcadapter.extra_tag);          mnfcv = nfcv.get(tag);          asynctask<void, void, void> asynctask = new asynctask<void, void, void>() {             @override             protected void doinbackground(void... params) {                 try {                     mnfcv.connect();                      // trf7970a "010c00030410002101000000" register write request                     // trf7970a "0109000304f0000000" agc toggle                     // trf7970a "0109000304f1ff0000" pm toggle                     // trf7970a "010b000304142401000000" iso 15693 inventory request                     final byte[] inventory = new byte[] { (byte) 0x24, (byte) 0x01, (byte) 0x00 };                     byte[] inventoryresult = mnfcv.transceive(inventory);                      log.d(log_tag, "inventory complete");                      // trf7970a "010c00030418002312010000"                     final byte[] read_multiple_block = new byte[] { (byte)0x00, (byte)0x23, (byte)0x12, (byte)0x01 };                     byte[] readresult = mnfcv.transceive(read_multiple_block);                      log.d(log_tag, "read multiple block complete, result length: " + readresult.length);                      // trf7970a "010f000304180221ff95fe00000000" request mode                     final byte[] write_single_block_no_option = new byte[] { (byte)0x02, (byte)0x21, (byte)0xff, (byte)0x95, (byte)0xfe, (byte)0x00, (byte)0x00 };                     byte[] nooptionresult = mnfcv.transceive(write_single_block_no_option);                      log.d(log_tag, "wrote no option, result length: " + nooptionresult.length);                      // trf7970 "010f00030418402101010100000000" request mode                     final byte[] write_single_block_option = new byte[] { (byte)0x40, (byte)0x21, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x00, (byte)0x00 };                     byte[] optionresult = mnfcv.transceive(write_single_block_option);                      log.d(log_tag, "wrote option, result length: " + optionresult.length);                 }                 catch(exception e) {                     log.d(log_tag, "exception: " + e.tostring());                 }                 return null;             }              @override             protected void onpostexecute(void result)             {                 mnfcv = null;             }         };         asynctask.execute();     } } 


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -