<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PN7462: Mifare operation in phExCcid example in NFC</title>
    <link>https://community.nxp.com/t5/NFC/PN7462-Mifare-operation-in-phExCcid-example/m-p/1256745#M8389</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you are doing well. The phExCcid_Check_Presence_L3A_Card function also Activates the card, so you cannot omit this part, to be able to read/write. In this example, the Activation is only present in this function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ricardo&lt;/P&gt;</description>
    <pubDate>Mon, 05 Apr 2021 16:43:12 GMT</pubDate>
    <dc:creator>Ricardo_Zamora</dc:creator>
    <dc:date>2021-04-05T16:43:12Z</dc:date>
    <item>
      <title>PN7462: Mifare operation in phExCcid example</title>
      <link>https://community.nxp.com/t5/NFC/PN7462-Mifare-operation-in-phExCcid-example/m-p/1252029#M8328</link>
      <description>&lt;P&gt;In the function&amp;nbsp;phExCcid_Handle_USB_Process, the code would check the card status with the&amp;nbsp;&lt;BR /&gt;phExCcid_Check_Presence_L3A_Card function, which would hat the card and then activate the card.&lt;/P&gt;&lt;P&gt;And before any Mifare operations, like read, write, autheication, the same checking mechanism would be executed.&lt;/P&gt;&lt;P&gt;Therefore card would be frequently being halted and activated over and over again during the operations.&lt;/P&gt;&lt;P&gt;I would like to cancel this mechanism, so I naively comment the&amp;nbsp;phExCcid_Check_Presence_L3A_Card function and the latter authentication code as the following code segment.&lt;/P&gt;&lt;P&gt;But after this modification, all the Mifare operations like read, write, authentication all failed.&lt;/P&gt;&lt;P&gt;Could someone suggest how to make the modification?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static void phExCcid_Handle_USB_Process(phacDiscLoop_Sw_DataParams_t *psDiscLoopParams)
{
    uint8_t *pp;
    uint16_t wOutLen;

    static phStatus_t status = PH_ERR_FAILED;

    volatile uint32_t dwBits = 0;
    uint32_t dwEventTimeOut = 0xF;

    uint8_t bErrorAPDU[2] = { 0x6A, 0x81 };
    uint16_t wOptions = 0;
    /** Send the Card Inserted Information to the host. */
    phExCcid_UsbCcid_CardInserted();

    while (true)
    {
		/*
		.
		.
		.
		*/

        if ((gphExCcid_sUsb_SlotInfo.bCLSlotType == PH_EXCCID_USBCCID_CL_TYPE_B) ||
            (gphExCcid_sUsb_SlotInfo.bCLSlotType == PH_EXCCID_USBCCID_CL_TYPE_A_L4))
        {
            /* Check for the Card Presence and Exit the loop if not presence is detected */
            status = phExCcid_Check_Presence_L4_Card(psDiscLoopParams);
            if (status != PH_ERR_SUCCESS)
            {
                gphExCcid_sUsb_SlotInfo.bAtrValid = 0;
                phpalI14443p4_ResetProtocol(psDiscLoopParams-&amp;gt;pPal14443p4DataParams);
                phExCcid_UsbCcid_CardRemoved();
                break;
            }
        }
        else if ((gphExCcid_sUsb_SlotInfo.bCLSlotType == PH_EXCCID_USBCCID_CL_MIFARECLASSIC))
        {
            // status = phExCcid_Check_Presence_L3A_Card(psDiscLoopParams, 0);
            /* Check for the Card Presence and Exit the loop if not presence is detected */
            //if ((status != PH_ERR_SUCCESS) &amp;amp;&amp;amp; (status != PH_ERR_INTEGRITY_ERROR))
            //{
            //    gphExCcid_sUsb_SlotInfo.bAtrValid = 0;
            //    phExCcid_UsbCcid_CardRemoved();
            //    break;
            //}
        }
		/*
		.	
		.
		.
		*/

        /** Wait for the Events for the CL Cards. */
        dwBits = phRtos_EventGroupWaitBits(gphExCcid_sUsb_EventInfo.xCL_Events,
                                           PH_EXCCID_USBCCID_CL_TRNSP_EX_CMD |
                                           PH_EXCCID_USBCCID_CL_DEACTIVATE_CARD_CMD |
                                           PH_EXCCID_USBCCID_CL_AUTH_CMD |
                                           PH_EXCCID_USBCCID_CL_READ_CARD_CMD |
                                           PH_EXCCID_USBCCID_CL_WRITE_CARD_CMD |
										   PH_EXCCID_USBCCID_CL_HALT_CMD |
										   PH_EXCCID_USBCCID_CL_DESELECT_CMD |
										   PH_EXCCID_USBCCID_CL_MIFARE_CMD,
                                           true, /* status bits should be cleared before returning. */
                                           false, /* wait for any status bit being set. */
                                           dwEventTimeOut); /* wait until the time expires. */
		/*
		.	
		.
		.
		*/

       /** Authentication Command Events. */
       if (dwBits &amp;amp; (uint32_t) PH_EXCCID_USBCCID_CL_AUTH_CMD)
       {
    	   LOG_TXT("CL_AUTH\n");
            if ((gphExCcid_sUsb_SlotInfo.bCLSlotType == PH_EXCCID_USBCCID_CL_MIFARECLASSIC))
            {
            	/* Put the Card in the known state */
            	//if (PH_ERR_SUCCESS != phExCcid_Check_Presence_L3A_Card(psDiscLoopParams, 1))
				//{
				//	/** Authentication Failure. */
				//	phExCcid_UsbCcid_PCSC_Send_APDU(0x6A, 0x82, 0);
				//	return;
				//}
            	/** Perform the Authentication in the Mifare Classic Card. */
                status = phExCcid_Mifare_Do_Auth(PH_EXCCID_MIFARE_AUTHENTICATE_LC);

                if (status == PH_ERR_SUCCESS)
                {
                    /** Send the Success Status on Successful Authentication. */
                    gphExCcid_sUsb_MifareInfo.bAuth = 1;
                    phExCcid_UsbCcid_PCSC_Send_APDU(0x90, 0x00, 0);
                }
                else
                {
                    /** Send the Failure Status on Authentication failure. */
                    gphExCcid_sUsb_MifareInfo.bAuth = 0;
                    phExCcid_UsbCcid_PCSC_Send_APDU(0x69, 0x82, 0);
                }
            }
       } /* - PH_EXCCID_USBCCID_CL_AUTH_CMD */
	          /** Card Read Command Events. */
       if (dwBits &amp;amp; (uint32_t) PH_EXCCID_USBCCID_CL_READ_CARD_CMD)
       {
    	   LOG_TXT("CL_READ\n");
            /** Check for the CL type as Mifare Classic. */
            if (gphExCcid_sUsb_SlotInfo.bCLSlotType == PH_EXCCID_USBCCID_CL_MIFARECLASSIC)
            {
            	/* Put the Card in the known state */
            	//if (PH_ERR_SUCCESS != phExCcid_Check_Presence_L3A_Card(psDiscLoopParams, 0))
                //{
                //	/** Authentication Failure. */
                //	phExCcid_UsbCcid_PCSC_Send_APDU(0x6A, 0x82, 0);
                //	return;
                //}
            	///** Check for the Authentication. */
                //if (PH_ERR_SUCCESS != phExCcid_Mifare_Do_Auth(PH_EXCCID_MIFARE_AUTHENTICATE_P2))
                //{
                //   /** Authentication Failure. */
                //    phExCcid_UsbCcid_PCSC_Send_APDU(0x69, 0x82, 0);
                //    return;
                //}

                /** Perform the Read Operation on the Mifare Classic Card. */
                phExCcid_Mifare_Read_Operations();
            }
            else if (gphExCcid_sUsb_SlotInfo.bCLSlotType == PH_EXCCID_USBCCID_CL_MIFAREULTRALIGHT)
            {
                /** Perform the Read Operation on the Mifare Ultralight Card. */
                phExCcid_Mifare_Read_Operations();
            }
       } /* - PH_EXCCID_USBCCID_CL_READ_CARD_CMD */
		/*
		.	
		.
		.
		*/
    } /* - While */
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 09:35:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/PN7462-Mifare-operation-in-phExCcid-example/m-p/1252029#M8328</guid>
      <dc:creator>jayyehtw</dc:creator>
      <dc:date>2021-03-25T09:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: PN7462: Mifare operation in phExCcid example</title>
      <link>https://community.nxp.com/t5/NFC/PN7462-Mifare-operation-in-phExCcid-example/m-p/1256745#M8389</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you are doing well. The phExCcid_Check_Presence_L3A_Card function also Activates the card, so you cannot omit this part, to be able to read/write. In this example, the Activation is only present in this function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ricardo&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 16:43:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/PN7462-Mifare-operation-in-phExCcid-example/m-p/1256745#M8389</guid>
      <dc:creator>Ricardo_Zamora</dc:creator>
      <dc:date>2021-04-05T16:43:12Z</dc:date>
    </item>
  </channel>
</rss>

