<?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: First write to NTAG213 fails, second attempt succeeds (Flutter)</title>
    <link>https://community.nxp.com/t5/NFC/First-write-to-NTAG213-fails-second-attempt-succeeds-Flutter/m-p/2132657#M13395</link>
    <description>&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;Hello, I hope you are doing fine.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;My apologies sir,&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;Unfortunately, the support for Flutter is out of my support scope. I'll be happy to help with any NTAG 213 functionality issue or the implementation of our software using our software.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;We do have a Library called &lt;A href="https://www.nxp.com/design/design-center/software/rfid-developer-resources/taplinx-software-development-kit-sdk:TAPLINX" target="_self"&gt;Taplinx&lt;/A&gt;&amp;nbsp;, is for both Android and, iOS.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;TapLinx does have a full API for our Tags interfacing with your smartphone.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;I'm very sorry, I can only recommend please request support with the respective developer's sites of the API you are using.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jul 2025 18:44:11 GMT</pubDate>
    <dc:creator>Fabian_R</dc:creator>
    <dc:date>2025-07-11T18:44:11Z</dc:date>
    <item>
      <title>First write to NTAG213 fails, second attempt succeeds (Flutter)</title>
      <link>https://community.nxp.com/t5/NFC/First-write-to-NTAG213-fails-second-attempt-succeeds-Flutter/m-p/2132621#M13394</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hello NXP team,&lt;/P&gt;&lt;P&gt;I'm currently working with NTAG213 PVC cards in a Flutter mobile application using the flutter_nfc_kit package, and I'm facing a consistent and puzzling issue:&lt;/P&gt;&lt;P&gt;Problem:&lt;BR /&gt;After using my application to secure the card, then trying to write on it using an external app, the first write attempt always fails.&lt;/P&gt;&lt;P&gt;However, the second attempt immediately afterward succeeds without issue.&lt;/P&gt;&lt;P&gt;Even more puzzling: the card remains readable, although my code should lock both read and write access.&lt;/P&gt;&lt;P&gt;Password Setup (from Backend):&lt;BR /&gt;The backend provides the following:&lt;BR /&gt;"pwd": [18, 52, 86, 120]&lt;BR /&gt;"pack": [18, 52]&lt;/P&gt;&lt;P&gt;In my code:&lt;BR /&gt;- I write PWD to page 0x2B&lt;BR /&gt;- I write PACK to page 0x2C&lt;BR /&gt;- I write AUTH0 + ACCESS to page 0x29 as [0x00, 0x80, 0x00, 0x00]&lt;/P&gt;&lt;P&gt;This should lock both read and write access from page 0 unless authenticated.&lt;/P&gt;&lt;P&gt;My Questions:&lt;BR /&gt;- Is this a known behavior on NTAG213 cards?&lt;BR /&gt;- Am I missing something in my configuration or command sequence?&lt;/P&gt;&lt;P&gt;My Full Flutter Code (Writing + Locking):&lt;/P&gt;&lt;P&gt;Future&amp;lt;void&amp;gt; startNFCScan() async {&lt;BR /&gt;_isProcessing.value = true;&lt;BR /&gt;try {&lt;BR /&gt;var availability = await FlutterNfcKit.nfcAvailability;&lt;BR /&gt;if (availability != NFCAvailability.available) {&lt;BR /&gt;CustomSnackBar.error('NFC Not Available');&lt;BR /&gt;_isProcessing.value = false;&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var tag = await FlutterNfcKit.poll(&lt;BR /&gt;iosMultipleTagMessage: "Multiple tags found!",&lt;BR /&gt;iosAlertMessage: "Scan your tag",&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;await _encodeCard(tag: tag);&lt;BR /&gt;} catch (error) {&lt;BR /&gt;CustomSnackBar.error(error.toString());&lt;BR /&gt;}&lt;BR /&gt;_isProcessing.value = false;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Future&amp;lt;void&amp;gt; _encodeCard({required NFCTag tag}) async {&lt;BR /&gt;List&amp;lt;ndef.NDEFRecord&amp;gt; records = await FlutterNfcKit.readNDEFRecords();&lt;BR /&gt;if (records.isNotEmpty &amp;amp;&amp;amp; records[0].payload!.isNotEmpty) {&lt;BR /&gt;CustomSnackBar.error('NFC Tag already has been encoded');&lt;BR /&gt;await FlutterNfcKit.finish();&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt;final model = EncodeCardRequestModel.fromTag(tag);&lt;BR /&gt;final response = await ApiServices.encodeCardApi(model);&lt;/P&gt;&lt;P&gt;if (response != null) {&lt;BR /&gt;EncodeCardResponseModel responseModel = response;&lt;BR /&gt;await _lockCard(responseModel);&lt;BR /&gt;CustomSnackBar.success('Card written successfully!');&lt;BR /&gt;}&lt;BR /&gt;} catch (e) {&lt;BR /&gt;log(e.toString());&lt;BR /&gt;CustomSnackBar.error('Failed to encode card');&lt;BR /&gt;} finally {&lt;BR /&gt;await FlutterNfcKit.finish();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Future&amp;lt;void&amp;gt; _lockCard(EncodeCardResponseModel responseModel) async {&lt;BR /&gt;final writeToCardValue = responseModel.data.writeToCard;&lt;BR /&gt;final List&amp;lt;int&amp;gt; pwd = responseModel.data.nfcSecurity.pwd;&lt;BR /&gt;final List&amp;lt;int&amp;gt; pack = responseModel.data.nfcSecurity.pack;&lt;BR /&gt;final dataBytes = base64Decode(writeToCardValue);&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; dataBytes.length; i += 4) {&lt;BR /&gt;final page = 4 + (i ~/ 4);&lt;BR /&gt;final block = dataBytes.sublist(&lt;BR /&gt;i,&lt;BR /&gt;(i + 4 &amp;gt; dataBytes.length) ? dataBytes.length : i + 4,&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;while (block.length &amp;lt; 4) {&lt;BR /&gt;block.add(0x00);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;final cmd = [0xA2, page, ...block];&lt;BR /&gt;final uint8listCmd = Uint8List.fromList(cmd);&lt;BR /&gt;await FlutterNfcKit.transceive(uint8listCmd);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;final transceivePWD = [0xA2, 0x2B, ...pwd];&lt;BR /&gt;final uint8listPwd = Uint8List.fromList(transceivePWD);&lt;BR /&gt;final pwdResponse = await FlutterNfcKit.transceive(uint8listPwd);&lt;/P&gt;&lt;P&gt;final transceivePack = [0xA2, 0x2C, ...pack, 0x00, 0x00];&lt;BR /&gt;final uint8listPack = Uint8List.fromList(transceivePack);&lt;BR /&gt;final packResponse = await FlutterNfcKit.transceive(uint8listPack);&lt;/P&gt;&lt;P&gt;final transceiveAuth = [0xA2, 0x29, 0x00, 0x80, 0x00, 0x00];&lt;BR /&gt;final uint8listAuth = Uint8List.fromList(transceiveAuth);&lt;BR /&gt;final authResponse = await FlutterNfcKit.transceive(uint8listAuth);&lt;/P&gt;&lt;P&gt;log(pwdResponse.toString());&lt;BR /&gt;log(packResponse.toString());&lt;BR /&gt;log(authResponse.toString());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Any advice or explanation will be greatly appreciated &lt;LI-EMOJI id="lia_folded-hands" title=":folded_hands:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 16:29:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/First-write-to-NTAG213-fails-second-attempt-succeeds-Flutter/m-p/2132621#M13394</guid>
      <dc:creator>AshrafxLevi</dc:creator>
      <dc:date>2025-07-11T16:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: First write to NTAG213 fails, second attempt succeeds (Flutter)</title>
      <link>https://community.nxp.com/t5/NFC/First-write-to-NTAG213-fails-second-attempt-succeeds-Flutter/m-p/2132657#M13395</link>
      <description>&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;Hello, I hope you are doing fine.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;My apologies sir,&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;Unfortunately, the support for Flutter is out of my support scope. I'll be happy to help with any NTAG 213 functionality issue or the implementation of our software using our software.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;We do have a Library called &lt;A href="https://www.nxp.com/design/design-center/software/rfid-developer-resources/taplinx-software-development-kit-sdk:TAPLINX" target="_self"&gt;Taplinx&lt;/A&gt;&amp;nbsp;, is for both Android and, iOS.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;TapLinx does have a full API for our Tags interfacing with your smartphone.&lt;/FONT&gt;&lt;/P&gt;
&lt;P lang="en-US"&gt;&lt;FONT size="3"&gt;I'm very sorry, I can only recommend please request support with the respective developer's sites of the API you are using.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 18:44:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/First-write-to-NTAG213-fails-second-attempt-succeeds-Flutter/m-p/2132657#M13395</guid>
      <dc:creator>Fabian_R</dc:creator>
      <dc:date>2025-07-11T18:44:11Z</dc:date>
    </item>
  </channel>
</rss>

