title: Emulate Desfire EV1 on DUALi DE-ABM4
body: <p>I have an Desfire EV1 Smart Card and try to read it by DUALi reader.
  I'm aware that for the Desfire I need to wrap the command.</p>
  
  <p>Tried sent the simple APDU command like this:</p>
  
  <p><strong>90 60 00 00 00 00</strong></p>
  
  <pre><code>INT uiLen = 0;
  BYTE pbData[256];
  BYTE cmd[6] = {0x90,0x60,0x00,0x00,0x00,0x00};
  
  iDERc = DE_APDU(
              m_sPortNoM,  
              6, cmd, 
              (LPINT)&amp;uiLen, (LPBYTE)pbData);
  </code></pre>
  
  <p>but why the return always : DE_NACK_COUNT_ERROR?</p>
  
  <p>Also tried to send some APDU command to the SAM, always encounter errors. the return code was 1 which is not defined in any Response code definitions.</p>
  
  <p>already send the DE_InitPort and DE_IC_PowerOn command and the return was successful.</p>
  
  <p>Thanks </p>
  
  <p><strong>EDIT :</strong></p>
  
  <blockquote>
    <p>For DE_APDU command and parameters explanation:</p>
    
    <p>int DE_APDU(int nPort, BYTE datalen, LPBYTE data, LPINT outlen, LPBYTE
    lpRes)</p>
    
    <ul>
    <li>It sends and receive data as APDU format defined by ISO7816. Device change it to ISO14443 protocol and send to card, so User can easily
    use this function without knowing of ISO14443 protocol.</li>
    </ul>
    
    <p><strong>- Parameters</strong></p>
    
    <ul>
    <li>int nPort[in] : Port number. </li>
    <li>int datalen[in] : Length of LPBYTE data.</li>
    <li>LPBYTE data[in] : APDU to send to card.</li>
    <li>LPINT outlen[out] : Length of LPBYTE lpRes </li>
    <li>LPBYTE lpRes[out] : Response data.</li>
    </ul>
  </blockquote>