- 使用 rfalST25xVPollerPresentPassword 打开 RF 用户安全会话,pwdNum=0 (RF_PWD_0),pwd=您的密码,pwdLen=8
- 授权启用 MB(由于 rfalST25xVPollerWriteConfiguration,将 MB_MODE 寄存器中的 MB_MODE 位设置为 1)
- 使用 rfalST25xVPollerReadDynamicConfiguration 读取 MB_CTRL_Dyn 寄存器的当前值
- 将 MB_EN 位设置为 1,并使用 rfalST25xVPollerWriteDynamicConfiguration 将更新后的值写入 MB_CTRL_Dyn 寄存器
- 用 rfalST25xVPollerReadMessageLength 或 rfalST25xVPollerFastReadMessageLength 读取邮箱消息的长度(双速)
- 使用 rfalST25xVPollerReadMessage 或 rfalST25xVPollerFastReadMessage 读取邮箱消息
- #define ST25DV04K_SYSTEM_CONFIG_MB_MODE 0x0D
- #define ST25DV04K_REG_MB_MODE_FTM_AUTHORIZED 1U
- #define ST25DV04K_DYN_REG_MB_CTRL 0x0D
- #define ST25DV04K_REG_MB_CTRL_DYN_MB_EN 1U
- uint8_t pointer;
- uint8_t reg;
- static uint8_t pwd[8] = {0,0,0,0,0,0,0,0};
- uint8_t pwdLen = 8;
- uint8_t pwdNum = 0;
- uint8_t msgLen;
- ReturnCode err;
- uint16_t rcvLen;
- static uint8_t rxBuf[256];
- /* Open RF configuration security session */
- err = rfalST25xVPollerPresentPassword(RFAL_NFCV_REQ_FLAG_DEFAULT, uid, pwdNum, pwd, pwdLen);
- /* set MB_MODE to 1: Enabling fast transfer mode is authorized.*/
- pointer = ST25DV04K_SYSTEM_CONFIG_MB_MODE;
- reg = ST25DV04K_REG_MB_MODE_FTM_AUTHORIZED;
- err = rfalST25xVPollerWriteConfiguration(RFAL_NFCV_REQ_FLAG_DEFAULT, uid, pointer, reg);
- /* set MB_EN to 1: Enable FTM. Read, update and write */
- pointer = ST25DV04K_DYN_REG_MB_CTRL;
- err = rfalST25xVPollerFastReadDynamicConfiguration(RFAL_NFCV_REQ_FLAG_DEFAULT, uid, pointer, ®);
- reg |= ST25DV04K_REG_MB_CTRL_DYN_MB_EN;
- err = rfalST25xVPollerFastWriteDynamicConfiguration(RFAL_NFCV_REQ_FLAG_DEFAULT, uid, pointer, reg);
- /* Read Msg Len */
- err = rfalST25xVPollerFastReadMessageLength(RFAL_NFCV_REQ_FLAG_DEFAULT, uid, &msgLen);
- /* Read Msg */
- err = rfalST25xVPollerReadMessage(RFAL_NFCV_REQ_FLAG_DEFAULT, uid, 0,0, rxBuf, sizeof(rxBuf), &rcvLen);
|