‎2019-07-03 04:42 AM
Hi,
I'm using RFID reader ST25R3911B to read/write on ISO15693 card. I'm unable to perform a write to the card and i'm using "Writesingleblock" function mentioned in code/lib cube-nfc5(ver 1.2). I followed the steps which was mentioned in an earlier thread "https://community.st.com/s/question/0D50X00009XkWNXSA3/st25r3911b-calls-to-readwrite-block-after-successful-inventoryget-id" but still unable to get through.
In that it was mentioned to use Select mode instead of Address mode but while using Select mode i'm getting Timeout error. But if i switch to Address mode then Read goes through successfully but write ends up in Ignore Error. Then when i try to read back the block to which i have written it remains all zeros. Is there anything which i'm missing out on? Below is my reference code.
#define NFCV_BLOCK_LEN 4
ReturnCode err1;
uint8_t rxBuf[1+NFCV_BLOCK_LEN+2];
uint16_t rcvLen = 1;
uint8_t wrBuf[NFCV_BLOCK_LEN] = {0x11,0x22,0x33,0x44};
err = rfalNfcvPollerCollisionResolution(1, &nfcvDev, &devCnt);
if( (err == ERR_NONE) && (devCnt > 0) )
{
#if 0 //Select mode
err1 = rfalNfvSelect(RFAL_NFCV_REQ_FLAG_DEFAULT,nfcvDev.InvRes.UID);
if(err1 == ERR_NONE))
{
err1 = rfalNfvReadSingleBlock(RFAL_NFCV_REQ_FLAG_DEFAULT,NULL,3,rxBuf,sizeof(rxBuf),&rcvLen);
if(err1 == ERR_NONE)
{
err1 = rfalNfvWriteSingleBlock(RFAL_NFCV_REQ_FLAG_DEFAULT,NULL,3,wrBuf,sizeof(wrBuf));
err1 = rfalNfvReadSingleBlock(RFAL_NFCV_REQ_FLAG_DEFAULT,NULL,3,rxBuf,sizeof(rxBuf),&rcvLen);
}
}
#else //Address mode
err1 = rfalNfvReadSingleBlock(RFAL_NFCV_REQ_FLAG_DEFAULT,nfcvDev.InvRes.UID,3,rxBuf,sizeof(rxBuf),&rcvLen);
if(err1 == ERR_NONE)
{
err1 = rfalNfvWriteSingleBlock(RFAL_NFCV_REQ_FLAG_DEFAULT,nfcvDev.InvRes.UID,3,wrBuf,sizeof(wrBuf));
err1 = rfalNfvReadSingleBlock(RFAL_NFCV_REQ_FLAG_DEFAULT,nfcvDev.InvRes.UID,3,rxBuf,sizeof(rxBuf),&rcvLen);
}
#endif
}
Solved! Go to Solution.
‎2019-07-05 12:51 AM
Hi Sach,
if you look at the data sheet then you will find that the (optional) Select command is not supported in this tag. So you need to use Adressed mode.
Also in the Supported Command Set table you will find that Write is only supported when using option flag. Please change your flags for write to:
(RFAL_NFCV_REQ_FLAG_OPTION | RFAL_NFCV_REQ_FLAG_DEFAULT)
I still don't understand where you could get ERR_IGNORE. This error is only used in rfal_nfca.c. Maybe you have also an issue on the MCU. Maybe stack too small?
Regards, Ulysses
‎2019-07-04 08:41 AM
Hi,
the code you are referring has been reworked in the meantime. It is probably worth a try of integrating a new version of RFAL for ST25R3911B available from st.com: STSW-ST25RFAL001
Also some more questions:
Regards, Ulysses
‎2019-07-04 06:43 PM
Hi Ulysses,
I'll try the new version, in the meantime here are the answers to your queries.
The other details which i forgot to mention in my earlier query is that i'm using STM32F072 as the main processor to interact with ST25R3911B. So far i'm able to read all tags for my project(basically Type-A and Type-V).
Regards,
Sach
‎2019-07-04 06:51 PM
‎2019-07-05 12:17 AM
Hi Ulysses,
i tried the new version(ST25RFAL001_v2.0.8) but it still did not help. I'm observing the same result as my original code outcome. Is there anything else i need to do?
Regards,
Sach
‎2019-07-05 12:51 AM
Hi Sach,
if you look at the data sheet then you will find that the (optional) Select command is not supported in this tag. So you need to use Adressed mode.
Also in the Supported Command Set table you will find that Write is only supported when using option flag. Please change your flags for write to:
(RFAL_NFCV_REQ_FLAG_OPTION | RFAL_NFCV_REQ_FLAG_DEFAULT)
I still don't understand where you could get ERR_IGNORE. This error is only used in rfal_nfca.c. Maybe you have also an issue on the MCU. Maybe stack too small?
Regards, Ulysses
‎2019-07-05 01:10 AM
Hi Ulysses,
You are right, ERR_IGNORE is used only in nfca.c but it still returns this err code when i try to write in nfcv.:(
After modifying the code with your inputs not the error code changed to timeout.
When you said stack too small, is there any such requirement of stack size?
Any work around?
Regards,
Sach
‎2019-07-05 01:24 AM
Hi Sach,
typically we use "Stack_Size EQU 0x800" inside startup_*.s
AFAIK by default CubeMX generates a smaller stack.
Regards, Ulysses
‎2019-07-05 01:34 AM
Hi Ulysses,
The stack size we have it here is configured at 0x1000.
Regards,
Sach
‎2019-07-05 01:55 AM
Hi Sach,
I guess you will need to debug then where this value gets set.
One more hint, probably unrelated to the given issue: We have seen issues with STM32F072 SPI Hal driver requiring the buffers to be 16-bit aligned. You may want to activate USE_FULL_ASSERT for HAL drivers to discover such.
Regards, Ulysses.