title: How send NfcA command to the MIFARE card?
body: <p>I'm writing an Android application. I'm trying to send <code>NfcA</code> low-level commands (in my case: HALT and WAKE-UP) to my Mifare Plus S card. The <code>NfcA</code> tech is for "low-level" access to ISO 14443 Type A tags (i.e. the
  proprietary protocol as mentioned in ISO 14443-3).</p>
  
  <p>This is part of my code:</p>
  
  <pre><code>protected void onNewIntent(Intent intent) {
      if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
          tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
          UID = Utils.byteArrayToHexString(intent.getByteArrayExtra(NfcAdapter.EXTRA_ID));
      }
      NfcA nfca = null;
      try {
          Log.e(TAG, "WakeUpCMD and HaltCMD");
          nfca = NfcA.get(tagFromIntent);
          nfca.connect();
          Short s = nfca.getSak();
          byte[] a = nfca.getAtqa();
          byte[] HaltCMD = {0x35, 0x30, 0x30,0x30, 0x00};
          byte[] WakeUpCMD = {0x35, 0x32, 0x00};
          byte[] data = null;
          try {
              data = nfca.transceive(HaltCMD);
              length = data.length;
          }
          catch (Exception e){
              Log.e(TAG, "HALT complete "+Utils.byteArrayToHexString(data));
          }
          Log.e(TAG, "Tag is connected: "+nfca.isConnected());
          //Log.e(TAG, "Response from tag "+Utils.byteArrayToHexString(data));
          nfca.setTimeout(100);
          data = nfca.transceive(WakeUpCMD);
          Log.e(TAG, "Response from tag"+Utils.byteArrayToHexString(data));
          nfca.close();
      } catch (Exception e) {
          Log.e(TAG, "Error when reading tag");
  
      }
  } 
  </code></pre>
  
  <p><strong>WAKE-UP</strong> Command is sent by the PCD to put PICCs which have entered the <code>HALT</code> State back into the <code>READY</code>
  State. They shall then participate in further anticollision and selection procedures.</p>
  
  <pre><code>|b7| |b6| |b5| |b4| |b3| |b2| |b1|
  
  |1  |  | 0 |  | 1|  | 0|  | 0|  | 1|  | 0| {‘52’} = WAKE-UP
  </code></pre>
  
  <p><strong>HALT</strong> Command consists of four bytes and shall be transmitted using the Standard Frame.
  First bit transmitted</p>
  
  <pre><code>S | ‘50’ | ‘00’ | CRC_A | E
  </code></pre>
  
  <p>If the PICC responds with any modulation during a period of 1 ms after the end of the <code>HALT</code> Frame, this response shall be interpreted as 'not acknowledge'.</p>
  
  <p>This is the descriptions of the two commands from ISO 14443-3 which I try to send to my card.</p>
  
  <p>When I start my app, I get a "Tag Lost" Exception. Can you help me? What's wrong? How can I send these commands?</p>