cancel
Showing results for 
Search instead for 
Did you mean: 

ST25DVXX Android SDK: com.st.st25sdk.type5.st25dv.ST25DVTag.manageGpoCommand(ST25DVTag.GpoCommand cmd, byte flag) how to use in addressed mode

IMoun
Associate II

Looking for a way to control ST25 GPO in a way similar to com.st.st25sdk.type5.st25dv.ST25DVTag.manageGpoCommand(ST25DVTag.GpoCommand cmd, byte flag) but in the addressed mode (with Address_flag set to 1). The method above would control any tag in the vicinity of the NFC device, but I'd like to address a specific tag by it's UID.

1 ACCEPTED SOLUTION

Accepted Solutions

​Hello,

please take a look at the example Android code provided in:

ST25SDK-1.5.0\integration\android\examples\ST25AndroidDemoApp\app\src\main\java\st\com\st25androiddemoapp\TagDiscovery.java

AndroidReaderInterface is defined in

ST25SDK-1.5.0\integration\android\examples\ST25AndroidDemoApp\st25.android.reader.interface\st25_android_reader_interface.aar

    static public TagInfo performTagDiscovery(Tag androidTag) throws STException{
        TagInfo tagInfo = new TagInfo();
        tagInfo.nfcTag = null;
        tagInfo.productID = PRODUCT_UNKNOWN;
 
        Log.v(TAG, "Starting TagDiscovery");
 
        if(androidTag == null) {
            Log.e(TAG, "androidTag cannot be null!");
            return null;
        }
 
        AndroidReaderInterface readerInterface = AndroidReaderInterface.newInstance(androidTag);
 
        if (readerInterface == null) {
            tagInfo.nfcTag = null;
            tagInfo.productID = PRODUCT_UNKNOWN;
            return tagInfo;
        }
 
        // More code here...
 
}

Regards,

Damien

View solution in original post

9 REPLIES 9
Damien G.
ST Employee

Hello,

If you want to sent Type5 commands in addressed mode, you can use the ST25DVTag API as you mentioned. Make sure you pass the correct value of the flag so that the addressed bit (b6, mask 0x20) is set. The UID used for the command will be the one set at the creation of the tag (myUid in the example below):

ST25DVTag myTag = new ST25DVTag(myReaderInterface, myUid);
byte responseByte = myTag.manageGpoCommand(gpoValue, flag & 0x20);

The second solution is to go through the command API and set the flag byte and uid byte array to the values that you desire:

Iso15693CustomCommand cmdIso15693Custom = new Iso15693CustomCommand(readerInterface, uid);
byte responseByte = cmdIso15693Custom.manageGpo(gpoValue, flag, uid);

Hope this makes it clearer for you.

Regards,

Damien

Hi Damien,

Thank you for the prompt response.

I was able to implement the 2nd method in the test project (based on the ST25SDK-1.5.0. Android sample).

Unfortunately I'm getting exact same results as I got while experimenting with CR95HF reader: seems like the addressed mode does not apply to the GPO control command.

In other words cmdIso15693Custom.manageGpo(0/1, 0x22, uid) with hardcoded UID controls GPO of any ST25DV tag whether the UID is matching or not.

In my tests I'm using ST25DV_Discovery_ANT_C5 mtag and a few ANT-7-T-ST25DV04K tags.

Cheers,

Ivan

JL. Lebon
ST Employee

​Dear Ivan,

Yes, it looks like the ManageGPO command is executed on other tags that are not in the field, even if UID is not matching there own.

I can think of two workaround to address this.

The first way would be to activate the GPO interrupt (RF_USER or RF_INTERRUPT, don't know which one you are using) on demand only on the tag on which you want to have it toggle.

It means, by default, all tags in the field have the RF_USER (or RF_INTERRUPT) bit of the GPO static register configured to 0 (disabled).

When you want to have the GPO signal of one specific tag to toggle, you will have to first enable the GPO RF_USER interrupt (or RF_INTERRUPT) by sending a Present password command, with password 0 (configuration password) to this tag in addressed mode with it's UID, then a Write Configuration command, in addressed mode, to change value of the GPO static register and enable the RF_USER (or RF_INTERRUPT)  interruption -> set 1 in corresponding bits. Then you can send the ManageGPO command to this specific tag whiteout risking to have it toggling on other tags, as the GPO interruption is disabled on other tags..

Off course, when done, you need to disable again the GPO interrupts on this tag (Present password 0, then Write Configuration to GPO static register with value 0 in RF_USER or RF_INTERRUPT). This is a complex procedure, but this works. 

Second way would be to use the CMOS version of ST25DV (ST25DVxxK-JFR6). The idea is to use the energy harvesting in order to enable the GPO pin output on the tag you want to have GPO toggling,

The way to do this, is to connect the V_EH pin to the VDCG pin. VDCG pin is the power supply input for the CMOS version of the GPO pin. When no power is present on VDCG pin, the GPO output is High-Z. When VDCG is supplied with power, the GPO pin works as programmed by the GPO register and ManageGPO command.

By default, all tags in the field must have the energy harvesting disabled (EH_MODE static register programmed to 0x01). When you want to toggle GPO pin on a specific tag, you will first enable energy harvesting on this tag with the Write Dynamic Configuration command to the EH_CTRL_Dyn register, setting value 0x01 (in addressed mode with UID of the desired tag). This will enable EH on this tag, and provide power to the VDCG pin, and allow GPO output on this tag. Then you can send the ManageGPO command. As this is the only tag with power on the VDCG pin, only this tag will have the GPO pin toggling. When done, you need to disable the Eh on this tag again, by sending a Write Dynamic Configuration to EH_CTRL_dyn register with value 0x00. This workaround is simpler than the first one, but requires a CMOS version of the tag.

Sorry for this long message and for the difficulty to use the ManageGPO command with multiple tags. I hope the workaround proposed can help you in your project.

Best regards.

CTiwa.1
Associate II

i want to know about readerinterface ??

CTiwa.1
Associate II

how you define myReaderInterface ??

import com.st.st25android.AndroidReaderInterface;

please write the way you declare the object myReaderInterface . unable to import this lib

can you please tell me about the gpoValue and flag

​Hello,

please take a look at the example Android code provided in:

ST25SDK-1.5.0\integration\android\examples\ST25AndroidDemoApp\app\src\main\java\st\com\st25androiddemoapp\TagDiscovery.java

AndroidReaderInterface is defined in

ST25SDK-1.5.0\integration\android\examples\ST25AndroidDemoApp\st25.android.reader.interface\st25_android_reader_interface.aar

    static public TagInfo performTagDiscovery(Tag androidTag) throws STException{
        TagInfo tagInfo = new TagInfo();
        tagInfo.nfcTag = null;
        tagInfo.productID = PRODUCT_UNKNOWN;
 
        Log.v(TAG, "Starting TagDiscovery");
 
        if(androidTag == null) {
            Log.e(TAG, "androidTag cannot be null!");
            return null;
        }
 
        AndroidReaderInterface readerInterface = AndroidReaderInterface.newInstance(androidTag);
 
        if (readerInterface == null) {
            tagInfo.nfcTag = null;
            tagInfo.productID = PRODUCT_UNKNOWN;
            return tagInfo;
        }
 
        // More code here...
 
}

Regards,

Damien