cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration Security Session via RF not working

anjalani
Associate

I am working with the ST25DV tags.  I have generated a capability container, TLV Header and Terminator and construct a well-formed NDEF message with 5 records.  I am able to read/write single/multiple blocks and perform most actions that i need in interacting or editing the NDEF records themselves.

I am now trying to split the user memory into different sections so that I can lock down RF write of the first 3 records and leave the last 2 records open for both RF read/write.

I am currently testing on Android and attempting to open a configuration security session.  I am using the react-native-nfc-manager to help me handle some of the lower level aspects of working with these tags.

Here is a simplified version of my function:

async function openSecuritySessionAndroid() {
    if (promptRef.current) {
      await NfcManager.cancelTechnologyRequest();
      await sleep(100);
      promptRef.current.show('Ready to Scan');
      await NfcManager.requestTechnology([NfcTech.NfcV]);
    }

    try {
      const iso15693Handler = NfcManager.nfcVHandler;
      const flags = 0x02;
      const commandCode = 0x26;

      // Send the Reset to Ready command
      const response = await iso15693Handler.transceive([flags, commandCode]);
      console.log('Reset to Ready Response:', response);
    } catch (error) {
      console.warn('Error resetting tag to ready:', error);
    }

    try {
      const flags = 0x02;
      const commandCode = 0xb3;
      const passwordNumber = 0x00;
      const rfPassword0 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];

      const response = await NfcManager.nfcVHandler.transceive([
        flags,
        commandCode,
        passwordNumber,
        ...rfPassword0,
      ]);

      console.log('Security Session Opened on Android:', response);
    } catch (error) {
      console.warn('Error opening security session on Android:', error);
    }
    await NfcManager.cancelTechnologyRequest();
  }

 When I run this and scan the tag, I am getting the following error, which I understand as meaning that I have not been able to open a configuration security session.

 

Reset to Ready Response: [0]
LOG  Security Session Opened on Android: [1, 2]

I have tested with many tags that I do not think are locked in any way.  When I use the NFC Tap app to look at the Area Security Status, there is 1 Area and it is read/write Not Protected. Also LockCFG is also 00h.

Greatly appreciate any help with regards to this.

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

Hello, 

I think that your Present Password command is not formed correctly.
If you look at the datasheet, you will se that the command takes the following arguments:
- request flags (0x02 for you)
- command code (0xB3 for present password)
- IC Manufacturer code : 0x02
- password number (0x00 in your case)
- password value (8*0x00 in your case)

From your code, I think the IC Manufacturer code byte is missing, so the ST25DV doesn't recognize the command.

Best regards.

View solution in original post

2 REPLIES 2
JL. Lebon
ST Employee

Hello, 

I think that your Present Password command is not formed correctly.
If you look at the datasheet, you will se that the command takes the following arguments:
- request flags (0x02 for you)
- command code (0xB3 for present password)
- IC Manufacturer code : 0x02
- password number (0x00 in your case)
- password value (8*0x00 in your case)

From your code, I think the IC Manufacturer code byte is missing, so the ST25DV doesn't recognize the command.

Best regards.

That's brilliant thanks. 

think this is related to the fact that when I use the lower level transceive() method (for Android) or the customCommand() method (for IOS), then the IC Manufacturer Code needs to be included if the specs show that is is supposed to be included. 

For many of the higher level methods that have been included as part of the react-native-nfc-manager, the IC Manufacturer Code is abstracted away.

All sorted now :)