2025-10-13 1:26 AM
Hello everyone. I'm currently developing and testing an embedded C software for microcontroller STM32L476 integrated on board ST25R3911B.
In order to better understand FTM and its features, I'm trying to use a ST25NFC_Embedded_Lib_ST25R3911B_1.8.0 demo project ( \ST25NFC_Embedded_Lib_ST25R3911B_1.8.0\Projects\STM32L476RG-Nucleo\Applications\X-NUCLEO-NFC05A1 ).
Currently I'm facing RX issues on packets over 32 bytes.
Down below I attach thw two log outputs (TX = 32 bytes, RX = 32 bytes) and (TX = 96 bytes; expected RX = 192 bytes)
I really don't understand what's messing around here since everything on my traget device is actually working fine.
Thank you.
2025-10-13 2:45 AM
Hi,
in the log of LOG_TX_96_RX_192 I find a line
ST25FTM_StateRxPacket()] Rx (253)
which IMO indicates a packet of 253 bytes to be received. I don't have the details where exactly this comes from. But I know that the used software has a limit of 255 byte frames for NFC-V (rfalNfcvWorkingData.codingBuffer). Maybe with some overhead on the 253 you are running into this limitation?!
BR, Ulysses
2025-10-13 3:01 AM - edited 2025-10-13 3:07 AM
@Ulysses HERNIOSUS oops my bad, I've accidentally clicked on "accept as solution"
Anyway, I've noticed that log too, but my target is not sending 253 bytes. Seems suspicious to me, maybe uint8_t overflow? That value comes from:
/* read the whole mailbox */
err = rfalST25xVPollerReadMessage( RFAL_NFCV_REQ_FLAG_DEFAULT, currentDevice->InvRes.UID, 0, 0, msg, ST25FTM_BUFFER_LENGTH, &rcvLen );
if(err == ERR_NONE)
{
/* remove status byte */
*msg_len = rcvLen - 1;
memmove(msg,&msg[1],*msg_len);
error_count = 0;
return ST25FTM_MSG_OK;
}
ST25FTM_LOG("FTM_ReadMsg: %d\r\n",err);
Please note that I've added Selected mode by "currentDevice->InvRes.UID" pointer as input parameter to driver lib.
2025-10-13 3:25 AM
@Ulysses HERNIOSUS more over, sorry to bother you,
case RFAL_TXRX_STATE_TX_TRANSMIT: /* PRQA S 2003 # MISRA 16.3 - Intentional fall through */
/* Clear FIFO, Clear and Enable the Interrupts */
rfalPrepareTransceive( );
/* Calculate when Water Level Interrupt will be triggered */
gRFAL.fifo.expWL = (uint16_t)( st25r3911CheckReg( ST25R3911_REG_IO_CONF1, ST25R3911_REG_IO_CONF1_fifo_lt, ST25R3911_REG_IO_CONF1_fifo_lt_16bytes) ? RFAL_FIFO_OUT_LT_16 : RFAL_FIFO_OUT_LT_32 );
#if RFAL_FEATURE_NFCV
/*******************************************************************************/
/* In NFC-V streaming mode, the FIFO needs to be loaded with the coded bits */
if( (RFAL_MODE_POLL_NFCV == gRFAL.mode) || (RFAL_MODE_POLL_PICOPASS == gRFAL.mode) )
{
#if 0
/* Debugging code: output the payload bits by writing into the FIFO and subsequent clearing */
st25r3911WriteFifo(gRFAL.TxRx.ctx.txBuf, rfalConvBitsToBytes(gRFAL.TxRx.ctx.txBufLen));
st25r3911ExecuteCommand( ST25R3911_CMD_CLEAR_FIFO );
#endif
/* Calculate the bytes needed to be Written into FIFO (a incomplete byte will be added as 1byte) */
gRFAL.nfcvData.nfcvOffset = 0;
ret = iso15693VCDCode(gRFAL.TxRx.ctx.txBuf, rfalConvBitsToBytes(gRFAL.TxRx.ctx.txBufLen), (((gRFAL.nfcvData.origCtx.flags & (uint32_t)RFAL_TXRX_FLAGS_CRC_TX_MANUAL) != 0U)?false:true),(((gRFAL.nfcvData.origCtx.flags & (uint32_t)RFAL_TXRX_FLAGS_NFCV_FLAG_MANUAL) != 0U)?false:true), (RFAL_MODE_POLL_PICOPASS == gRFAL.mode),
&gRFAL.fifo.bytesTotal, &gRFAL.nfcvData.nfcvOffset, gRFAL.nfcvData.codingBuffer, MIN( (uint16_t)ST25R3911_FIFO_DEPTH, (uint16_t)sizeof(gRFAL.nfcvData.codingBuffer) ), &gRFAL.fifo.bytesWritten);
if( (ret != ERR_NONE) && (ret != ERR_AGAIN) )
{
gRFAL.TxRx.status = ret;
gRFAL.TxRx.state = RFAL_TXRX_STATE_TX_FAIL;
break;
}
/* Set the number of full bytes and bits to be transmitted */
st25r3911SetNumTxBits( rfalConvBytesToBits(gRFAL.fifo.bytesTotal) );
/* Load FIFO with coded bytes */
/* TODO: check bytesWritten does not exceed 255 */
st25r3911WriteFifo( gRFAL.nfcvData.codingBuffer, (uint8_t)gRFAL.fifo.bytesWritten );
}
/*******************************************************************************/
else
#endif /* RFAL_FEATURE_NFCV */
could it be related to FIFO buffer actually full (clear fifo command not called)? That's the part of che code in which there's rfalNfcvWorkingData.codingBuffer
2025-10-13 3:29 AM
Hi,
in case of overrun of codingBuffer an error should be returned and as far as I can see errors are being propagated.
You mentioned a change from your side. Are you sure it is not related? Could you try without?
Ulysses
2025-10-13 3:37 AM
Definetely, I've also tried with "NULL" instead of "currentDevice->InvRes.UID" (on ftm_demo.c source file in your demo that parameter is set to NULL, such as addressed mode) but the result is always the same
2025-10-13 4:32 AM
@Ulysses HERNIOSUS after further investigations, i found out gFtmState.rx.totalDataLength = 299 and from what I understand, there are two (?) packets to be received such as 253 bytes and 47 bytes (status byte included).