cancel
Showing results for 
Search instead for 
Did you mean: 

Command code not present

Luke_abc
Associate III

Hi,

Luke_abc_0-1708700084209.png

Why does this enum (in rfal_nfcv.h) do not contain the command code for some commands (eg:- Write AFI, Lock AFI etc )? I also do not see an api to do this -  If I need to write to AFI, Am I supposed to use directly api rfalNfcvPollerTransceiveReq() with 0x27h command code ?

@Brian TIDAL 



 

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

The Application Family Identifier (AFI) represents the type of application targeted by the device and is used to extract from all the tags present only the tags meeting the required application.

The ISO 15693 provides the tag decision tree for the AFI. If the inventory contains AFI value=0, all tags supporting the AFI feature reply else (inventory with AFI value different from 0) only tags matching the AFI value reply.

Regarding the flags, WriteAFI and LockAFI can use the same flags as other API (e.g. read single block or write single block). Our demos use RFAL_NFCV_REQ_FLAG_DEFAULT (eventually in conjunction with RFAL_NFCV_REQ_FLAG_SELECT when Selected mode is used by the application).

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Brian TIDAL
ST Employee

Hi,

AFI feature is optional in ISO15693 and not supported in NFC Forum technical specification. The support of Write/Lock AFI can be added in the RFAL:

In rfal_nfcv.h, add the following lines in the NFC-V command set  enum

    RFAL_NFCV_CMD_WRITE_AFI                     = 0x27U,  /*!< Write AFI                                                    */
    RFAL_NFCV_CMD_LOCK_AFI                      = 0x28U,  /*!< Lock AFI                                                     */

In rfal_nfcv.c, add the following functions


/*******************************************************************************/
ReturnCode rfalNfcvPollerWriteAFI( uint8_t flags, const uint8_t* uid, uint8_t afi )
{
    uint16_t           rcvLen;
    rfalNfcvGenericRes res;
    uint8_t            data;
    
    /* Check for valid parameters */

    
    data = afi;
    
    return rfalNfcvPollerTransceiveReq( RFAL_NFCV_CMD_WRITE_AFI, flags, RFAL_NFCV_PARAM_SKIP, uid, &data, sizeof(uint8_t), (uint8_t*)&res, sizeof(rfalNfcvGenericRes), &rcvLen );
}

/*******************************************************************************/
ReturnCode rfalNfcvPollerLockAFI( uint8_t flags, const uint8_t* uid )
{
    uint16_t           rcvLen;
    rfalNfcvGenericRes res;

    
    return rfalNfcvPollerTransceiveReq( RFAL_NFCV_CMD_LOCK_BLOCK, flags, RFAL_NFCV_PARAM_SKIP, uid, NULL, 0, (uint8_t*)&res, sizeof(rfalNfcvGenericRes), &rcvLen );
}

 

Note that you may need to modify the rfalNfcvPollerInventory function if you want to send the AFI during the inventory.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Luke_abc
Associate III

Thanks @Brian TIDAL 

Luke_abc_0-1708782863081.png

The AFI mentioned in the inventory request, Is this Tag's AFI ? What is the need of including AFI in the request ?

Also , how should we select the flags for these apis ? What is the criteria for selecting the flags ?

    RFAL_NFCV_REQ_FLAG_DEFAULT           = 0x02U,         /*!< Default Request Flags                                        */
    RFAL_NFCV_REQ_FLAG_SUB_CARRIER       = 0x01U,         /*!< Sub Carrier flag                                             */
    RFAL_NFCV_REQ_FLAG_DATA_RATE         = 0x02U,         /*!< Data Rate flag      

 

Brian TIDAL
ST Employee

Hi,

The Application Family Identifier (AFI) represents the type of application targeted by the device and is used to extract from all the tags present only the tags meeting the required application.

The ISO 15693 provides the tag decision tree for the AFI. If the inventory contains AFI value=0, all tags supporting the AFI feature reply else (inventory with AFI value different from 0) only tags matching the AFI value reply.

Regarding the flags, WriteAFI and LockAFI can use the same flags as other API (e.g. read single block or write single block). Our demos use RFAL_NFCV_REQ_FLAG_DEFAULT (eventually in conjunction with RFAL_NFCV_REQ_FLAG_SELECT when Selected mode is used by the application).

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Luke_abc
Associate III

Thanks