cancel
Showing results for 
Search instead for 
Did you mean: 

Open Session and Deselect in Android Studio

andre2
Associate
Posted on August 11, 2015 at 12:12

Hi,

I'm using the M24SR Discovery Board and I'm having some trouble when I want to communicate with the board via NFC.

I'm trying to open a RF session with my Smartphone so that the GPO of the M24SR is driven low. Then I want to read some values out of the EEPROM and after that I want to close the session again (Deselect).

Sounds easy, but I really do not get it how to send the right command for open session and deselect.

My other code looks like this:

//Select NFC T4 application

                    iso.transceive(global.getT4select());

                    //Select NDEF file

                    iso.transceive(global.getNDEFselect());

                    //Verify the Read password

                    pw = iso.transceive(global.getVerify_read());

                    if(pw[0] == global.check_string[0] && pw[1] == global.check_string[1] ) {

                        /*Read beyond NDEF message*/

                        //Read temperature

                        temp = iso.transceive(new byte[]{(byte) 0xA2, (byte) 0xB0, 0x00, (byte) 0x80, 0x04});

                        //Read operating hours

                        time = iso.transceive(new byte[]{(byte) 0xA2, (byte) 0xB0, 0x00, (byte) 0x84, 0x04});

}

All of the commands are working well, but I do not know how to code the open session and deselect command. I hope you can help me!

Andre
1 ACCEPTED SOLUTION

Accepted Solutions
France Berthelot
ST Employee
Posted on August 23, 2016 at 18:16

Hi,

When the GPO is configured as State Control, the I2C or RF host can control the state of the

GPO by sending a dedicated command.

During an RF or I2C session, the M24SR can control the GPO pin. After receiving a valid Set GPO command, GPO pin is driven low. GPO will be released after a valid Reset command or after a Power off.

Here the cmd:

// use to drive GPO pins to low or to HZ

 static final byte[] m24sr7816STStateCtrlcmd = new byte[]{

                                                                (byte) 0xA2,(byte) 0xD6, // CAS , INS

                                                                (byte) 0x00,(byte) 0x1F, // P1  , P2

                                                                (byte) 0x01,(byte) 0x00  // LC, DATA_1

                                                            };

With

if (setStateHz) // true is

{

    cmd[DATA1_INDEX] = (byte) 0x01;

} else {

    cmd[DATA1_INDEX] = (byte) 0x00;

}

Before sending this command, the system file shall be selected by issuing the System

Select command.

Apologize for delay answer.

Regards

View solution in original post

1 REPLY 1
France Berthelot
ST Employee
Posted on August 23, 2016 at 18:16

Hi,

When the GPO is configured as State Control, the I2C or RF host can control the state of the

GPO by sending a dedicated command.

During an RF or I2C session, the M24SR can control the GPO pin. After receiving a valid Set GPO command, GPO pin is driven low. GPO will be released after a valid Reset command or after a Power off.

Here the cmd:

// use to drive GPO pins to low or to HZ

 static final byte[] m24sr7816STStateCtrlcmd = new byte[]{

                                                                (byte) 0xA2,(byte) 0xD6, // CAS , INS

                                                                (byte) 0x00,(byte) 0x1F, // P1  , P2

                                                                (byte) 0x01,(byte) 0x00  // LC, DATA_1

                                                            };

With

if (setStateHz) // true is

{

    cmd[DATA1_INDEX] = (byte) 0x01;

} else {

    cmd[DATA1_INDEX] = (byte) 0x00;

}

Before sending this command, the system file shall be selected by issuing the System

Select command.

Apologize for delay answer.

Regards