Skip to main content
VGone.1
Associate
February 16, 2021
Solved

Hello, I'm using ST25R3911B device and rfal library. I see that the data is read using a blocking function (rfalTransceiveBlockingRx). In my case the waiting time in this function is about 12ms. How can I replace it by a non-blocking function ? Thank

  • February 16, 2021
  • 4 replies
  • 1599 views

..

This topic has been closed for replies.
Best answer by Ulysses HERNIOSUS

Hi Vincent,

then in your state machine do something like:

switch (state){
....
case WAIT_NFC_TXRX_ACTIVE:
 rfalWorker();
 if (ERR_BUSY != rfalGetTransceiveStatus())
 state = NFC_TXRX_DONE;
 break;
....

Regards, Ulysses

4 replies

Ulysses HERNIOSUS
Technical Moderator
February 16, 2021

Hi VGone.1,

just replicate what the blocking functions are essentially doing: Create a transceive context, then call rfalWorker as long as the transceive status says ERR_BUSY:

 rfalCreateByteFlagsTxRxContext( ctx, txBuf, txBufLen, rxBuf, rxBufLen, actLen, flags, fwt );
 EXIT_ON_ERR( ret, rfalStartTransceive( &ctx ) );
 do{
 rfalWorker();
 ret = rfalGetTransceiveStatus();
 }
 while((ret == ERR_BUSY) ;
 
 return ret;

Of course you can also place the calls into a state machine running the transceive. rfal_nfc.c is a convenient layer which which breaks tag detection, activation and data transfers into a state machine offering convenient interfaces.

Best Regards, Ulysses

VGone.1
VGone.1Author
Associate
February 16, 2021

Hi Ulysses,

Thank you for your quick answer. I've already try to adapt the function to be run into a state machine but I wasn't able to read the tags. I will retry as soon as possible.

VGone.1
VGone.1Author
Associate
February 21, 2021

Hi,

In my case, the status remains indefinitely "BUSY". Is there something else I can try to solve this problem ?

Ulysses HERNIOSUS
Technical Moderator
February 22, 2021

Hi VGone.1,

above code should do exactly the same as the ...Blocking... functions so if they work the code snippet should also work. Did you correctly put rfalWorker() inside the loop?

Regards, Ulysses

VGone.1
VGone.1Author
Associate
February 22, 2021

Hi Ulysses,

You're right, but I don't want to use a do...while loop. I want to call a function rfalTransceiveNonBlockingRx(). This function calls rfalWorker() and rfalGetTransceiveStatus() without any loop. My goal is to call the function rfalTransceiveNonBlockingRx() several times in a state machine until the status is "Not Busy".

Best regards,

Vincent

Ulysses HERNIOSUS
Technical Moderator
February 22, 2021

Hi Vincent,

then in your state machine do something like:

switch (state){
....
case WAIT_NFC_TXRX_ACTIVE:
 rfalWorker();
 if (ERR_BUSY != rfalGetTransceiveStatus())
 state = NFC_TXRX_DONE;
 break;
....

Regards, Ulysses