<?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>NFCのトピックRe: PN532 read card fail</title>
    <link>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1180274#M7870</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would appear that are either a migration or a custom implementation is this correct?&lt;/P&gt;
&lt;P&gt;In this case I would recommend you to check the &lt;A href="https://www.nxp.com/docs/en/application-note/AN10664_1_NFC_FRI_SDK_206810.zip" target="_blank"&gt;NFC-FRI SDK (NFC Forum Reference Implementation) &lt;/A&gt;&amp;nbsp;&amp;nbsp;and use the examples as a base for you implementation. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards, &lt;BR /&gt;Estephania&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2020 18:32:22 GMT</pubDate>
    <dc:creator>stephanie_m</dc:creator>
    <dc:date>2020-11-09T18:32:22Z</dc:date>
    <item>
      <title>PN532 read card fail</title>
      <link>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1178449#M7864</link>
      <description>&lt;P&gt;I try to use PN532 to read a card, and it fail. Attached is the PN532 driver code and below is the main function code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    while (1)
    {

        uint8_t success;
        uint8_t uid[] = {0, 0, 0, 0, 0, 0, 0}; // Buffer to store the returned UID
        uint8_t uidLength;                     // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

        // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
        // 'uid' will be populated with the UID, and uidLength will indicate
        // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
        success = pn532_readPassiveTargetID(&amp;amp;nfc, PN532_MIFARE_ISO14443A, uid, &amp;amp;uidLength, 0);

        if (success)
        {
            // Display some basic information about the card
       //     ESP_LOGI(TAG, "Found an ISO14443A card");
            ESP_LOGI(TAG, "Found an card");
            ESP_LOGI(TAG, "UID Length: %d bytes", uidLength);

            ESP_LOGI(TAG, "UID Value:");

        //    esp_log_buffer_hexdump_internal(TAG, uid, uidLength, ESP_LOG_INFO);
            ESP_LOG_BUFFER_HEX_LEVEL(TAG, uid, uidLength, ESP_LOG_INFO);

            if(uidLength==4)
            {
            	mifare_classic_handling();
            }
            else if(uidLength==7)
            {
            	mifare_ultralight_handling();
            }else
            {
            	ESP_LOGE(TAG, "unknown card detected");
            }



            vTaskDelay(1000 / portTICK_RATE_MS);         
        }
        else
        {
            // PN532 probably timed out waiting for a card
            ESP_LOGI(TAG, "Timed out waiting for a card");
        }
    	if(++count&amp;gt;=255)
    		count =0;
    }&lt;/LI-CODE&gt;&lt;LI-CODE lang="c"&gt;void mifare_classic_handling(void)
{
	uint8_t write_buffer[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
	uint8_t read_buffer[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};


	ESP_LOGI(TAG, "mifare classic");
	write_buffer[0]=count;
	/*
	ESP_LOGI(TAG, "write test data:");
	ESP_LOG_BUFFER_HEX_LEVEL(TAG, write_buffer, 4, ESP_LOG_INFO);
	if(pn532_mifareclassic_WriteDataBlock(&amp;amp;nfc,0,write_buffer)==1)
	{
		  ESP_LOGI(TAG, "write test data succeed");
	}else   ESP_LOGI(TAG, "write test data fail");
	*/
	ESP_LOGI(TAG, "read test data:");

    if(pn532_mifareclassic_ReadDataBlock(&amp;amp;nfc,0,read_buffer)==1)
    {
    	  ESP_LOGI(TAG, "read test data succeed");
    	  ESP_LOG_BUFFER_HEX_LEVEL(TAG, read_buffer, 16, ESP_LOG_INFO);
    }else
    {
    	ESP_LOGI(TAG, "read test data fail");
    }

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The console log output of the firmware is as following when I put a card above the pn532 antenna. It seems that it can read UID of the card. But it cannot read the data of the card. Please comment on this issue&lt;/P&gt;&lt;P&gt;I (32030) APP: Found an card&lt;BR /&gt;I (32030) APP: UID Length: 4 bytes&lt;BR /&gt;I (32030) APP: UID Value:&lt;BR /&gt;I (32030) APP: ba 08 f7 3f&lt;BR /&gt;I (32030) APP: mifare classic&lt;BR /&gt;I (32030) APP: read test data:&lt;BR /&gt;Trying to read 16 bytes from block 0&lt;BR /&gt;Unexpected response: 00 ff 03 fd d5 41 13 d7 00 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa&lt;BR /&gt;I (32410) APP: read test data fail&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 03:32:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1178449#M7864</guid>
      <dc:creator>pylin</dc:creator>
      <dc:date>2020-11-05T03:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: PN532 read card fail</title>
      <link>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1180018#M7869</link>
      <description>&lt;P&gt;Add more description:&lt;/P&gt;&lt;P&gt;Inside&amp;nbsp;pn532_mifareclassic_ReadDataBlock() function, it suppose that the 8th byte of&amp;nbsp;PN532_COMMAND_INDATAEXCHANGE command response should be 0x00. However it is not. Therefore, it output error.&lt;/P&gt;&lt;P&gt;Anyone can help in this&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 09:50:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1180018#M7869</guid>
      <dc:creator>pylin</dc:creator>
      <dc:date>2020-11-09T09:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: PN532 read card fail</title>
      <link>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1180274#M7870</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would appear that are either a migration or a custom implementation is this correct?&lt;/P&gt;
&lt;P&gt;In this case I would recommend you to check the &lt;A href="https://www.nxp.com/docs/en/application-note/AN10664_1_NFC_FRI_SDK_206810.zip" target="_blank"&gt;NFC-FRI SDK (NFC Forum Reference Implementation) &lt;/A&gt;&amp;nbsp;&amp;nbsp;and use the examples as a base for you implementation. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards, &lt;BR /&gt;Estephania&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 18:32:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/PN532-read-card-fail/m-p/1180274#M7870</guid>
      <dc:creator>stephanie_m</dc:creator>
      <dc:date>2020-11-09T18:32:22Z</dc:date>
    </item>
  </channel>
</rss>

