Skip to main content
Graduate
May 9, 2024
Solved

iOS Transceive ISO 15693 always throws Tag Connection Lost and Stack Error

  • May 9, 2024
  • 2 replies
  • 2828 views

We are currently using Flutter for our NFC App development, and used the 'Flutter_nfc_kit' package for NFC Connection. We have successfully implemented the Android's workflow. The workflow consists of :
1) Get UID

2) invoke custom command of GetRandomNumber

3) Use the GetRandomNumber values to encrypt the password that is going to be entered

4) invoke custom command of PresentPassword with the encrypted password

5) Retrieve the data from the password-locked memory

 

In Android, it all went well but when we built the iOS version, we encountered some errors.

 

The code that we used for the Android device for the transceive bytes format are exactly the same, but in iOS,

it throws an error of : Tag Connection Lost (when I didn't input the IC Mfg. Code) and Stack Error (when I input the IC Mfg. Code). This is the example of the code that we sent for the 'GetRandomNumber' command =>
[0x20 (request flags), 0xB4 (OpCode), 0x02 (IC Mfg. Code), UID].

 

I have set up the iOS info.plist file with the basic NFC Settings =>

<key>com.apple.developer.nfc.readersession.formats</key>
    <array>
    <string>TAG</string>
    <string>NDEF</string>
</array>
 
And in the attachment below, I will show how the flutter_nfc_kit package handle the iOS code for the NFC handling.
Any suggestions and help would be helpful, and please let me know if there are some unclear statements!

 

 

 

    This topic has been closed for replies.
    Best answer by victor laraison

    Hi ivannagara,

    in iOS, the custom command does not work in Addressed mode. This is a bug into iOS CoreNFC.
    So, you must use the "non addressed" flag when sending a command. 
    If I understand weel, you should replace [0x20 (request flags)] by [0x00 or 0x02 (request flags)]
    In addition, you don't have to pass the IC code (0x02) as it is automatically added by iOS CoreNFC .
    And UID is not needed as you work in Non Addressed mode. 

    Hope it helps and clarifies.

    Thx for you feedback.

     

    2 replies

    ST Employee
    May 13, 2024

    Hi ivannagara,

    in iOS, the custom command does not work in Addressed mode. This is a bug into iOS CoreNFC.
    So, you must use the "non addressed" flag when sending a command. 
    If I understand weel, you should replace [0x20 (request flags)] by [0x00 or 0x02 (request flags)]
    In addition, you don't have to pass the IC code (0x02) as it is automatically added by iOS CoreNFC .
    And UID is not needed as you work in Non Addressed mode. 

    Hope it helps and clarifies.

    Thx for you feedback.

     

    Graduate
    May 14, 2024

    Thanks for the reply.

    I agree with the statement that you stated, and I have fixed the problem.

    I also found out that I cannot use the 'tag.sendRequest(...)' function even though it is for ISO 15693 tags, but I must use the 'tag.customCommand(...)' function for the GetRandomNumber and PresentPassword commands.

    But for the ReadMultipleBlocks command, I must use the 'tag.sendRequest(...)' because it will throw error if I use the other one. I think this is pretty weird, but I'm just letting anyone who has the same problem know about this.

    I hope this helps, thanks!

    Best Regards,

    Ivan Nagara 


    ST Employee
    May 15, 2024

    thx for feedback.
    Regarding ReadMultipleblock :

    • you don't use the iO CoreNFC  readMultipleBlock command directly ?  What is the error returned ? What are the parameters you sent in the command ? 
    • We use this command for our tag, and all is working fine.