cancel
Showing results for 
Search instead for 
Did you mean: 

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 ? Thanks

VGone.1
Associate II
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6
Ulysses HERNIOSUS
ST Employee

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
Associate II

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
Associate II

Hi,

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

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
Associate II

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

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