Skip to main content
Visitor II
November 15, 2017
Solved

Open the RF security session on Android device

  • November 15, 2017
  • 1 reply
  • 761 views
Posted on November 15, 2017 at 17:34

Hi,

we are trying to using the ST25DV64K to implement the reading and writing data via RF between the ST25DV64K and Android device.

The area 3 is protected by RF password 3 with default password .

Tried to use the below code to open the RF security session but always return �(byte)0x01�. Could you advise ?

It would be appreciated if the sample code of reading and writing the data on the protected Area is also provided.

Thanks.

public static byte

[]

SendPresentPasswordCommand

(Tag myTag

, byte

PasswordNumber

, byte

[] PasswordData

,

DataDevice ma)

{

   

byte

[] response =

new byte

[] {(

byte

)

0xFF

}

;

    byte

[] PresentPasswordFrame

;

   

PresentPasswordFrame =

new byte

[]{(

byte

)

0x02

,

(

byte

)

0xB3

,

(

byte

)

0x02

,

PasswordNumber

,

PasswordData[

0

]

,

PasswordData[

1

]

,

PasswordData[

2

]

,

PasswordData[

3

]}

;

   

PresentPasswordFrame =

new byte

[]{(

byte

)

0x02

,

(

byte

)

0xB3

,

(

byte

)

0x02

,

(

byte

)

0x03

,

(

byte

)

0x00

,

(

byte

)

0x00

,

(

byte

)

0x00

,

(

byte

)

0x00

}

;

    int

errorOccured =

1

;

    while

(errorOccured !=

0

)

    {

       

try

       

{

            NfcV nfcvTag = NfcV.

get

(myTag)

;

           

nfcvTag.close()

;

           

nfcvTag.connect()

;

           

response = nfcvTag.transceive(PresentPasswordFrame)

;

            if

(response[

0

] == (

byte

)

0x00

|| response[

0

] == (

byte

)

0x01

)

//response 01 = error sent back by tag (new Android 4.2.2) or BC

           

{

                errorOccured =

0

;

               

//Used for DEBUG :

           

}

        }

       

catch

(Exception e)

        {

            errorOccured++

;

           

//Used for DEBUG :

           

if

(errorOccured ==

2

)

            {

               

//Used for DEBUG :

                //Used for DEBUG :

               

return

response

;

           

}

        }

    }

   

return

response

;

}

#st25dv64k #android
    This topic has been closed for replies.
    Best answer by Olivier L
    Posted on November 21, 2017 at 14:23

    Hi Don,

    On ST25DV64K the Area password is 64 bits long. Here is the command that you can use:

    02 b3 02 03 00 00 00 00 00 00 00 00

    Best regards

    Olivier

    1 reply

    Olivier LAnswer
    ST Employee
    November 21, 2017
    Posted on November 21, 2017 at 14:23

    Hi Don,

    On ST25DV64K the Area password is 64 bits long. Here is the command that you can use:

    02 b3 02 03 00 00 00 00 00 00 00 00

    Best regards

    Olivier