Skip to main content
Associate II
April 17, 2026
Solved

st25r100 How to use function "rfalTransceiveBlockingTxRx" send 36 bits data

  • April 17, 2026
  • 1 reply
  • 106 views

@Ulysses HERNIOSUS 

Dear Ulysses,

Sorry to bother you again.

 

code : 

err = rfalTransceiveBlockingTxRx(tx_buf, sizeof(tx_buf), rx_buf, sizeof(rx_buf), &actlen, RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_KEEP|RFAL_TXRX_FLAGS_PAR_RX_REMV|RFAL_TXRX_FLAGS_CRC_RX_MANUAL, 71680U);
 
I want to send 4 bytes data and 4 bits parity, how do i combine those 36 bits data to 5 bytes data and send with function rfalTransceiveBlockingTxRx.
 
for example:
data_enc: 03, de, 59, bd
parity_enc: 00, 00, 00, 00
tx_buf: 03, bc, 65, e9, 05
is it correct? can rfalTransceiveBlockingTxRx send 4bit data?
 
Thanks
Best answer by Ulysses HERNIOSUS

Hi,

as communicated in previous posts: Go step by step! First verify your CRC and parity and bit oriented sending is working using a well-known command without crypto. E.g. use a T2T and perform a read block using the mentioned methods. Only then move to your crypto.

BR, Ulysses

1 reply

Ulysses HERNIOSUS
Technical Moderator
April 17, 2026

Hi, 

  • the frame cannot be sent using the blocking byte-oriented rfalTransceiveBlockingTxRx(). You need to use the bit-oriented rfalStartTransceive().... interface.
  • I think your parity encoding is incorrect. It should be odd parity so 03 1 de 1 59 1 bd 1

Yes, you can also transfer 4 bits.

Ulysses

wenjieAuthor
Associate II
April 18, 2026

RFAL has to use st25r200WriteFifo to send data which can only send full bytes. I don't think RFAL can send bits.

I'm trying reading block data from M1 card which need encoded parity. When encoded parity is the same as normal parity and use rfalTransceiveBlockingTxRx and RFAL_TXRX_FLAGS_PAR_TX_AUTO, I can read data successfully. So encoding is correct. Nothing is wrong but sending 36 bits data ifself.

Could you help check whether my code is wrong or RFAL doesn't support incomplete bytes sending?

 

code:

rfalTransceiveContext ctx;
    ctx.txBuf = tx_buf;
    ctx.txBufLen = 36;
    ctx.rxBuf = rx_buf;
    ctx.rxBufLen = sizeof(rx_buf) * 8;
    ctx.rxRcvdLen = &actlen;
    ctx.flags = RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_KEEP|RFAL_TXRX_FLAGS_PAR_RX_REMV|RFAL_TXRX_FLAGS_CRC_RX_MANUAL;
    ctx.fwt = 71680U;
    err = rfalStartTransceive(&ctx);
    do{
        rfalWorker();
        err = rfalGetTransceiveStatus();
    }
    while( (rfalIsTransceiveInTx()) && (err == RFAL_ERR_BUSY) );
    platformLog("err: %d, actlen: %d\r\n", err, actlen);
    err = rfalTransceiveBlockingRx();
Ulysses HERNIOSUS
Technical Moderator
April 20, 2026

Hi,

yes, only full bytes are written into FIFO. But nbtx bits tell how many bits to transmit from the last byte.

There is no need to call rfalIsTransceiveInTx() or rfalTransceiveBlockingRx(). Just wait until rfalGetTransceiveStatus() does not return RFAL_ERR_BUSY anymore.

From a first glimpse the rest look correct.

BR, Ulysses