cancel
Showing results for 
Search instead for 
Did you mean: 

blocking vs nonblocking RFAL apis

Luke_abc
Associate III

Hi, 

I am trying to understand the difference between blocking/non-blocking rfal apis.

 

 

ReturnCode rfalNfcvPollerReadMultipleBlocks( uint8_t flags, const uint8_t* uid, uint8_t firstBlockNum, uint8_t numOfBlocks, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );

 

 

It seems to me that the above api is a blocking one. How can I achieve the same functionality in a non-blocking way ? 

The reason I am asking this is because it seems that this api is taking too much time to execute (Without the time required to perform I2C read). Is my understanding correct on the RFAL library sequence for the above api ?

  1. RFAL library request ST25R3916 for the requested amount of data.
  2. RFAL waits in a busy wait loop until interrupt pin changes
  3. Once the interrupt pin changes, RFAL library performs read from ST25R3916.

I am concerned about step 2 as it is a busy wait loop and other threads seem to be starving. 

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi

rfalNfcvPollerReadMultipleBlocks is a blocking API. The duration of this call depends on the number of blocks requested. 

You can try to use rfalNfcvPollerReadMultipleBlocks with a smaller number of requested blocks or use a loop of rfalNfcvPollerReadSingleBlocks to avoid a too long blocking time.

Or you can format the rfalNfcvPollerReadMultipleBlocks request and send it through non blocking rfalStartTransceive  / rfalGetTransceiveStatus.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Brian TIDAL
ST Employee

Hi

rfalNfcvPollerReadMultipleBlocks is a blocking API. The duration of this call depends on the number of blocks requested. 

You can try to use rfalNfcvPollerReadMultipleBlocks with a smaller number of requested blocks or use a loop of rfalNfcvPollerReadSingleBlocks to avoid a too long blocking time.

Or you can format the rfalNfcvPollerReadMultipleBlocks request and send it through non blocking rfalStartTransceive  / rfalGetTransceiveStatus.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.