Skip to main content
Graduate
October 27, 2023
Solved

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

  • October 27, 2023
  • 3 replies
  • 1714 views

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

 

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    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

    3 replies

    Technical Moderator
    October 27, 2023

    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

    CT-55555Author
    Graduate
    October 27, 2023

    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

     

     

     

     

    Technical Moderator
    October 27, 2023

    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

    CT-55555Author
    Graduate
    October 27, 2023

    Hi, 

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

    Rgds

    Technical Moderator
    October 27, 2023

    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