2023-10-27 12:49 AM
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
Solved! Go to Solution.
2023-10-27 02:11 AM
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
2023-10-27 02:11 AM
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
2023-10-27 03:04 AM
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.
2023-10-27 04:30 AM
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
2023-10-27 06:02 AM
Hi,
I've added the features to the tag. However, it is not possible to protect the read or write process yet.
Rgds
2023-10-27 06:27 AM
Hi,
maybe it could be that the flags were not set correctly.
Login:
Protect Memory Page:
2023-10-27 06:40 AM
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