cancel
Showing results for 
Search instead for 
Did you mean: 

Enter secure mode on a Tag using a St25R3916 on a X Nucleo NFC08A1

CT-55555
Senior

Hello everyone, 

for my project I need to enter the secure mode on a em4233 Glastag. I also use X-Cube-NFC6. The rfal-librarys only support tags from STM. I do not know how to send the command to the Tag can some explain or provide a example. 

Thanks

CT55555_0-1698392643178.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

I would suggest to use rfalNfcvPollerTransceiveReq. You will find an example in rfalST25xVPollerPresentPassword that build the ST Custom command Present Password (in file rfal_st25xv.c). This should be very close to the EM Login command. 

Something like this should do the job:

#define RFAL_NFCV_CMD_EM_LOGIN          0xE4 /*!< EM Login command                           */
#define RFAL_NFCV_EM_IC_MFG_CODE        0x16 /*!< EM IC Mfg code (used for custom commands)  */
#define RFAL_NFCV_CMD_EM_LOGIN_PWD_LEN  4    /*!< EM Login password len                      */ 
ReturnCode rfalST25xVPollerEMLogin( uint8_t flags, const uint8_t* uid, const uint8_t *pwd)
{
    uint16_t           rcvLen;
    rfalNfcvGenericRes res;
    
    return rfalNfcvPollerTransceiveReq( RFAL_NFCV_CMD_EM_LOGIN, flags, RFAL_NFCV_EM_IC_MFG_CODE, uid, pwd, RFAL_NFCV_CMD_EM_LOGIN_PWD_LEN, (uint8_t*)&res, sizeof(rfalNfcvGenericRes), &rcvLen );   
}

 

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

6 REPLIES 6
Brian TIDAL
ST Employee

Hi,

I would suggest to use rfalNfcvPollerTransceiveReq. You will find an example in rfalST25xVPollerPresentPassword that build the ST Custom command Present Password (in file rfal_st25xv.c). This should be very close to the EM Login command. 

Something like this should do the job:

#define RFAL_NFCV_CMD_EM_LOGIN          0xE4 /*!< EM Login command                           */
#define RFAL_NFCV_EM_IC_MFG_CODE        0x16 /*!< EM IC Mfg code (used for custom commands)  */
#define RFAL_NFCV_CMD_EM_LOGIN_PWD_LEN  4    /*!< EM Login password len                      */ 
ReturnCode rfalST25xVPollerEMLogin( uint8_t flags, const uint8_t* uid, const uint8_t *pwd)
{
    uint16_t           rcvLen;
    rfalNfcvGenericRes res;
    
    return rfalNfcvPollerTransceiveReq( RFAL_NFCV_CMD_EM_LOGIN, flags, RFAL_NFCV_EM_IC_MFG_CODE, uid, pwd, RFAL_NFCV_CMD_EM_LOGIN_PWD_LEN, (uint8_t*)&res, sizeof(rfalNfcvGenericRes), &rcvLen );   
}

 

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.

Hi, 

first of all thank you so much. I tried to understand the function.

If the request format of a cmd looks different, can the function rfalNfcvPollerTransceiveReq() still be used? For example, how about in this case.

The structure of the function is similar to before, but I don't quite understand how to pass the bits to the Page Nb and Protect statuses. Because in the function: rfalNfcvPollerTransceiveReq() there is only one variable for the data.

CT55555_2-1698401044885.png

 

 

 

 

Brian TIDAL
ST Employee

Hi,

this is quite simple. Just create a new function with those 2 parameters (Page and Status) and encode them as a single array before calling rfalNfcvPollerTransceiveReq. This should give something like this.

#define RFAL_NFCV_CMD_EM_PROTECTPAGE           0xzz /*!< EM Protect Page command                    */
#define RFAL_NFCV_CMD_EM_PROTECTPAGE_DATA_LEN  2    /*!< EM Protect Page data len                   */ 
ReturnCode rfalST25xVPollerEMProtectPage( uint8_t flags, const uint8_t* uid, const uint8_t pageNb, const uint8_t protectStatus)
{
    uint16_t           rcvLen;
    rfalNfcvGenericRes res;
    uint8_t            data[RFAL_NFCV_CMD_EM_PROTECTPAGE_DATA_LEN];
    
    data[0] = pageNb;
    data[1] = protectStatus;
    
    return rfalNfcvPollerTransceiveReq( RFAL_NFCV_CMD_EM_LOGIN, flags, RFAL_NFCV_EM_IC_MFG_CODE, uid, data, RFAL_NFCV_CMD_EM_PROTECTPAGE_DATA_LEN, (uint8_t*)&res, sizeof(rfalNfcvGenericRes), &rcvLen );   
}

 

If you need to use more custom commands, make sure to create related encoding functions.

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.

Hi, 

I've added the features to the tag. However, it is not possible to protect the read or write process yet. 

Rgds

Hi, 

maybe it could be that the flags were not set correctly. 

Login: 

CT55555_2-1698413230825.png

 

Protect Memory Page: 

CT55555_1-1698413204665.png

 

 

 

Brian TIDAL
ST Employee

Hi

I afraid I cannot help so much on custom features of tag from competitors. I would suggest to post on their community or to contact their support.

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.